all repos — tint2 @ d1e7d189bfb4497b67c83f6d0eb7cc1d0088cac5

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

*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



git-svn-id: http://tint2.googlecode.com/svn/trunk@270 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
Andreas.Fink85 Andreas.Fink85@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

d1e7d189bfb4497b67c83f6d0eb7cc1d0088cac5

parent

12a882e31c04d11c340d4eb19a94b92eaa780ce5

4 files changed, 48 insertions(+), 47 deletions(-)

jump to
M src/battery/battery.csrc/battery/battery.c

@@ -131,7 +131,7 @@ g_free(path1);

g_free(battery_dir); if (battery_enabled) - install_timer(0, 1000000, 3, 0, update_batterys); + install_timer(0, 1000000, 5, 0, update_batterys); }
M src/taskbar/task.csrc/taskbar/task.c

@@ -424,6 +424,7 @@ t->tick++;

} urgent_task = urgent_task->next; } + panel_refresh = 1; }
M src/tint.csrc/tint.c

@@ -610,15 +610,11 @@

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; }

@@ -663,11 +659,6 @@ task_active = tsk;

} panel_refresh = 1; } -} - - -void event_timer() -{ }

@@ -739,6 +730,34 @@ sigset_t empty_mask;

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);

@@ -785,6 +804,12 @@

case Expose: event_expose(&e); break; + + case MapNotify: + if (e.xany.window == g_tooltip.window) + tooltip_update(); + break; + case PropertyNotify: event_property_notify(&e);

@@ -804,7 +829,7 @@ // FIXME: 'reparent to us' badly detected => disabled

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) {

@@ -853,34 +878,6 @@ case SIGTERM:

case SIGHUP: 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(); - } } } }
M src/tooltip/tooltip.csrc/tooltip/tooltip.c

@@ -62,7 +62,7 @@ g_tooltip.hide_timer_id = install_timer(0, 0, 0, 0, tooltip_hide);

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_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 @@ tooltip_hide();

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_hide() { + stop_timeouts(); if (g_tooltip.mapped) { g_tooltip.mapped = False; XUnmapWindow(server.dsp, g_tooltip.window); + XFlush(server.dsp); } }