]> Dogcows Code - chaz/tint2/commitdiff
remove flickering on systray
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 20 Jun 2009 15:08:33 +0000 (15:08 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sat, 20 Jun 2009 15:08:33 +0000 (15:08 +0000)
ChangeLog
src/systray/systraybar.c
src/systray/systraybar.h
src/tint.c

index 26870118473684ecf42600053f5053d4a6c231f3..17d03afdb58bba3fb8fec46f3466ac4b39582f1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2009-06-20
+- remove flickering on systray
+
 2009-06-20
 - 'urgent_nb_of_blink' allow to choose the number of blink
 
index d382d8a72eaa5c5ce61e8b350f6ef8d8f0c63d67..f0adce7258220d9687fb11afe9378eaea80b7fdf 100644 (file)
@@ -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 @@ void init_systray()
 
        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)
@@ -93,6 +96,13 @@ void cleanup_systray()
 }
 
 
+void draw_systray(void *obj, cairo_t *c, int active)
+{
+       // tint2 don't draw systray icons. just the background.
+       refresh_systray = 1;
+}
+
+
 void resize_systray(void *obj)
 {
        Systraybar *sysbar = obj;
@@ -310,7 +320,7 @@ void net_message(XClientMessageEvent *e)
 }
 
 
-void refresh_systray()
+void refresh_systray_icon()
 {
        TrayWindow *traywin;
        GSList *l;
index 4f369716e7209398d0431b17c4aac23418df6450..dbe3fbee46671e12d6ddf12ba91362e7a086b30c 100644 (file)
@@ -33,6 +33,7 @@ typedef struct
 
 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
 
index da98965dfeffc2868b5c6ef1c9175df374841614..94ec86ce6eb9c24e92346085d47f94b6aceb2527 100644 (file)
@@ -650,26 +650,29 @@ load_config:
       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);
-
-                               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();
-                               }
                        }
                        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();
+                       }
                }
    }
 }
This page took 0.029761 seconds and 4 git commands to generate.