]> Dogcows Code - chaz/tint2/blobdiff - src/systray/systraybar.c
SIGUSR1 does now a full restat of tint2
[chaz/tint2] / src / systray / systraybar.c
index 411f9121467d203bfe67535e9c8c2d7314d3ea24..cc1412294ffa75737704b680d5c817ffb125cdf5 100644 (file)
@@ -48,12 +48,36 @@ Window net_sel_win = None;
 Systraybar systray;
 int refresh_systray;
 int systray_enabled;
-int systray_max_icon_size = 0;
+int systray_max_icon_size;
 
 // background pixmap if we render ourselves the icons
-static Pixmap render_background = 0;
+static Pixmap render_background;
 
 
+void default_systray()
+{
+printf("*** default_systray()\n");
+       memset(&systray, 0, sizeof(Systraybar));
+       render_background = 0;
+       systray.alpha = 100;
+       systray.sort = 3;
+       systray.area._draw_foreground = draw_systray;
+       systray.area._resize = resize_systray;
+}
+
+void cleanup_systray()
+{
+printf("*** cleanup_systray()\n");
+       systray_enabled = 0;
+       systray_max_icon_size = 0;
+       systray.area.on_screen = 0;
+       free_area(&systray.area);
+       if (render_background) {
+               XFreePixmap(server.dsp, render_background);
+               render_background = 0;
+       }
+}
+
 void init_systray()
 {
        start_net();
@@ -66,8 +90,6 @@ void init_systray()
                systray.alpha = 100;
                systray.brightness = systray.saturation = 0;
        }
-       systray.area._draw_foreground = draw_systray;
-       systray.area._resize = resize_systray;
        systray.area.resize = 1;
        systray.area.redraw = 1;
        systray.area.on_screen = 1;
@@ -92,18 +114,9 @@ void init_systray_panel(void *p)
 }
 
 
-void cleanup_systray()
-{
-       systray_enabled = 0;
-       systray.area.on_screen = 0;
-       free_area(&systray.area);
-       if (render_background) XFreePixmap(server.dsp, render_background);
-}
-
-
 void draw_systray(void *obj, cairo_t *c)
 {
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                if (render_background) XFreePixmap(server.dsp, render_background);
                render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
                XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
@@ -442,7 +455,7 @@ gboolean add_icon(Window id)
 
        // watch for the icon trying to resize itself!
        XSelectInput(server.dsp, traywin->tray_id, StructureNotifyMask);
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles);
                XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual);
        }
@@ -545,7 +558,11 @@ void systray_render_icon_now(void* t)
                printf("Strange tray icon found with depth: %d\n", traywin->depth);
                return;
        }
-       Picture pict_image = XRenderCreatePicture(server.dsp, traywin->id, f, 0, 0);
+       Picture pict_image;
+       if (server.real_transparency)
+               pict_image = XRenderCreatePicture(server.dsp, traywin->id, f, 0, 0);
+       else
+               pict_image = XRenderCreatePicture(server.dsp, traywin->tray_id, f, 0, 0);
        Picture pict_drawable = XRenderCreatePicture(server.dsp, tmp_pmap, XRenderFindVisualFormat(server.dsp, server.visual32), 0, 0);
        XRenderComposite(server.dsp, PictOpSrc, pict_image, None, pict_drawable, 0, 0, 0, 0, 0, 0, traywin->width, traywin->height);
        XRenderFreePicture(server.dsp, pict_image);
@@ -584,7 +601,7 @@ void systray_render_icon_now(void* t)
 
 void systray_render_icon(TrayWindow* traywin)
 {
-       if (real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
+       if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
                // 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);
This page took 0.026476 seconds and 4 git commands to generate.