]> Dogcows Code - chaz/tint2/blobdiff - src/taskbar/task.c
moved initial values in function default_xxx
[chaz/tint2] / src / taskbar / task.c
index 26f8bea759020be1383522c55ac81fa17811b24b..d0b247f3cd67df00eed39c72e62d7aa933940e54 100644 (file)
@@ -35,8 +35,8 @@
 #include "tooltip.h"
 #include "timer.h"
 
-static timeout* urgent_timeout = 0;
-static GSList* urgent_list = 0;
+timeout* urgent_timeout;
+GSList* urgent_list;
 
 const char* task_get_tooltip(void* obj)
 {
@@ -67,8 +67,10 @@ Task *add_task (Window win)
        // even with task_on_all_desktop and with task_on_all_panel
        new_tsk.title = 0;
        int k;
-       for (k=0; k<TASK_STATE_COUNT; ++k)
+       for (k=0; k<TASK_STATE_COUNT; ++k) {
                new_tsk.icon[k] = 0;
+               new_tsk.state_pix[k] = 0;
+       }
        get_title(&new_tsk);
        get_icon(&new_tsk);
 
@@ -323,7 +325,7 @@ void draw_task_icon (Task *tsk, int text_width)
 
        // Render
        imlib_context_set_image (tsk->icon[tsk->current_state]);
-       if (real_transparency) {
+       if (server.real_transparency) {
                render_image(tsk->area.pix, pos_x, panel->g_task.icon_posy, imlib_image_get_width(), imlib_image_get_height() );
        }
        else {
@@ -443,7 +445,7 @@ void active_task()
        if (w1) {
                Window w2;
                if (XGetTransientForHint(server.dsp, w1, &w2) != 0)
-                       if (w2) w1 = w2;
+                       if (w2 && !task_get_tasks(w1)) w1 = w2;
                set_task_state((task_active = task_get_task(w1)), TASK_ACTIVE);
        }
 }
@@ -456,18 +458,20 @@ void set_task_state(Task *tsk, int state)
 
        if (tsk->current_state != state) {
                GPtrArray* task_group = task_get_tasks(tsk->win);
-               int i;
-               for (i=0; i<task_group->len; ++i) {
-                       Task* tsk1 = g_ptr_array_index(task_group, i);
-                       tsk1->current_state = state;
-                       tsk1->area.bg = panel1[0].g_task.background[state];
-                       tsk1->area.pix = tsk1->state_pix[state];
-                       if (tsk1->state_pix[state] == 0)
-                               tsk1->area.redraw = 1;
-                       if (state == TASK_ACTIVE && g_slist_find(urgent_list, tsk1))
-                               del_urgent(tsk1);
+               if (task_group) {
+                       int i;
+                       for (i=0; i<task_group->len; ++i) {
+                               Task* tsk1 = g_ptr_array_index(task_group, i);
+                               tsk1->current_state = state;
+                               tsk1->area.bg = panel1[0].g_task.background[state];
+                               tsk1->area.pix = tsk1->state_pix[state];
+                               if (tsk1->state_pix[state] == 0)
+                                       tsk1->area.redraw = 1;
+                               if (state == TASK_ACTIVE && g_slist_find(urgent_list, tsk1))
+                                       del_urgent(tsk1);
+                       }
+                       panel_refresh = 1;
                }
-               panel_refresh = 1;
        }
 }
 
This page took 0.027994 seconds and 4 git commands to generate.