e_desk: add a handler to update e_desk's geometry when the zone's geometry is changed 86/168486/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Mon, 29 Jan 2018 04:36:31 +0000 (13:36 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Mon, 29 Jan 2018 04:36:35 +0000 (13:36 +0900)
The e_desk's geometry should be changed to its zone's geometry when the zone's geometry is changed.
(This code operates only if the e_config's use_desk_smart_object value is not set.)

Change-Id: I8ddfb2ff9973eea394c0ffcaeb72fe70b6bc297c

src/bin/e_desk.c
src/bin/e_desk.h

index d5983dfc7a031de040f41efb6ec6c1c8e4d9b45e..c82f51e3321b959bb410653f58aff95d7bf0a1af 100644 (file)
@@ -37,6 +37,7 @@ static void      _e_desk_event_desk_name_change_free(void *data, void *ev);
 static void      _e_desk_show_begin(E_Desk *desk, int dx, int dy);
 static void      _e_desk_hide_begin(E_Desk *desk, int dx, int dy);
 static void      _e_desk_event_desk_window_profile_change_free(void *data, void *ev);
+static Eina_Bool _e_desk_cb_zone_move_resize(void *data, int type EINA_UNUSED, void *event);
 
 static void      _e_desk_smart_init(E_Desk *desk);
 static void      _e_desk_smart_add(Evas_Object *obj);
@@ -107,6 +108,7 @@ e_desk_new(E_Zone *zone, int x, int y)
          * members of the smart object so far.
          */
         EINA_RECTANGLE_SET(&desk->geom, zone->x, zone->y, zone->w, zone->h);
+        E_LIST_HANDLER_APPEND(desk->handlers, E_EVENT_ZONE_MOVE_RESIZE, _e_desk_cb_zone_move_resize, desk);
      }
    else
      {
@@ -1013,6 +1015,7 @@ _e_desk_free(E_Desk *desk)
    E_FREE_FUNC(desk->smart_obj, evas_object_del);
    eina_stringshare_del(desk->name);
    desk->name = NULL;
+   E_FREE_LIST(desk->handlers, ecore_event_handler_del);
    free(desk);
 }
 
@@ -1072,6 +1075,26 @@ _e_desk_event_desk_window_profile_change_free(void *data EINA_UNUSED, void *even
    E_FREE(ev);
 }
 
+static Eina_Bool
+_e_desk_cb_zone_move_resize(void *data, int type EINA_UNUSED, void *event)
+{
+   E_Event_Zone_Move_Resize *ev;
+   E_Desk *desk;
+
+   ev = event;
+   if (!ev) return ECORE_CALLBACK_PASS_ON;
+
+   desk = data;
+   if (!desk) return ECORE_CALLBACK_PASS_ON;
+
+   if (ev->zone != desk->zone)
+     return ECORE_CALLBACK_PASS_ON;
+
+   EINA_RECTANGLE_SET(&desk->geom, ev->zone->x, ev->zone->y, ev->zone->w, ev->zone->h);
+
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 static Eina_Bool
 _e_desk_transition_setup(E_Client *ec, int dx, int dy, int state)
 {
index b54d29ad034fa71919c7203e213c804f6938990b..8ff5a7cc544f58f379ccc12d465e3e16edabe430 100644 (file)
@@ -42,6 +42,7 @@ struct _E_Desk
    Eina_Rectangle       geom;
 
    unsigned int animate_count;
+   Eina_List           *handlers;
 };
 
 struct _E_Event_Desk_Show