From: Doyoun Kang Date: Fri, 10 May 2019 01:58:37 +0000 (+0900) Subject: add e_client_focus_skip_set and focus_skip event X-Git-Tag: submit/tizen/20190510.072056^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cf02fb5087f357a500b649dd2eaa3a8d3543bf3;p=platform%2Fupstream%2Fenlightenment.git add e_client_focus_skip_set and focus_skip event 1. Add E_API e_client_focus_skip_set to set/unset skip focus property 2. Add E_EVENT_CLIENT_FOCUS_SKIP_SET, E_EVENT_CLIENT_FOCUS_SKIP_UNSET event and these events are triggered when e_client_focus_skip_set is called Change-Id: Idb1c9353c2f2cab141233d5676258de619d4074e --- diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 4c3c7050e7..1678d49f83 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -29,6 +29,8 @@ E_API int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1; #endif E_API int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1; E_API int E_EVENT_CLIENT_BUFFER_CHANGE = -1; +E_API int E_EVENT_CLIENT_FOCUS_SKIP_SET = -1; +E_API int E_EVENT_CLIENT_FOCUS_SKIP_UNSET = -1; static Eina_Hash *clients_hash[E_PIXMAP_TYPE_MAX] = {NULL}; // pixmap->client @@ -902,6 +904,67 @@ _e_client_revert_focus_get(E_Client *ec) return focus_ec; } +static void +_e_client_event_focus_skip_set(E_Client *ec, Eina_Bool by_client) +{ + E_Event_Client_Focus_Skip_Set *ev; + + ev = E_NEW(E_Event_Client_Focus_Skip_Set, 1); + if (!ev) return; + + ev->ec = ec; + ev->by_client = by_client; + e_object_ref(E_OBJECT(ec)); + + ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_SET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL); +} + +static void +_e_client_event_focus_skip_unset(E_Client *ec, Eina_Bool by_client) +{ + E_Event_Client_Focus_Skip_Unset *ev; + + ev = E_NEW(E_Event_Client_Focus_Skip_Unset, 1); + if (!ev) return; + + ev->ec = ec; + ev->by_client = by_client; + e_object_ref(E_OBJECT(ec)); + + ecore_event_add(E_EVENT_CLIENT_FOCUS_SKIP_UNSET, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL); +} + +E_API void +e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client) +{ + if (!ec) return; + + if (skip) + { + if (ec->icccm.accepts_focus) + { + ELOGF("TZPOL", "FOCUS|SKIP SET (by_client:%d)", ec, by_client); + ec->icccm.accepts_focus = ec->icccm.take_focus = 0; + ec->changes.accepts_focus = 1; + EC_CHANGED(ec); + + _e_client_event_focus_skip_set(ec, by_client); + } + } + else + { + if (!ec->icccm.accepts_focus) + { + ELOGF("TZPOL", "FOCUS|SKIP UNSET (by_client:%d)", ec, by_client); + ec->icccm.accepts_focus = ec->icccm.take_focus = 1; + ec->changes.accepts_focus = 1; + EC_CHANGED(ec); + + _e_client_event_focus_skip_unset(ec, by_client); + } + } +} + EINTERN void e_client_revert_focus(E_Client *ec) { @@ -3904,6 +3967,8 @@ e_client_init(void) #endif E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new(); E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new(); + E_EVENT_CLIENT_FOCUS_SKIP_SET = ecore_event_type_new();; + E_EVENT_CLIENT_FOCUS_SKIP_UNSET = ecore_event_type_new();; return (!!clients_hash[1]); } diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 24d9c675ae..51a7adb0bd 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -202,6 +202,8 @@ typedef struct E_Client E_Client; typedef struct E_Event_Client E_Event_Client; typedef struct _E_Event_Client_Property E_Event_Client_Property; +typedef struct _E_Event_Client_Focus_Skip E_Event_Client_Focus_Skip_Set; +typedef struct _E_Event_Client_Focus_Skip E_Event_Client_Focus_Skip_Unset; typedef struct _E_Client_Pending_Resize E_Client_Pending_Resize; typedef struct _E_Client_Pending_Geometry E_Client_Pending_Geometry; typedef struct E_Event_Client_Zone_Set E_Event_Client_Zone_Set; @@ -290,6 +292,12 @@ struct _E_Event_Client_Property unsigned int property; }; +struct _E_Event_Client_Focus_Skip +{ + E_Client *ec; + Eina_Bool by_client; +}; + struct _E_Client_Hook { EINA_INLIST; @@ -1024,6 +1032,8 @@ E_API extern int E_EVENT_CLIENT_ROTATION_CHANGE_END; #endif E_API extern int E_EVENT_CLIENT_VISIBILITY_CHANGE; E_API extern int E_EVENT_CLIENT_BUFFER_CHANGE; +E_API extern int E_EVENT_CLIENT_FOCUS_SKIP_SET; +E_API extern int E_EVENT_CLIENT_FOCUS_SKIP_UNSET; EINTERN void e_client_idler_before(void); EINTERN Eina_Bool e_client_init(void); @@ -1166,6 +1176,7 @@ E_API E_Capture_Save_State e_client_image_save(E_Client *ec, const char *dir, co E_API void e_client_base_output_resolution_transform_adjust(E_Client *ec); E_API Eina_Bool e_client_base_output_resolution_update(E_Client *ec); +E_API void e_client_focus_skip_set(E_Client *ec, Eina_Bool skip, Eina_Bool by_client); EINTERN void e_client_revert_focus(E_Client *ec); EINTERN Eina_Bool e_client_check_above_focused(E_Client *ec); diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 1b412247a2..20dd64da1a 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -1768,13 +1768,7 @@ _tzpol_iface_cb_focus_skip_set(struct wl_client *client EINA_UNUSED, struct wl_r ec = wl_resource_get_user_data(surf); EINA_SAFETY_ON_NULL_RETURN(ec); - if (ec->icccm.accepts_focus) - { - ELOGF("TZPOL", "FOCUS|SKIP SET", ec); - ec->icccm.accepts_focus = ec->icccm.take_focus = 0; - ec->changes.accepts_focus = 1; - EC_CHANGED(ec); - } + e_client_focus_skip_set(ec, EINA_TRUE, EINA_TRUE); } static void @@ -1785,13 +1779,7 @@ _tzpol_iface_cb_focus_skip_unset(struct wl_client *client EINA_UNUSED, struct wl ec = wl_resource_get_user_data(surf); EINA_SAFETY_ON_NULL_RETURN(ec); - if (!ec->icccm.accepts_focus) - { - ELOGF("TZPOL", "FOCUS|SKIP UNSET", ec); - ec->icccm.accepts_focus = ec->icccm.take_focus = 1; - ec->changes.accepts_focus = 1; - EC_CHANGED(ec); - } + e_client_focus_skip_set(ec, EINA_FALSE, EINA_TRUE); } // --------------------------------------------------------