]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
*add* multiple tasks can be urgent now
[chaz/tint2] / src / tint.c
index ece6dbc5f4655996caf1e3a169ae2a8f90e33c76..192fa36d01f139a8c03db3441f3cc58852b91bbb 100644 (file)
@@ -480,14 +480,19 @@ void event_property_notify (XEvent *e)
        else {
                tsk = task_get_task (win);
                if (!tsk) {
-                       // some stupid wm send _NET_WM_STATE after the window was minimized to tray???
                        if (at != server.atom._NET_WM_STATE)
                                return;
-                       else if (!window_is_skip_taskbar(win)) {
-                               if (tsk = add_task(win))
-                                       panel_refresh = 1;
-                               else
-                                       return;
+                       else {
+                               // xfce4 sends _NET_WM_STATE after minimized to tray, so we need to check if window is mapped
+                               // if it is mapped and not set as skip_taskbar, we must add it to our task list
+                               XWindowAttributes wa;
+                               XGetWindowAttributes(server.dsp, win, &wa);
+                               if (wa.map_state == IsViewable && !window_is_skip_taskbar(win)) {
+                                       if ( (tsk = add_task(win)) )
+                                               panel_refresh = 1;
+                                       else
+                                               return;
+                               }
                        }
                }
                //printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);
@@ -514,9 +519,7 @@ void event_property_notify (XEvent *e)
                // Demand attention
                else if (at == server.atom._NET_WM_STATE) {
                        if (window_is_urgent (win)) {
-                               task_urgent = tsk;
-                               tick_urgent = 0;
-                               time_precision = 1;
+                               add_urgent(tsk);
                        }
                        if (window_is_skip_taskbar(win)) {
                                remove_task( tsk );
@@ -587,9 +590,7 @@ void event_property_notify (XEvent *e)
                else if (at == server.atom.WM_HINTS) {
                        XWMHints* wmhints = XGetWMHints(server.dsp, win);
                        if (wmhints && wmhints->flags & XUrgencyHint) {
-                               task_urgent = tsk;
-                               tick_urgent = 0;
-                               time_precision = 1;
+                               add_urgent(tsk);
                        }
                        XFree(wmhints);
                }
@@ -669,12 +670,15 @@ void event_timer()
        time_clock.tv_sec -= time_clock.tv_sec % time_precision;
 
        // urgent task
-       if (task_urgent) {
-               if (tick_urgent < max_tick_urgent) {
-                       task_urgent->area.is_active = !task_urgent->area.is_active;
-                       task_urgent->area.redraw = 1;
-                       tick_urgent++;
+       GSList* urgent_task = urgent_list;
+       while (urgent_task) {
+               Task_urgent* t = urgent_task->data;
+               if ( t->tick < max_tick_urgent) {
+                       t->tsk->area.is_active = !t->tsk->area.is_active;
+                       t->tsk->area.redraw = 1;
+                       t->tick++;
                }
+               urgent_task = urgent_task->next;
        }
 
        // update battery
This page took 0.021627 seconds and 4 git commands to generate.