]> Dogcows Code - chaz/tint2/blobdiff - src/systray/systraybar.c
*fix* clear tooltip window before redrawing
[chaz/tint2] / src / systray / systraybar.c
index 661b2c6a5ed035bca9d0a3153193113880deff19..02ed1b4ed20440b212fe422550be4399a363b210 100644 (file)
@@ -214,6 +214,8 @@ void start_net()
        // Vertical panel will draw the systray horizontal.
        int orient = 0;
        XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1);
+       VisualID vid = XVisualIDFromVisual(server.visual);
+       XChangeProperty(server.dsp, net_sel_win, XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_VISUAL", False), XA_VISUALID, 32, PropModeReplace, (unsigned char*)&vid, 1);
 
        XSetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN, net_sel_win, CurrentTime);
        if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != net_sel_win) {
@@ -299,6 +301,15 @@ gboolean add_icon(Window id)
 
        error = FALSE;
        old = XSetErrorHandler(window_error_handler);
+       XWindowAttributes attr;
+       XGetWindowAttributes(server.dsp, id, &attr);
+       if ( attr.depth != server.depth ) {
+               XSetWindowAttributes a;
+               a.background_pixmap = None;  // set to none, otherwise XReparentWindow fails...
+               a.background_pixel = 0;      // set background pixel to 0. Looks ugly, but at least the icon appears
+               // TODO: maybe the XShape extension can be used, to clip the icon
+               XChangeWindowAttributes(server.dsp, id, CWBackPixmap|CWBackPixel, &a);
+       }
        XReparentWindow(server.dsp, id, panel->main_win, 0, 0);
        XSync(server.dsp, False);
        XSetErrorHandler(old);
@@ -379,7 +390,6 @@ void remove_icon(TrayWindow *traywin)
 
        // remove from our list
        systray.list_icons = g_slist_remove(systray.list_icons, traywin);
-       g_free(traywin);
        systray.area.resize = 1;
        systray.area.redraw = 1;
        //printf("remove_icon id %lx, %d\n", traywin->id);
@@ -394,6 +404,7 @@ void remove_icon(TrayWindow *traywin)
        XReparentWindow(server.dsp, traywin->id, server.root_win, 0, 0);
        XSync(server.dsp, False);
        XSetErrorHandler(old);
+       g_free(traywin);
 
        // changed in systray force resize on panel
        Panel *panel = systray.area.panel;
This page took 0.020951 seconds and 4 git commands to generate.