the pager and iconbox now emit a signal when a border changes state from urgent
authorViktor Kojouharov <vkojouharov@gmail.com>
Tue, 24 Oct 2006 14:32:22 +0000 (14:32 +0000)
committerViktor Kojouharov <vkojouharov@gmail.com>
Tue, 24 Oct 2006 14:32:22 +0000 (14:32 +0000)
to normal and the other way around.

for the themers: the iconbox icon, the pager window and the pager desk, receive
 the signals e,state,urgent and e,state,not_urgent, so you can do something nice
 with those.

SVN revision: 26772

src/bin/e_border.c
src/bin/e_border.h
src/modules/ibox/e_mod_main.c
src/modules/pager/e_mod_main.c

index 5ad5c17..52237ab 100644 (file)
@@ -67,6 +67,7 @@ static void _e_border_event_border_zone_set_free(void *data, void *ev);
 static void _e_border_event_border_desk_set_free(void *data, void *ev);
 static void _e_border_event_border_stack_free(void *data, void *ev);
 static void _e_border_event_border_icon_change_free(void *data, void *ev);
+static void _e_border_event_border_urgent_change_free(void *data, void *ev);
 static void _e_border_event_border_focus_in_free(void *data, void *ev);
 static void _e_border_event_border_focus_out_free(void *data, void *ev);
 static void _e_border_event_border_resize_free(void *data, void *ev);
@@ -130,6 +131,7 @@ EAPI int E_EVENT_BORDER_STICK = 0;
 EAPI int E_EVENT_BORDER_UNSTICK = 0;
 EAPI int E_EVENT_BORDER_STACK = 0;
 EAPI int E_EVENT_BORDER_ICON_CHANGE = 0;
+EAPI int E_EVENT_BORDER_URGENT_CHANGE = 0;
 EAPI int E_EVENT_BORDER_FOCUS_IN = 0;
 EAPI int E_EVENT_BORDER_FOCUS_OUT = 0;
 EAPI int E_EVENT_BORDER_PROPERTY = 0;
@@ -183,6 +185,7 @@ e_border_init(void)
    E_EVENT_BORDER_UNSTICK = ecore_event_type_new();
    E_EVENT_BORDER_STACK = ecore_event_type_new();
    E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new();
+   E_EVENT_BORDER_URGENT_CHANGE = ecore_event_type_new();
    E_EVENT_BORDER_FOCUS_IN = ecore_event_type_new();
    E_EVENT_BORDER_FOCUS_OUT = ecore_event_type_new();
    E_EVENT_BORDER_PROPERTY = ecore_event_type_new();
@@ -6421,9 +6424,13 @@ _e_border_eval(E_Border *bd)
          edje_object_signal_emit(bd->bg_object, "e,state,urgent", "e");
        else
          edje_object_signal_emit(bd->bg_object, "e,state,not_urgent", "e");
-       /* FIXME: we should probably do something with the pager or
-        * maybe raising the window if it becomes urgent
-        */
+       E_Event_Border_Urgent_Change *ev;
+
+       ev = calloc(1, sizeof(E_Event_Border_Urgent_Change));
+       ev->border = bd;
+       e_object_ref(E_OBJECT(bd));
+       ecore_event_add(E_EVENT_BORDER_URGENT_CHANGE, ev,
+             _e_border_event_border_urgent_change_free, NULL);
      }
    
    bd->new_client = 0;
@@ -6872,6 +6879,16 @@ _e_border_event_border_icon_change_free(void *data, void *ev)
 }
 
 static void
+_e_border_event_border_urgent_change_free(void *data, void *ev)
+{
+   E_Event_Border_Urgent_Change *e;
+
+   e = ev;
+   e_object_unref(E_OBJECT(e->border));
+   free(e);
+}
+
+static void
 _e_border_event_border_focus_in_free(void *data, void *ev)
 {
    E_Event_Border_Focus_In *e;
index 1375953..8de87c2 100644 (file)
@@ -87,6 +87,7 @@ typedef struct _E_Event_Border_Zone_Set      E_Event_Border_Zone_Set;
 typedef struct _E_Event_Border_Desk_Set      E_Event_Border_Desk_Set;
 typedef struct _E_Event_Border_Stack         E_Event_Border_Stack;
 typedef struct _E_Event_Border_Icon_Change   E_Event_Border_Icon_Change;
+typedef struct _E_Event_Border_Urgent_Change E_Event_Border_Urgent_Change;
 typedef struct _E_Event_Border_Focus_In             E_Event_Border_Focus_In;
 typedef struct _E_Event_Border_Focus_Out     E_Event_Border_Focus_Out;
 typedef struct _E_Event_Border_Property      E_Event_Border_Property;
@@ -545,6 +546,11 @@ struct _E_Event_Border_Focus_Out
    E_Border *border;
 };
 
+struct _E_Event_Border_Urgent_Change
+{
+   E_Border *border;
+};
+
 struct _E_Event_Border_Property
 {
    E_Border *border;
@@ -642,6 +648,7 @@ extern EAPI int E_EVENT_BORDER_ZONE_SET;
 extern EAPI int E_EVENT_BORDER_DESK_SET;
 extern EAPI int E_EVENT_BORDER_STACK;
 extern EAPI int E_EVENT_BORDER_ICON_CHANGE;
+extern EAPI int E_EVENT_BORDER_URGENT_CHANGE;
 extern EAPI int E_EVENT_BORDER_FOCUS_IN;
 extern EAPI int E_EVENT_BORDER_FOCUS_OUT;
 extern EAPI int E_EVENT_BORDER_PROPERTY;
index 7d73e78..ec64011 100644 (file)
@@ -113,6 +113,7 @@ static int _ibox_cb_event_border_remove(void *data, int type, void *event);
 static int _ibox_cb_event_border_iconify(void *data, int type, void *event);
 static int _ibox_cb_event_border_uniconify(void *data, int type, void *event);
 static int _ibox_cb_event_border_icon_change(void *data, int type, void *event);
+static int _ibox_cb_event_border_urgent_change(void *data, int type, void *event);
 static int _ibox_cb_event_border_zone_set(void *data, int type, void *event);
 static int _ibox_cb_event_desk_show(void *data, int type, void *event);
 static Config_Item *_ibox_config_item_get(const char *id);
@@ -1146,6 +1147,31 @@ _ibox_cb_event_border_icon_change(void *data, int type, void *event)
 }
 
 static int
+_ibox_cb_event_border_urgent_change(void *data, int type, void *event)
+{
+   E_Event_Border_Urgent_Change *ev;
+   IBox *b;
+   IBox_Icon *ic;
+   Evas_List *l, *ibox;
+   
+   ev = event;
+   /* update icon */
+   ibox = _ibox_zone_find(ev->border->zone);
+   for (l = ibox; l; l = l->next)
+     {
+       b = l->data; 
+       ic = _ibox_icon_find(b, ev->border); 
+       if (!ic) continue; 
+       if (ev->border->client.icccm.urgent)
+         edje_object_signal_emit(ic->o_holder2, "e,state,urgent", "e");
+       else
+         edje_object_signal_emit(ic->o_holder2, "e,state,not_urgent", "e");
+     }
+
+   return 1;
+}
+
+static int
 _ibox_cb_event_border_zone_set(void *data, int type, void *event)
 {
    E_Event_Border_Zone_Set *ev;
@@ -1320,6 +1346,10 @@ e_modapi_init(E_Module *m)
       (E_EVENT_BORDER_ICON_CHANGE, _ibox_cb_event_border_icon_change, NULL));
    ibox_config->handlers = evas_list_append
      (ibox_config->handlers, ecore_event_handler_add
+      (E_EVENT_BORDER_URGENT_CHANGE, 
+       _ibox_cb_event_border_urgent_change, NULL));
+   ibox_config->handlers = evas_list_append
+     (ibox_config->handlers, ecore_event_handler_add
       (E_EVENT_BORDER_ZONE_SET, _ibox_cb_event_border_zone_set, NULL));
    ibox_config->handlers = evas_list_append
      (ibox_config->handlers, ecore_event_handler_add
index 03e2f38..0c8936b 100644 (file)
@@ -109,6 +109,7 @@ static int _pager_cb_event_border_unstick(void *data, int type, void *event);
 static int _pager_cb_event_border_desk_set(void *data, int type, void *event);
 static int _pager_cb_event_border_stack(void *data, int type, void *event);
 static int _pager_cb_event_border_icon_change(void *data, int type, void *event);
+static int _pager_cb_event_border_urgent_change(void *data, int type, void *event);
 static int _pager_cb_event_zone_desk_count_set(void *data, int type, void *event);
 static int _pager_cb_event_desk_show(void *data, int type, void *event);
 static int _pager_cb_event_desk_name_change(void *data, int type, void *event);
@@ -1144,6 +1145,48 @@ _pager_cb_event_border_icon_change(void *data, int type, void *event)
 }
 
 static int
+_pager_cb_event_border_urgent_change(void *data, int type, void *event)
+{
+   E_Event_Border_Urgent_Change  *ev;
+   Evas_List                   *l, *l2;
+
+   ev = event;
+   for (l = pager_config->instances; l; l = l->next)
+     {
+       Instance *inst;
+
+       inst = l->data;
+        if (inst->pager->zone != ev->border->zone) continue;
+       for (l2 = inst->pager->desks; l2; l2 = l2->next)
+         {
+            Pager_Desk *pd;
+            Pager_Win *pw;
+
+            pd = l2->data;
+            pw = _pager_desk_window_find(pd, ev->border);
+            if (pw)
+              {
+                 if (ev->border->client.icccm.urgent)
+                   {
+                      edje_object_signal_emit(pd->o_desk, 
+                            "e,state,urgent", "e");
+                      edje_object_signal_emit(pw->o_window, 
+                            "e,state,urgent", "e");
+                   }
+                 else
+                   {
+                      edje_object_signal_emit(pd->o_desk, 
+                            "e,state,not_urgent", "e");
+                      edje_object_signal_emit(pw->o_window, 
+                            "e,state,not_urgent", "e");
+                   }
+              }
+         }
+     }
+   return 1;
+}
+
+static int
 _pager_cb_event_zone_desk_count_set(void *data, int type, void *event)
 {
    Evas_List *l;
@@ -1716,6 +1759,10 @@ e_modapi_init(E_Module *m)
       (E_EVENT_BORDER_ICON_CHANGE, _pager_cb_event_border_icon_change, NULL));
    pager_config->handlers = evas_list_append
      (pager_config->handlers, ecore_event_handler_add
+      (E_EVENT_BORDER_URGENT_CHANGE, 
+       _pager_cb_event_border_urgent_change, NULL));
+   pager_config->handlers = evas_list_append
+     (pager_config->handlers, ecore_event_handler_add
       (E_EVENT_ZONE_DESK_COUNT_SET, _pager_cb_event_zone_desk_count_set, NULL));
    pager_config->handlers = evas_list_append
      (pager_config->handlers, ecore_event_handler_add