]> Dogcows Code - chaz/tint2/commitdiff
fixed : lost of active task on SIGUSR1
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 23 Oct 2009 21:28:44 +0000 (21:28 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Fri, 23 Oct 2009 21:28:44 +0000 (21:28 +0000)
src/panel.c
src/taskbar/task.c
src/taskbar/task.h
src/tint.c

index bdf8813e68bdff8f0bb0a918b89c5744b00d86c2..c6c706ef5d8186fd0441646dc24406e0e19a8016 100644 (file)
@@ -168,6 +168,7 @@ void init_panel()
        init_taskbar();
        visible_object();
        task_refresh_tasklist();
+       active_task();
 }
 
 
index 6309f2734a9f02329e4f2809cc611d8788f2c6fb..c180f85c62115b0941564be834a34888d8eb2738 100644 (file)
@@ -364,3 +364,48 @@ void draw_task (void *obj, cairo_t *c, int active)
 }
 
 
+void active_task()
+{
+       GSList *l0;
+       int i, j;
+       Task *tsk1, *tsk2;
+
+       if (task_active) {
+               for (i=0 ; i < nb_panel ; i++) {
+                       for (j=0 ; j < panel1[i].nb_desktop ; j++) {
+                               for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
+                                       tsk1 = l0->data;
+                                       tsk1->area.is_active = 0;
+                               }
+                       }
+               }
+               task_active = 0;
+       }
+
+       Window w1 = window_get_active ();
+       tsk2 = task_get_task(w1);
+       if (!tsk2) {
+               Window w2;
+               if (XGetTransientForHint(server.dsp, w1, &w2) != 0)
+                       if (w2) tsk2 = task_get_task(w2);
+       }
+       if (task_urgent == tsk2) {
+               init_precision();
+               task_urgent = 0;
+       }
+       // put active state on all task (multi_desktop)
+       if (tsk2) {
+               for (i=0 ; i < nb_panel ; i++) {
+                       for (j=0 ; j < panel1[i].nb_desktop ; j++) {
+                               for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
+                                       tsk1 = l0->data;
+                                       if (tsk1->win == tsk2->win) {
+                                               tsk1->area.is_active = 1;
+                                       }
+                               }
+                       }
+               }
+               task_active = tsk2;
+       }
+}
+
index 981509e35aac23d25707ed5903856599cb16992a..b29e57624995d145284a9a5e7306792582f8a5cf 100644 (file)
@@ -62,7 +62,7 @@ void draw_task (void *obj, cairo_t *c, int active);
 
 void get_icon (Task *tsk);
 void get_title(Task *tsk);
-
+void active_task();
 
 #endif
 
index 3eebf88dfe2cb5bf3f670b8949abfcd7dc8479ea..ed1865cd364522edbff57776e60c54ae8701fa88 100644 (file)
@@ -457,44 +457,7 @@ void event_property_notify (XEvent *e)
                }
                // Change active
                else if (at == server.atom._NET_ACTIVE_WINDOW) {
-                       GSList *l0;
-                       if (task_active) {
-                               for (i=0 ; i < nb_panel ; i++) {
-                                       for (j=0 ; j < panel1[i].nb_desktop ; j++) {
-                                               for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
-                                                       tsk = l0->data;
-                                                       tsk->area.is_active = 0;
-                                               }
-                                       }
-                               }
-                               task_active = 0;
-                       }
-                       Window w1 = window_get_active ();
-                       Task *t = task_get_task(w1);
-                       if (!t) {
-                               Window w2;
-                               if (XGetTransientForHint(server.dsp, w1, &w2) != 0)
-                                       if (w2) t = task_get_task(w2);
-                       }
-                       if (task_urgent == t) {
-                               init_precision();
-                               task_urgent = 0;
-                       }
-                       // put active state on all task (multi_desktop)
-                       if (t) {
-                               for (i=0 ; i < nb_panel ; i++) {
-                                       for (j=0 ; j < panel1[i].nb_desktop ; j++) {
-                                               for (l0 = panel1[i].taskbar[j].area.list; l0 ; l0 = l0->next) {
-                                                       tsk = l0->data;
-                                                       if (tsk->win == t->win) {
-                                                               tsk->area.is_active = 1;
-                                                               //printf("active monitor %d, task %s\n", panel1[i].monitor, tsk->title);
-                                                       }
-                                               }
-                                       }
-                               }
-                               task_active = t;
-                       }
+                       active_task();
                        panel_refresh = 1;
                }
                else if (at == server.atom._XROOTPMAP_ID) {
This page took 0.028038 seconds and 4 git commands to generate.