]> Dogcows Code - chaz/tint2/commitdiff
*fix* use XFlush to really make use of the tooltip timeouts and do not rely on some...
authorAndreas Fink <andreas.fink85@googlemail.com>
Mon, 16 Nov 2009 10:06:45 +0000 (10:06 +0000)
committerAndreas Fink <andreas.fink85@googlemail.com>
Mon, 16 Nov 2009 10:06:45 +0000 (10:06 +0000)
*fix* moved panel_refresh in the mainloop to the top for panels without a clock for updating first and then going to the pselect statement
*changed* battery updates every 5 secs (I do not know if this is a good value...)
*fix* blinking urgent windows has a panel_refresh now

src/battery/battery.c
src/taskbar/task.c
src/tint.c
src/tooltip/tooltip.c

index f0498b728e689e8aaa7b74295aacc6887a9598e9..5c1f6cc8ee814b3f67d84a6eb0fe44bb2b4f15d2 100644 (file)
@@ -131,7 +131,7 @@ void init_battery()
        g_free(battery_dir);
 
        if (battery_enabled)
-               install_timer(0, 1000000, 3, 0, update_batterys);
+               install_timer(0, 1000000, 5, 0, update_batterys);
 }
 
 
index 94229a2766430c3672aa7a146f36a344bd08caab..4e85c9450e8e47ef99c6e2d996db4994955c2013 100644 (file)
@@ -424,6 +424,7 @@ void blink_urgent()
                }
                urgent_task = urgent_task->next;
        }
+       panel_refresh = 1;
 }
 
 
index 44b6d9e8952702855230b7c4d92f418191b4435a..9b10732694603585bca70406aa9a00d63ca25787 100644 (file)
@@ -610,15 +610,11 @@ void event_property_notify (XEvent *e)
 
 void event_expose (XEvent *e)
 {
-       if (e->xany.window == g_tooltip.window)
-               tooltip_update();
-       else {
-               Panel *panel;
-               panel = get_panel(e->xany.window);
-               if (!panel) return;
-               // TODO : one panel_refresh per panel ?
-               panel_refresh = 1;
-       }
+       Panel *panel;
+       panel = get_panel(e->xany.window);
+       if (!panel) return;
+       // TODO : one panel_refresh per panel ?
+       panel_refresh = 1;
 }
 
 
@@ -666,11 +662,6 @@ void event_configure_notify (Window win)
 }
 
 
-void event_timer()
-{
-}
-
-
 void dnd_message(XClientMessageEvent *e)
 {
        Panel *panel = get_panel(e->window);
@@ -739,6 +730,34 @@ int main (int argc, char *argv[])
        sigemptyset(&empty_mask);
 
        while (1) {
+               if (panel_refresh) {
+                       panel_refresh = 0;
+
+                       if (refresh_systray) {
+                               panel = (Panel*)systray.area.panel;
+                               XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
+                       }
+                       for (i=0 ; i < nb_panel ; i++) {
+                               panel = &panel1[i];
+
+                               if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
+                               panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
+
+                               refresh(&panel->area);
+                               XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
+                       }
+                       XFlush (server.dsp);
+
+                       if (refresh_systray) {
+                               refresh_systray = 0;
+                               panel = (Panel*)systray.area.panel;
+                               // tint2 doen't draw systray icons. it just redraw background.
+                               XSetWindowBackgroundPixmap (server.dsp, panel->main_win, panel->temp_pmap);
+                               // force icon's refresh
+                               refresh_systray_icon();
+                       }
+               }
+
                // thanks to AngryLlama for the timer
                // Create a File Description Set containing x11_fd, and every timer_fd
                FD_ZERO (&fdset);
@@ -786,6 +805,12 @@ int main (int argc, char *argv[])
                                                event_expose(&e);
                                                break;
 
+                                       case MapNotify:
+                                               if (e.xany.window == g_tooltip.window)
+                                                       tooltip_update();
+                                               break;
+
+
                                        case PropertyNotify:
                                                event_property_notify(&e);
                                                break;
@@ -804,7 +829,7 @@ int main (int argc, char *argv[])
                                                break;
                                        case UnmapNotify:
                                        case DestroyNotify:
-                                               if (!systray.area.on_screen)
+                                               if (e.xany.window == g_tooltip.window || !systray.area.on_screen)
                                                        break;
                                                for (it = systray.list_icons; it; it = g_slist_next(it)) {
                                                        if (((TrayWindow*)it->data)->id == e.xany.window) {
@@ -854,34 +879,6 @@ int main (int argc, char *argv[])
                        cleanup ();
                        return 0;
                }
-
-               if (panel_refresh) {
-                       panel_refresh = 0;
-
-                       if (refresh_systray) {
-                               panel = (Panel*)systray.area.panel;
-                               XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
-                       }
-                       for (i=0 ; i < nb_panel ; i++) {
-                               panel = &panel1[i];
-
-                               if (panel->temp_pmap) XFreePixmap(server.dsp, panel->temp_pmap);
-                               panel->temp_pmap = XCreatePixmap(server.dsp, server.root_win, panel->area.width, panel->area.height, server.depth);
-
-                               refresh(&panel->area);
-                               XCopyArea(server.dsp, panel->temp_pmap, panel->main_win, server.gc, 0, 0, panel->area.width, panel->area.height, 0, 0);
-                       }
-                       XFlush (server.dsp);
-
-                       if (refresh_systray) {
-                               refresh_systray = 0;
-                               panel = (Panel*)systray.area.panel;
-                               // tint2 doen't draw systray icons. it just redraw background.
-                               XSetWindowBackgroundPixmap (server.dsp, panel->main_win, panel->temp_pmap);
-                               // force icon's refresh
-                               refresh_systray_icon();
-                       }
-               }
        }
 }
 
index 07af226aa4e1aea6f4035ee9be199a80a6957fb6..e2f8a1d02f626f75367e3b44057c81bae7868c22 100644 (file)
@@ -62,7 +62,7 @@ void init_tooltip()
 
        XSetWindowAttributes attr;
        attr.override_redirect = True;
-       attr.event_mask = ExposureMask;
+       attr.event_mask = StructureNotifyMask;
        if (g_tooltip.window) XDestroyWindow(server.dsp, g_tooltip.window);
        g_tooltip.window = XCreateWindow(server.dsp, server.root_win, 0, 0, 100, 20, 0, server.depth, InputOutput, CopyFromParent, CWOverrideRedirect|CWEventMask, &attr);
 }
@@ -106,10 +106,11 @@ void tooltip_trigger_show(Task* task, int x_root, int y_root)
 
 void tooltip_show()
 {
+       stop_timeouts();
        if (!g_tooltip.mapped) {
                g_tooltip.mapped = True;
                XMapWindow(server.dsp, g_tooltip.window);
-               //tooltip_update();
+               XFlush(server.dsp);
        }
 }
 
@@ -198,7 +199,7 @@ void tooltip_update()
                return;
        }
 
-       //printf("tooltip_update\n");
+//     printf("tooltip_update\n");
        tooltip_update_geometry();
        tooltip_adjust_geometry();
        XMoveResizeWindow(server.dsp, g_tooltip.window, x, y, width, height);
@@ -254,9 +255,11 @@ void tooltip_trigger_hide(Tooltip* tooltip)
 
 void tooltip_hide()
 {
+       stop_timeouts();
        if (g_tooltip.mapped) {
                g_tooltip.mapped = False;
                XUnmapWindow(server.dsp, g_tooltip.window);
+               XFlush(server.dsp);
        }
 }
 
This page took 0.031774 seconds and 4 git commands to generate.