]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
*fix* use copied data for task icons on 64bit
[chaz/tint2] / src / tint.c
index c85bd1bac8f4cbb9dbd4358098c9ab769bb90513..a64f92f0d1a39245d29ec8e2125fd11937d2e5c2 100644 (file)
@@ -142,16 +142,14 @@ Taskbar *click_taskbar (Panel *panel, int x, int y)
        if (panel_horizontal) {
                for (i=0; i < panel->nb_desktop ; i++) {
                        tskbar = &panel->taskbar[i];
-                       if (!tskbar->area.on_screen) continue;
-                       if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
+                       if (tskbar->area.on_screen && x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
                                return tskbar;
                }
        }
        else {
                for (i=0; i < panel->nb_desktop ; i++) {
                        tskbar = &panel->taskbar[i];
-                       if (!tskbar->area.on_screen) continue;
-                       if (y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
+                       if (tskbar->area.on_screen && y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
                                return tskbar;
                }
        }
@@ -293,13 +291,6 @@ void event_button_release (XEvent *e)
        Panel *panel = get_panel(e->xany.window);
        if (!panel) return;
 
-       if (wm_menu && click_padding(panel, e->xbutton.x, e->xbutton.y)) {
-                       // forward the click to the desktop window (thanks conky)
-                       e->xbutton.window = server.root_win;
-                       XSendEvent(server.dsp, e->xbutton.window, False, ButtonReleaseMask, e);
-                       return;
-       }
-
        int action = TOGGLE_ICONIFY;
        switch (e->xbutton.button) {
                case 2:
@@ -526,27 +517,30 @@ void event_property_notify (XEvent *e)
                                panel_refresh = 1;
                        }
                }
-               else if (at == server.atom.WM_STATE) {
-                       // Iconic state
-                       // TODO : try to delete following code
-                       if (window_is_iconified (win)) {
-                               if (task_active) {
-                                       if (task_active->win == tsk->win) {
-                                               Task *tsk2;
-                                               GSList *l0;
-                                               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) {
-                                                                       tsk2 = l0->data;
-                                                                       tsk2->area.is_active = 0;
-                                                               }
-                                                       }
-                                               }
-                                               task_active = 0;
-                                       }
-                               }
-                       }
-               }
+// We do not check for the iconified state, since it only unsets our active window
+// but in openbox a shaded window is considered iconified. So we would loose the active window
+// property on unshading it again (commented 01.10.2009)
+//             else if (at == server.atom.WM_STATE) {
+//                     // Iconic state
+//                     // TODO : try to delete following code
+//                     if (window_is_iconified (win)) {
+//                             if (task_active) {
+//                                     if (task_active->win == tsk->win) {
+//                                             Task *tsk2;
+//                                             GSList *l0;
+//                                             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) {
+//                                                                     tsk2 = l0->data;
+//                                                                     tsk2->area.is_active = 0;
+//                                                             }
+//                                                     }
+//                                             }
+//                                             task_active = 0;
+//                                     }
+//                             }
+//                     }
+//             }
                // Window icon changed
                else if (at == server.atom._NET_WM_ICON) {
                        get_icon(tsk);
@@ -615,7 +609,31 @@ void event_expose (XEvent *e)
 
 void event_configure_notify (Window win)
 {
-       // check 'win' move in systray
+       // change in root window (xrandr)
+       if (win == server.root_win) {
+               int i, old_monitor = server.nb_monitor;
+
+               get_monitors();
+               if (old_monitor != server.nb_monitor) {
+               }
+               for (i=0 ; i < nb_panel ; i++) {
+                       Panel *panel = &panel1[i];
+
+                       init_panel_size_and_position(panel);
+                       XMoveResizeWindow(server.dsp, panel->main_win, panel->posx, panel->posy, panel->area.width, panel->area.height);
+                       set_panel_background(panel);
+
+                       // force the resize of childs
+                       GSList *l0;
+                       panel->area.resize = 1;
+                       for (l0 = panel->area.list; l0 ; l0 = l0->next)
+                               ((Area*)l0->data)->resize = 1;
+               }
+               panel_refresh = 1;
+               return;
+       }
+
+       // 'win' is a trayer icon
        TrayWindow *traywin;
        GSList *l;
        for (l = systray.list_icons; l ; l = l->next) {
@@ -628,9 +646,8 @@ void event_configure_notify (Window win)
                }
        }
 
-       // check 'win' move in another monitor
+       // 'win' move in another monitor
        if (nb_panel == 1) return;
-       if (server.nb_monitor == 1) return;
        Task *tsk = task_get_task (win);
        if (!tsk) return;
 
@@ -796,12 +813,7 @@ 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
-                                                       event_configure_notify (e.xconfigure.window);
+                                               event_configure_notify (e.xconfigure.window);
                                                break;
 
                                        case ReparentNotify:
This page took 0.025241 seconds and 4 git commands to generate.