From: Andreas Fink Date: Mon, 16 Nov 2009 10:06:45 +0000 (+0000) Subject: *fix* use XFlush to really make use of the tooltip timeouts and do not rely on some... X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7eebd3da48eb6a48eb9b15a71c131b1b442638f6;p=chaz%2Ftint2 *fix* use XFlush to really make use of the tooltip timeouts and do not rely on some timer running in the background *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 --- diff --git a/src/battery/battery.c b/src/battery/battery.c index f0498b7..5c1f6cc 100644 --- a/src/battery/battery.c +++ b/src/battery/battery.c @@ -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); } diff --git a/src/taskbar/task.c b/src/taskbar/task.c index 94229a2..4e85c94 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -424,6 +424,7 @@ void blink_urgent() } urgent_task = urgent_task->next; } + panel_refresh = 1; } diff --git a/src/tint.c b/src/tint.c index 44b6d9e..9b10732 100644 --- a/src/tint.c +++ b/src/tint.c @@ -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(); - } - } } } diff --git a/src/tooltip/tooltip.c b/src/tooltip/tooltip.c index 07af226..e2f8a1d 100644 --- a/src/tooltip/tooltip.c +++ b/src/tooltip/tooltip.c @@ -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); } }