]> Dogcows Code - chaz/tint2/commitdiff
*add* render finitely often systray icons (at most every 50 ms)
authorAndreas Fink <andreas.fink85@googlemail.com>
Wed, 6 Jan 2010 19:47:12 +0000 (19:47 +0000)
committerAndreas Fink <andreas.fink85@googlemail.com>
Wed, 6 Jan 2010 19:47:12 +0000 (19:47 +0000)
src/systray/systraybar.c
src/systray/systraybar.h
src/tint.c

index a210ba891af666fa7430fd93047bd34d923add5e..454245af3456192777349a34e3c2a7dbb2d9ee2e 100644 (file)
@@ -498,9 +498,10 @@ void net_message(XClientMessageEvent *e)
        }
 }
 
-
-void systray_render_icon(TrayWindow* traywin)
+void systray_render_icon_now(TrayWindow* traywin)
 {
+       traywin->render_timeout = 0;
+
        // good systray icons support 32 bit depth, but some icons are still 24 bit.
        // We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
        // mask out all pixel with the same rgb value
@@ -529,6 +530,15 @@ void systray_render_icon(TrayWindow* traywin)
        }
        XCopyArea(server.dsp, systray.area.pix.pmap, panel->main_win, server.gc, traywin->x-systray.area.posx, traywin->y-systray.area.posy, traywin->width, traywin->height, traywin->x, traywin->y);
        imlib_free_image_and_decache();
+
+       XFlush(server.dsp);
+}
+
+void systray_render_icon(TrayWindow* traywin)
+{
+       // wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
+       if (traywin->render_timeout == 0)
+               traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin);
 }
 
 
@@ -544,4 +554,7 @@ void refresh_systray_icon()
                else
                        XClearArea(server.dsp, traywin->id, 0, 0, traywin->width, traywin->height, True);
        }
+//
+//     if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)
+//             XFlush(server.dsp);
 }
index 2875eb19c419ff1632979fe2edda69b7beeb09c9..a3ee001d9885bb40e8252c07b03ce42dbe13d09f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "common.h"
 #include "area.h"
+#include "timer.h"
 #include <X11/extensions/Xdamage.h>
 
 // XEMBED messages
@@ -40,6 +41,7 @@ typedef struct
        int hide;
        int depth;
        Damage damage;
+       const struct timeout* render_timeout;
 } TrayWindow;
 
 
index d9e02334173f2d0ed4d006a94e6bf78eb824ba98..0d7865726eb8ace74668d69d17df3928eb14a8be 100644 (file)
@@ -855,7 +855,7 @@ int main (int argc, char *argv[])
                                                        XDamageNotifyEvent* de = (XDamageNotifyEvent*)&e;
                                                        for (l = systray.list_icons; l ; l = l->next) {
                                                                traywin = (TrayWindow*)l->data;
-                                                               if ( traywin->id == de->drawable ) {
+                                                               if ( traywin->id == de->drawable && !de->more ) {
                                                                        systray_render_icon(traywin);
                                                                        break;
                                                                }
This page took 0.025224 seconds and 4 git commands to generate.