Add handler for zone_move_resize so we can adjust minimum width of
authorChristopher Michael <cpmichael1@comcast.net>
Sat, 27 Feb 2010 19:41:59 +0000 (19:41 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Sat, 27 Feb 2010 19:41:59 +0000 (19:41 +0000)
indicator when zone size changes.

SVN revision: 46599

src/modules/illume-indicator/e_mod_ind_win.c
src/modules/illume-indicator/e_mod_ind_win.h

index 771387e..36d1176 100644 (file)
@@ -5,6 +5,7 @@
 /* local function prototypes */
 static void _e_mod_ind_win_cb_free(Ind_Win *iwin);
 static int _e_mod_ind_win_cb_win_prop(void *data, int type __UNUSED__, void *event);
+static int _e_mod_ind_win_cb_zone_resize(void *data, int type __UNUSED__, void *event);
 static void _e_mod_ind_win_cb_resize(E_Win *win);
 static void _e_mod_ind_win_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event);
 static void _e_mod_ind_win_cb_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event);
@@ -102,9 +103,18 @@ e_mod_ind_win_new(E_Zone *zone)
    e_gadcon_populate(iwin->gadcon);
 
    /* hook into property change so we can adjust w/ e_scale */
-   iwin->scale_hdl = 
-     ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, 
-                             _e_mod_ind_win_cb_win_prop, iwin);
+   iwin->hdls = 
+     eina_list_append(iwin->hdls, 
+                      ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, 
+                                              _e_mod_ind_win_cb_win_prop, iwin));
+
+   /* hook into zone resize so we can set minimum window width when zone 
+    * size changes */
+   iwin->hdls = 
+     eina_list_append(iwin->hdls, 
+                      ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, 
+                                              _e_mod_ind_win_cb_zone_resize, 
+                                              iwin));
 
    /* set minimum size of this window */
    e_win_size_min_set(iwin->win, zone->w, (32 * e_scale));
@@ -133,9 +143,11 @@ e_mod_ind_win_new(E_Zone *zone)
 static void 
 _e_mod_ind_win_cb_free(Ind_Win *iwin) 
 {
-   /* delete the scale handler */
-   if (iwin->scale_hdl) ecore_event_handler_del(iwin->scale_hdl);
-   iwin->scale_hdl = NULL;
+   Ecore_Event_Handler *hdl;
+
+   /* delete the handlers */
+   EINA_LIST_FREE(iwin->hdls, hdl)
+     ecore_event_handler_del(hdl);
 
    /* delete the border hook */
    if (iwin->hook) e_border_hook_del(iwin->hook);
@@ -201,6 +213,22 @@ _e_mod_ind_win_cb_win_prop(void *data, int type __UNUSED__, void *event)
    return 1;
 }
 
+static int 
+_e_mod_ind_win_cb_zone_resize(void *data, int type __UNUSED__, void *event) 
+{
+   Ind_Win *iwin;
+   E_Event_Zone_Move_Resize *ev;
+
+   ev = event;
+   if (!(iwin = data)) return 1;
+   if (ev->zone != iwin->zone) return 1;
+
+   /* set minimum size of this window to match zone size */
+   e_win_size_min_set(iwin->win, ev->zone->w, (32 * e_scale));
+
+   return 1;
+}
+
 static void 
 _e_mod_ind_win_cb_resize(E_Win *win) 
 {
index 1f20365..bae41bf 100644 (file)
@@ -12,7 +12,7 @@ struct _Ind_Win
 
    E_Zone *zone;
    E_Border_Hook *hook;
-   Ecore_Event_Handler *scale_hdl;
+   Eina_List *hdls;
 
    E_Win *win;
    Evas_Object *o_base, *o_event;