add e_client_focus_skip_set and focus_skip event 60/205860/2 accepted/tizen/unified/20190513.082557 submit/tizen/20190510.072056 submit/tizen/20190512.233104
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 10 May 2019 01:58:37 +0000 (10:58 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 10 May 2019 05:45:03 +0000 (14:45 +0900)
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

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_policy_wl.c

index 4c3c7050e7ffa347742cfb7fa055ab62d5ef9b6f..1678d49f836c442358aa7477ced4ff291a04651d 100644 (file)
@@ -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]);
 }
index 24d9c675ae91547f24020b231e91b8bc4bedf90b..51a7adb0bd0f7d46b46b974d883b7a7eb1dcff99 100644 (file)
@@ -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);
 
index 1b412247a2e5fd31a019234dc513f08675c8ceb6..20dd64da1a32c31ac5f76a7410d9726bdc259f01 100644 (file)
@@ -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);
 }
 
 // --------------------------------------------------------