e_policy: add callback for E_EVENT_ZONE_USEFUL_GEOMETRY_CHANGE 09/292209/2 accepted/tizen/unified/20230528.171009
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 28 Apr 2023 08:11:14 +0000 (17:11 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Tue, 2 May 2023 02:57:24 +0000 (02:57 +0000)
We add a E_EVENT_ZONE_USEFUL_GEOMETRY_CHANGE event callback function.
If the useful geometry of E_Zone is changed, then we re-calculate the
geometry of a maximize state windows.

Change-Id: I1d2fcb026f630c082fb47643c8ba36575159c6ac

src/bin/e_policy.c

index e2a3d30..8b05256 100644 (file)
@@ -81,6 +81,7 @@ static Eina_Bool   _e_policy_cb_zone_del(void *data EINA_UNUSED, int type EINA_U
 static Eina_Bool   _e_policy_cb_zone_move_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
 static Eina_Bool   _e_policy_cb_zone_desk_count_set(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
 static Eina_Bool   _e_policy_cb_zone_display_state_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
+static Eina_Bool   _e_policy_cb_zone_useful_geometry_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
 static Eina_Bool   _e_policy_cb_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
 static Eina_Bool   _e_policy_cb_client_add(void *data EINA_UNUSED, int type, void *event);
 static Eina_Bool   _e_policy_cb_client_move(void *data EINA_UNUSED, int type, void *event);
@@ -1194,6 +1195,27 @@ _e_policy_cb_zone_display_state_change(void *data EINA_UNUSED, int type EINA_UNU
 }
 
 static Eina_Bool
+_e_policy_cb_zone_useful_geometry_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+   E_Event_Zone_Useful_Geometry_Change *ev;
+   E_Client *ec;
+
+   ev = event;
+   if (!ev) return ECORE_CALLBACK_PASS_ON;
+
+   E_CLIENT_FOREACH(ec)
+     {
+        if (ev->zone != ec->zone)
+          continue;
+
+        if (ec->maximized)
+          e_client_maximize_update(ec);
+     }
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
 _e_policy_cb_desk_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
    E_Event_Desk_Show *ev;
@@ -2404,6 +2426,7 @@ e_policy_init(void)
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_MOVE_RESIZE,          _e_policy_cb_zone_move_resize,                NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DESK_COUNT_SET,       _e_policy_cb_zone_desk_count_set,             NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_DISPLAY_STATE_CHANGE, _e_policy_cb_zone_display_state_change,       NULL);
+   E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_USEFUL_GEOMETRY_CHANGE, _e_policy_cb_zone_useful_geometry_change,   NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_SHOW,                 _e_policy_cb_desk_show,                       NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD,                _e_policy_cb_client_add,                      NULL);
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_MOVE,               _e_policy_cb_client_move,                     NULL);