remove flickering on systray git-svn-id: http://tint2.googlecode.com/svn/trunk@120 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
lorthiois@bbsoft.fr lorthiois@bbsoft.fr@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
4 files changed,
31 insertions(+),
12 deletions(-)
M
src/systray/systraybar.c
→
src/systray/systraybar.c
@@ -42,6 +42,7 @@ Window net_sel_win = None, hint_win = None;
// freedesktop specification doesn't allow multi systray Systraybar systray; +int refresh_systray; void init_systray()@@ -56,7 +57,9 @@ return;
systray.area.parent = panel; systray.area.panel = panel; + systray.area._draw_foreground = draw_systray; systray.area._resize = resize_systray; + refresh_systray = 0; // configure systray // draw only one systray (even with multi panel)@@ -90,6 +93,13 @@
free_area(&systray.area); cleanup_net(); +} + + +void draw_systray(void *obj, cairo_t *c, int active) +{ + // tint2 don't draw systray icons. just the background. + refresh_systray = 1; }@@ -310,7 +320,7 @@ }
} -void refresh_systray() +void refresh_systray_icon() { TrayWindow *traywin; GSList *l;
M
src/systray/systraybar.h
→
src/systray/systraybar.h
@@ -33,6 +33,7 @@
extern Window net_sel_win; extern Systraybar systray; +extern int refresh_systray; void init_systray();@@ -44,9 +45,11 @@ void net_message(XClientMessageEvent *e);
void remove_icon(TrayWindow *traywin); +void draw_systray(void *obj, cairo_t *c, int active); + void resize_systray(void *obj); -void refresh_systray(); +void refresh_systray_icon(); #endif
M
src/tint.c
→
src/tint.c
@@ -650,26 +650,29 @@
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 == systray.area.panel) - XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None); - 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 (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(); - } + 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(); } - XFlush (server.dsp); } } }