add e_client_focus_skip_set and focus_skip event 87/205987/1 accepted/tizen/5.0/unified/20190514.103507 submit/tizen_5.0/20190513.084449
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 13 May 2019 04:11:25 +0000 (13:11 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 13 May 2019 04:11:29 +0000 (13:11 +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: Ia7a93c7b6b1f132927e32765e997b6fb91033e15

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

index 795437ef4c1ff19af715f1dc2021d0c328231bf1..7774a1f10f074f33cd0e120a04287c36b5f62f6d 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
 
@@ -884,6 +886,67 @@ _e_client_revert_focus(E_Client *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->pixmap, 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->pixmap, 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)
 {
@@ -3832,6 +3895,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 19612275ec6d9203cc5ad59d77d9031282130496..5397a364e0bc2740a0637355819499143b73a2b0 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;
@@ -1017,6 +1025,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);
@@ -1151,6 +1161,7 @@ E_API void e_client_visibility_force_obscured_set(E_Client *ec, Eina_Bool set);
 
 E_API void e_client_stay_within_canvas_margin(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 1fefa1e823a6cf7f1558c3b78d1797e1cf3d3db7..fcee2b1a2e9d372d699b4c2b87633ec5e438b598 100644 (file)
@@ -1641,13 +1641,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->pixmap, 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
@@ -1658,13 +1652,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->pixmap, 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);
 }
 
 // --------------------------------------------------------