[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] taskbar 0.1.3



Morten Nilsen wrote:
> Morten Nilsen wrote:
>> http://home.4th-age.com/taskbar-0.1.3.tar.bz2
>>
>> fixes:
>> - Reworded config
>> - Made initial preparations for i18n
>> - Now remembers config
>> - config should now work per taskbar client, but I haven't tested it
> 
> This patch fixes the callbacks working on all the instances rather than
> the first found.

some improvements over the last (applies against the tar), also removes
two _taskbar_icon_remove() calls that should never have been there..

-- 
Morten
:wq
diff -ur taskbar-0.1.3/configure.in taskbar-0.1.5/configure.in
--- taskbar-0.1.3/configure.in	2006-06-16 01:30:05.000000000 +0200
+++ taskbar-0.1.5/configure.in	2006-06-16 03:25:08.908631474 +0200
@@ -7,7 +7,7 @@
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
-AM_INIT_AUTOMAKE(taskbar, 0.1.3)
+AM_INIT_AUTOMAKE(taskbar, 0.1.5)
 AM_CONFIG_HEADER(config.h)
 AC_ISC_POSIX
 AC_PROG_CC
diff -ur taskbar-0.1.3/e_mod_main.c taskbar-0.1.5/e_mod_main.c
--- taskbar-0.1.3/e_mod_main.c	2006-06-16 01:22:45.000000000 +0200
+++ taskbar-0.1.5/e_mod_main.c	2006-06-16 03:43:42.840388789 +0200
@@ -87,13 +87,14 @@
 static Taskbar_Icon *_taskbar_icon_find(Taskbar *b, E_Border *bd);
 static Taskbar_Icon *_taskbar_icon_at_coord(Taskbar *b, Evas_Coord x, Evas_Coord y);
 static Taskbar_Icon *_taskbar_icon_new(Taskbar *b, E_Border *bd);
+static int  _taskbar_icon_add2(Taskbar *b, E_Border *ic);
 static void _taskbar_icon_add(Taskbar *b, Taskbar_Icon *ic);
+static int  _taskbar_icon_remove2(Taskbar *b, E_Border *bd);
 static void _taskbar_icon_remove(Taskbar *b, Taskbar_Icon *ic);
 static void _taskbar_icon_free(Taskbar_Icon *ic);
 static void _taskbar_icon_fill(Taskbar_Icon *ic);
 static void _taskbar_icon_empty(Taskbar_Icon *ic);
 static void _taskbar_icon_signal_emit(Taskbar_Icon *ic, char *sig, char *src);
-static Taskbar *_taskbar_zone_find(E_Zone *zone);
 static int _taskbar_cb_timer_drop_recalc(void *data);
 static void _taskbar_cb_obj_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _taskbar_inst_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -252,7 +253,6 @@
    e_box_orientation_set(b->o_box, 1);
    e_box_align_set(b->o_box, 0.5, 0.5);
    b->zone = zone;
-   //_taskbar_fill(b);
    return b;
 }
 
@@ -548,21 +548,6 @@
    if (ic->o_icon2)   edje_object_signal_emit(ic->o_icon2,   sig, src);
 }
 
-static Taskbar *
-_taskbar_zone_find(E_Zone *zone)
-{
-   Evas_List *l;
-   
-   for (l = taskbar_config->instances; l; l = l->next)
-     {
-	Instance *inst;
-
-	inst = l->data;
-	if (inst->taskbar->zone == zone) return inst->taskbar;
-     }
-   return NULL;
-}
-
 static int
 _taskbar_cb_timer_drop_recalc(void *data)
 {
@@ -1028,6 +1013,28 @@
    _gc_orient(inst->gcc);
 }
 
+static int
+_taskbar_icon_add2(Taskbar *b, E_Border *bd)
+{
+   Taskbar_Icon *ic;
+
+   if (bd->user_skip_winlist) return 1;
+   if (bd->client.netwm.state.skip_taskbar) return 1;
+   if (_taskbar_icon_find(b, bd)) return 0;
+   if (!(bd->sticky || b->show_all))
+     {
+        if (bd->zone != b->zone) return 1;
+        if ((bd->desk != e_desk_current_get(bd->zone)))
+           return 1;
+     }
+
+   ic = _taskbar_icon_new(b, bd);
+   if (!ic) return 0;
+
+   _taskbar_icon_add(b, ic);
+   return 0;
+}
+
 static void
 _taskbar_icon_add(Taskbar *b, Taskbar_Icon *ic)
 {
@@ -1038,6 +1045,17 @@
    _gc_orient(b->inst->gcc);
 }
 
+static int
+_taskbar_icon_remove2(Taskbar *b, E_Border *bd)
+{
+   Taskbar_Icon *ic;
+   ic = _taskbar_icon_find(b, bd);
+   if (!ic) return 0;
+
+   _taskbar_icon_remove(b, ic);
+   return 0;
+}
+
 static void
 _taskbar_icon_remove(Taskbar *b, Taskbar_Icon *ic)
 {
@@ -1052,22 +1070,21 @@
 _taskbar_cb_event_border_add(void *data, int type, void *event)
 {
    E_Event_Border_Add *ev;
-   Taskbar *b;
-   Taskbar_Icon *ic;
-   
+   Evas_List *l;
+
    ev = event;
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   if (_taskbar_icon_find(b, ev->border)) return 1;
+
    if (ev->border->client.netwm.state.skip_taskbar) return 1;
    if (ev->border->user_skip_winlist) return 1;
-   if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
-      !(ev->border->sticky || b->show_all)) return 1;
 
-   ic = _taskbar_icon_new(b, ev->border);
-   if (!ic) return 1;
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	_taskbar_icon_add2(inst->taskbar, ev->border);
+     }
 
-   _taskbar_icon_add(b, ic);
    return 1;
 }
 
@@ -1075,16 +1092,21 @@
 _taskbar_cb_event_border_remove(void *data, int type, void *event)
 {
    E_Event_Border_Remove *ev;
-   Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* find icon and remove if there */
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_remove(b, ic);
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	ic = _taskbar_icon_find(inst->taskbar, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_remove(inst->taskbar, ic);
+     }
+
    return 1;
 }
 
@@ -1094,14 +1116,21 @@
    E_Event_Border_Iconify *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* do some sort of anim when iconifying */ 
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_signal_emit(ic, "iconify", "");
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_signal_emit(ic, "iconify", "");
+     }
+
    return 1;
 }
 
@@ -1111,14 +1140,21 @@
    E_Event_Border_Uniconify *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
    /* do some sort of anim when uniconifying */ 
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
-   if (!ic) return 1;
-   _taskbar_icon_signal_emit(ic, "uniconify", "");
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
+
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if (!ic) continue;
+	_taskbar_icon_signal_emit(ic, "uniconify", "");
+     }
+
    return 1;
 }
 
@@ -1128,31 +1164,36 @@
    E_Event_Border_Icon_Change *ev;
    Taskbar *b;
    Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
-   /* update icon */
-   b = _taskbar_zone_find(ev->border->zone);
-   if (!b) return 1;
-   ic = _taskbar_icon_find(b, ev->border);
+   /* do some sort of anim when uniconifying */ 
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+        Instance *inst;
 
-   if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
-      !(ev->border->sticky || b->show_all)) return 1;
+        inst = l->data;
+	b = inst->taskbar;
+	ic = _taskbar_icon_find(b, ev->border);
+	if ((ev->border->desk != e_desk_current_get(ev->border->zone)) &&
+	   !(ev->border->sticky || b->show_all)) continue;
+
+	if (ev->border->client.netwm.state.skip_taskbar || 
+	    ev->border->user_skip_winlist)
+	  {
+	     if (ic) _taskbar_icon_remove(b, ic);
+	     continue;
+	  }
+	else if(!ic)
+	  {
+	     ic = _taskbar_icon_new(b, ev->border);
+	     _taskbar_icon_add(b, ic);
+	     continue;
+	  }
 
-   if (ev->border->client.netwm.state.skip_taskbar || 
-       ev->border->user_skip_winlist)
-     {
-	if (ic) _taskbar_icon_remove(b, ic);
-	return 1;
+	_taskbar_icon_empty(ic);
+	_taskbar_icon_fill(ic);
      }
-   else if(!ic)
-     {
-	ic = _taskbar_icon_new(b, ev->border);
-	_taskbar_icon_add(b, ic);
-	return 1;
-     }
-
-   _taskbar_icon_empty(ic);
-   _taskbar_icon_fill(ic);
 
    return 1;
 }
@@ -1161,41 +1202,18 @@
 _taskbar_cb_event_border_zone_set(void *data, int type, void *event)
 {
    E_Event_Border_Zone_Set *ev;
-   Taskbar_Icon *ic;
+   Evas_List *l;
    
    ev = event;
-
-   Evas_List *l;
    
    for (l = taskbar_config->instances; l; l = l->next)
      {
 	Instance *inst;
 
 	inst = l->data;
-	if (inst->taskbar->zone == ev->border->zone)
-	   {
-	     if ((ev->border->desk == e_desk_current_get(ev->border->zone)) ||
-                 (ev->border->sticky) ||
-                 (inst->taskbar->show_all))
-		{
-		   ic = _taskbar_icon_find(inst->taskbar, ev->border);
-		   if (!ic)
-		     {
-			if (ev->border->user_skip_winlist) continue;
-	        	if (ev->border->client.netwm.state.skip_taskbar) continue;	 
-	        	ic = _taskbar_icon_new(inst->taskbar, ev->border);
-			_taskbar_icon_add(inst->taskbar, ic);
-		     }
-		}
-	   }
-	else
-	   {
-	     ic = _taskbar_icon_find(inst->taskbar, ev->border);
-	     if ((ic) && !(ev->border->sticky || inst->taskbar->show_all))
-		{
-		   _taskbar_icon_remove(inst->taskbar, ic);
-		} 
-	   }
+	if(_taskbar_icon_add2(inst->taskbar, ev->border) &&
+	  !(ev->border->sticky || inst->taskbar->show_all))
+	   _taskbar_icon_remove2(inst->taskbar, ev->border);
      }
    return 1;
 }
@@ -1204,32 +1222,23 @@
 _taskbar_cb_event_border_desk_set(void *data, int type, void *event)
 {
    E_Event_Border_Desk_Set *ev;
-   Taskbar *b;
-   Taskbar_Icon *ic;
    E_Border *bd;
+   Evas_List *l;
+
    ev = event;
    bd = ev->border;
    if (!bd) return 1;
    if (bd->user_skip_winlist) return 1;
    if (bd->client.netwm.state.skip_taskbar) return 1;
-   /* do some sort of anim when uniconifying */ 
-   b = _taskbar_zone_find(bd->zone);
-   if (!b) return 1;
 
-   if ((ev->border->desk == e_desk_current_get(ev->border->zone) && (b->zone == ev->border->zone)) ||
-       (bd->sticky) ||
-       (b->show_all))
-     {
-	ic = _taskbar_icon_find(b, bd);
-	if (ic) return 1;
-	ic = _taskbar_icon_new(b, ev->border);
-	_taskbar_icon_add(b, ic);
-     }
-   else
+   /* do some sort of anim when uniconifying */ 
+   for (l = taskbar_config->instances; l; l = l->next)
      {
-	ic = _taskbar_icon_find(b, bd);
-	if (!ic) return 1;
-	_taskbar_icon_remove(b, ic);
+        Instance *inst;
+
+        inst = l->data;
+	if (_taskbar_icon_add2(inst->taskbar, bd))
+	   _taskbar_icon_remove2(inst->taskbar, bd);
      }
    return 1;
 }
@@ -1285,19 +1294,24 @@
 static int
 _taskbar_cb_event_desk_show(void *data, int type, void *event)
 {
+   Evas_List *l;
    E_Event_Desk_Show *e;
    Taskbar *b;
 
-
    e = event;
-   b = _taskbar_zone_find(e->desk->zone);
-   if (!b) return 1;
-   if (b->show_all) return 1;
-   _taskbar_empty(b);
-   _taskbar_empty_handle(b);
-   _taskbar_fill(b);
-   _taskbar_resize_handle(b);
-   _gc_orient(b->inst->gcc);
+   for (l = taskbar_config->instances; l; l = l->next)
+     {
+	Instance *inst;
+
+	inst = l->data;
+	if (inst->taskbar->zone == e->desk->zone && !(inst->taskbar->show_all))
+	   {
+	     _taskbar_empty(inst->taskbar);
+	     _taskbar_fill(inst->taskbar);
+	     _taskbar_resize_handle(inst->taskbar);
+	     _gc_orient(inst->gcc);
+	   }
+     }
    return 1;
 }