From: Janos Kovacs Date: Sat, 16 Aug 2014 17:48:02 +0000 (+0300) Subject: system-controller: support for window focus X-Git-Tag: accepted/tizen/ivi/20150112.012920~150 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b05ebd67f59a180cbe8372e394be1e5526def99;p=profile%2Fivi%2Fmurphy.git system-controller: support for window focus Change-Id: Ie9d7c7dd939d53f60e213bddc02a16e94c53f451 --- diff --git a/packaging.in/murphy.lua b/packaging.in/murphy.lua index d58065f..031d868 100644 --- a/packaging.in/murphy.lua +++ b/packaging.in/murphy.lua @@ -1088,7 +1088,7 @@ wmgr = window_manager { window_manager_operation_name(oper)) end if oper == 1 then - local wumask = window_mask { -- raise = true, + local wumask = window_mask { --raise = true, visible = true, active = true } local wrmask = window_mask { raise = true, diff --git a/src/plugins/system-controller/wayland/glm-window-manager.c b/src/plugins/system-controller/wayland/glm-window-manager.c index 0d09803..28769cc 100644 --- a/src/plugins/system-controller/wayland/glm-window-manager.c +++ b/src/plugins/system-controller/wayland/glm-window-manager.c @@ -349,8 +349,8 @@ static layer_defaults_t layer_defaults[MRP_WAYLAND_LAYER_TYPE_MAX] = { [ MRP_WAYLAND_LAYER_BACKGROUND ] = { 1, 0.000, VISIBLE }, [ MRP_WAYLAND_LAYER_APPLICATION ] = { 3, 1.000, HIDDEN, }, [ MRP_WAYLAND_LAYER_INPUT ] = { 4, 1.000, HIDDEN }, - [ MRP_WAYLAND_LAYER_TOUCH ] = { 5, 1.000, VISIBLE }, - [ MRP_WAYLAND_LAYER_CURSOR ] = { 6, 1.000, VISIBLE }, + [ MRP_WAYLAND_LAYER_TOUCH ] = { 5, 1.000, HIDDEN }, + [ MRP_WAYLAND_LAYER_CURSOR ] = { 6, 1.000, HIDDEN }, [ MRP_WAYLAND_LAYER_STARTUP ] = { 7, 1.000, HIDDEN }, [ MRP_WAYLAND_LAYER_FULLSCREEN ] = { 8, 1.000, HIDDEN }, }; @@ -2033,6 +2033,10 @@ static void ico_extension_window_active_callback(void *data, ico_extension_t *ico = (ico_extension_t *)data; mrp_wayland_t *wl; mrp_glm_window_manager_t *wm; + ctrl_surface_t *sf; + mrp_wayland_window_t *win; + mrp_wayland_window_update_t u; + char id_str[256]; MRP_ASSERT(ico && ico->interface && ico->interface->wl, "invalid argument"); @@ -2045,6 +2049,35 @@ static void ico_extension_window_active_callback(void *data, MRP_ASSERT(wm, "data inconsitency"); mrp_debug("surfaceid=%u select=%d", surfaceid, select); + + if (!select) { + mrp_debug("ignoring select=0 events"); + return; + } + + surface_id_print(surfaceid, id_str, sizeof(id_str)); + + if (!(sf = surface_find(wm, surfaceid))) { + mrp_debug("can't find surface for id=%s", id_str); + return; + } + + if (!(win = sf->win)) { + mrp_debug("can't forward selection event for surface id=%s " + "(no window)", id_str); + return; + } + + memset(&u, 0, sizeof(u)); + u.mask = MRP_WAYLAND_WINDOW_ACTIVE_MASK; + u.active = 0; + + if ((select & ICO_WINDOW_MGR_SELECT_POINTER)) + u.active |= MRP_WAYLAND_WINDOW_ACTIVE_POINTER; + if ((select & ICO_WINDOW_MGR_SELECT_TOUCH)) + u.active |= MRP_WAYLAND_WINDOW_ACTIVE_TOUCH; + + mrp_wayland_window_update(win, MRP_WAYLAND_WINDOW_ACTIVE, &u); } @@ -2729,8 +2762,8 @@ static bool set_window_mapped(mrp_wayland_window_t *win, } else { if (!ico_window_mgr) { - mrp_debug("can't unmap surface %u (ico-extension not available)", - win->surfaceid); + mrp_debug("can't unmap surface %s (ico-extension not available)", + id_str); return false; } @@ -2933,6 +2966,44 @@ static bool set_window_visibility(mrp_wayland_window_t *win, return true; } +static bool set_window_active(mrp_wayland_window_t *win, + mrp_wayland_window_update_mask_t passthrough, + mrp_wayland_window_update_t *u) +{ + static mrp_wayland_active_t focus_mask = MRP_WAYLAND_WINDOW_ACTIVE_POINTER| + MRP_WAYLAND_WINDOW_ACTIVE_TOUCH ; + + mrp_glm_window_manager_t *wm = (mrp_glm_window_manager_t *)win->wm; + int32_t id_surface = win->surfaceid; + ctrl_surface_t *sf; + int32_t focus_enabled; + char id_str[256]; + + surface_id_print(id_surface, id_str, sizeof(id_str)); + + if (u->active == win->active && + !(passthrough & MRP_WAYLAND_WINDOW_ACTIVE_MASK)) + { + mrp_debug("nothing to do"); + return false; + } + + if (!(sf = surface_find(wm, id_surface))) { + mrp_debug("can't find surface %s", id_str); + return false; + } + + focus_enabled = (u->active & focus_mask) ? 1 : 0; + + mrp_debug("calling ivi_controller_surface_set_input_focus" + "(struct ivi_controller_surface=%p, enabled=%d)", + sf->ctrl_surface, focus_enabled); + + + ivi_controller_surface_set_input_focus(sf->ctrl_surface, focus_enabled); + + return true; +} static void window_request(mrp_wayland_window_t *win, mrp_wayland_window_update_t *u, @@ -2942,8 +3013,6 @@ static void window_request(mrp_wayland_window_t *win, #if 0 static mrp_wayland_window_update_mask_t area_mask = MRP_WAYLAND_WINDOW_AREA_MASK; - static mrp_wayland_window_update_mask_t active_mask = - MRP_WAYLAND_WINDOW_ACTIVE_MASK; #endif static mrp_wayland_window_update_mask_t mapped_mask = MRP_WAYLAND_WINDOW_MAPPED_MASK; @@ -2959,6 +3028,8 @@ static void window_request(mrp_wayland_window_t *win, MRP_WAYLAND_WINDOW_LAYER_MASK; static mrp_wayland_window_update_mask_t visible_mask = MRP_WAYLAND_WINDOW_VISIBLE_MASK; + static mrp_wayland_window_update_mask_t active_mask = + MRP_WAYLAND_WINDOW_ACTIVE_MASK; mrp_wayland_t *wl; @@ -3015,12 +3086,10 @@ static void window_request(mrp_wayland_window_t *win, changed |= set_window_visibility(win, passthrough, u, anims); mask &= ~visible_mask; } -#if 0 else if ((mask & active_mask)) { changed |= set_window_active(win, passthrough, u); mask &= ~active_mask; } -#endif else { mask = 0; } diff --git a/src/plugins/system-controller/wayland/window.c b/src/plugins/system-controller/wayland/window.c index f7be52c..b46f9e8 100644 --- a/src/plugins/system-controller/wayland/window.c +++ b/src/plugins/system-controller/wayland/window.c @@ -874,6 +874,7 @@ static char *active_str(mrp_wayland_active_t active, char *buf, size_t len) static map_t map[] = { { MRP_WAYLAND_WINDOW_ACTIVE_POINTER, "pointer" }, + { MRP_WAYLAND_WINDOW_ACTIVE_TOUCH , "touch" }, { MRP_WAYLAND_WINDOW_ACTIVE_KEYBOARD, "keyboard" }, { MRP_WAYLAND_WINDOW_ACTIVE_SELECTED, "selected" }, { 0, NULL } diff --git a/src/plugins/system-controller/wayland/window.h b/src/plugins/system-controller/wayland/window.h index f2e2421..707b6a8 100644 --- a/src/plugins/system-controller/wayland/window.h +++ b/src/plugins/system-controller/wayland/window.h @@ -37,8 +37,9 @@ enum mrp_wayland_active_e { MRP_WAYLAND_WINDOW_ACTIVE_NONE = 0, MRP_WAYLAND_WINDOW_ACTIVE_POINTER = 1, - MRP_WAYLAND_WINDOW_ACTIVE_KEYBOARD = 2, - MRP_WAYLAND_WINDOW_ACTIVE_SELECTED = 4, + MRP_WAYLAND_WINDOW_ACTIVE_TOUCH = 2, + MRP_WAYLAND_WINDOW_ACTIVE_KEYBOARD = 4, + MRP_WAYLAND_WINDOW_ACTIVE_SELECTED = 8, }; enum mrp_wayland_window_operation_e {