]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
fixed issue 150
[chaz/tint2] / src / tint.c
index f5713dab662698b4c0c87357e4a0e9ff087e1a84..c85bd1bac8f4cbb9dbd4358098c9ab769bb90513 100644 (file)
@@ -169,7 +169,7 @@ Task *click_task (Panel *panel, int x, int y)
                        Task *tsk;
                        for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
                                tsk = l0->data;
-                               if (x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
+                               if (tsk->area.on_screen && x >= tsk->area.posx && x <= (tsk->area.posx + tsk->area.width)) {
                                        return tsk;
                                }
                        }
@@ -178,7 +178,7 @@ Task *click_task (Panel *panel, int x, int y)
                        Task *tsk;
                        for (l0 = tskbar->area.list; l0 ; l0 = l0->next) {
                                tsk = l0->data;
-                               if (y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
+                               if (tsk->area.on_screen && y >= tsk->area.posy && y <= (tsk->area.posy + tsk->area.height)) {
                                        return tsk;
                                }
                        }
@@ -268,8 +268,7 @@ void event_button_press (XEvent *e)
        Panel *panel = get_panel(e->xany.window);
        if (!panel) return;
 
-       if (panel_mode == MULTI_DESKTOP)
-               task_drag = click_task(panel, e->xbutton.x, e->xbutton.y);
+       task_drag = click_task(panel, e->xbutton.x, e->xbutton.y);
 
        if (wm_menu && !task_drag && !click_clock(panel, e->xbutton.x, e->xbutton.y) && (e->xbutton.button != 1) ) {
                // forward the click to the desktop window (thanks conky)
@@ -393,33 +392,37 @@ void event_property_notify (XEvent *e)
                }
                // Change desktop
                else if (at == server.atom._NET_CURRENT_DESKTOP) {
+                       int old_desktop = server.desktop;
                        server.desktop = server_get_current_desktop ();
                        for (i=0 ; i < nb_panel ; i++) {
                                Panel *panel = &panel1[i];
                                if (panel_mode == MULTI_DESKTOP && panel->g_taskbar.use_active) {
-                                       // redraw taskbar
+                                       // redraw both taskbar
+                                       panel->taskbar[old_desktop].area.is_active = 0;
+                                       panel->taskbar[old_desktop].area.redraw = 1;
+                                       panel->taskbar[server.desktop].area.is_active = 1;
+                                       panel->taskbar[server.desktop].area.redraw = 1;
                                        panel_refresh = 1;
-                                       Taskbar *tskbar;
-                                       Task *tsk;
-                                       GSList *l;
-                                       for (j=0 ; j < panel->nb_desktop ; j++) {
-                                               tskbar = &panel->taskbar[j];
-                                               if (tskbar->area.is_active) {
-                                                       tskbar->area.is_active = 0;
-                                                       tskbar->area.redraw = 1;
-                                                       for (l = tskbar->area.list; l ; l = l->next) {
-                                                               tsk = l->data;
-                                                               tsk->area.redraw = 1;
-                                                       }
-                                               }
-                                               if (j == server.desktop) {
-                                                       tskbar->area.is_active = 1;
-                                                       tskbar->area.redraw = 1;
-                                                       for (l = tskbar->area.list; l ; l = l->next) {
-                                                               tsk = l->data;
-                                                               tsk->area.redraw = 1;
-                                                       }
-                                               }
+                               }
+                               // check ALLDESKTOP task => resize taskbar
+                               Taskbar *tskbar;
+                               Task *tsk;
+                               GSList *l;
+                               tskbar = &panel->taskbar[old_desktop];
+                               for (l = tskbar->area.list; l ; l = l->next) {
+                                       tsk = l->data;
+                                       if (tsk->desktop == ALLDESKTOP) {
+                                               tsk->area.on_screen = 0;
+                                               tskbar->area.resize = 1;
+                                               panel_refresh = 1;
+                                       }
+                               }
+                               tskbar = &panel->taskbar[server.desktop];
+                               for (l = tskbar->area.list; l ; l = l->next) {
+                                       tsk = l->data;
+                                       if (tsk->desktop == ALLDESKTOP) {
+                                               tsk->area.on_screen = 1;
+                                               tskbar->area.resize = 1;
                                        }
                                }
                        }
@@ -556,8 +559,8 @@ void event_property_notify (XEvent *e)
                                                if (tsk->win == tsk2->win && tsk != tsk2) {
                                                        tsk2->icon_width = tsk->icon_width;
                                                        tsk2->icon_height = tsk->icon_height;
-                                                       tsk2->icon_data = tsk->icon_data;
-                                                       tsk2->icon_data_active = tsk->icon_data_active;
+                                                       tsk2->icon = tsk->icon;
+                                                       tsk2->icon_active = tsk->icon_active;
                                                        tsk2->area.redraw = 1;
                                                }
                                        }
@@ -583,7 +586,7 @@ void event_property_notify (XEvent *e)
                }
                else if (at == server.atom.WM_HINTS) {
                        XWMHints* wmhints = XGetWMHints(server.dsp, win);
-                       if (wmhints->flags & XUrgencyHint) {
+                       if (wmhints && wmhints->flags & XUrgencyHint) {
                                task_urgent = tsk;
                                tick_urgent = 0;
                                time_precision = 1;
@@ -793,6 +796,8 @@ load_config:
                                                break;
 
                                        case ConfigureNotify:
+                                               //XMoveWindow(dpy, fen, pos_x, pos_y);
+                                               //XResizeWindow(dpy, fen, largeur, hauteur);
                                                if (e.xconfigure.window == server.root_win)
                                                        goto load_config;
                                                else
This page took 0.02593 seconds and 4 git commands to generate.