]> Dogcows Code - chaz/tint2/commitdiff
detect start/stop composite manager. and answer to question.
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 17 Jan 2010 13:43:44 +0000 (13:43 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Sun, 17 Jan 2010 13:43:44 +0000 (13:43 +0000)
src/server.c
src/server.h
src/tint.c

index 2d7de6e20ec19bc6d799d479fa862fcef4a568a7..18000f21234da4cd4df381cda56930d0ab7cb594 100644 (file)
@@ -92,6 +92,10 @@ void server_init_atoms ()
        server.atom.XdndAware = XInternAtom(server.dsp, "XdndAware", False);
        server.atom.XdndPosition = XInternAtom(server.dsp, "XdndPosition", False);
        server.atom.XdndStatus = XInternAtom(server.dsp, "XdndStatus", False);
+
+       server.colormap = 0;
+       server.monitor = 0;
+       server.gc = 0;
 }
 
 
@@ -328,18 +332,23 @@ void server_init_visual()
        XFree (xvi);
 
        // check composite manager
-       if (XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0) == None)
-               real_transparency = 0;
-       else
-               real_transparency = 1;
+       server.composite_manager = XGetSelectionOwner(server.dsp, server.atom._NET_WM_CM_S0);
+       if (server.colormap)
+               XFreeColormap(server.dsp, server.colormap);
 
-       if (visual && real_transparency) {
+       if (visual && server.composite_manager != None) {
+               XSetWindowAttributes attrs;
+               attrs.event_mask = StructureNotifyMask;
+               XChangeWindowAttributes (server.dsp, server.composite_manager, CWEventMask, &attrs);
+
+               real_transparency = 1;
                server.depth = 32;
                printf("real transparency on... depth: %d\n", server.depth);
                server.colormap = XCreateColormap(server.dsp, server.root_win, visual, AllocNone);
                server.visual = visual;
        }
        else {
+               real_transparency = 0;
                server.depth = DefaultDepth(server.dsp, server.screen);
                printf("real transparency off.... depth: %d\n", server.depth);
                server.colormap = DefaultColormap(server.dsp, server.screen);
index 11ea89bd7f026c6e0ec6547b93d393256a506bc7..3da2f04ef1ea424ae678000f6f7216ef25c29e1d 100644 (file)
@@ -84,6 +84,7 @@ typedef struct
 {
        Display *dsp;
        Window root_win;
+       Window composite_manager;
        // current desktop
        int desktop;
        int screen;
index c95c3171a2e823063a2db8c674029dc7aa722283..3a7b82b8415f8590d29723dd0899a7589dac8327 100644 (file)
@@ -636,6 +636,7 @@ void dnd_message(XClientMessageEvent *e)
 int main (int argc, char *argv[])
 {
        XEvent e;
+       XClientMessageEvent *ev;
        fd_set fdset;
        int x11_fd, i;
        Panel *panel;
@@ -677,6 +678,8 @@ int main (int argc, char *argv[])
                        panel_refresh = 0;
 
                        // QUESTION: do we need this first refresh_systray, because we check refresh_systray once again later...
+                       // ANSWER: yes, panel->temp_pmap is freeded in the loop.
+                       // we change background to None to avoid tray icon using freeded pixmap.
                        if (refresh_systray) {
                                panel = (Panel*)systray.area.panel;
                                XSetWindowBackgroundPixmap (server.dsp, panel->main_win, None);
@@ -781,6 +784,12 @@ int main (int argc, char *argv[])
                                                break;
                                        case UnmapNotify:
                                        case DestroyNotify:
+                                               if (e.xany.window == server.composite_manager) {
+                                                       printf("Stop composite.\n");
+                                                       //signal_pending = SIGUSR2;
+                                                       server_init_visual();
+                                                       break;
+                                               }
                                                if (e.xany.window == g_tooltip.window || !systray.area.on_screen)
                                                        break;
                                                for (it = systray.list_icons; it; it = g_slist_next(it)) {
@@ -792,6 +801,15 @@ int main (int argc, char *argv[])
                                        break;
 
                                        case ClientMessage:
+                                               ev = &e;
+                                               if (ev->data.l[1] == server.atom._NET_WM_CM_S0) {
+                                                       if (ev->data.l[2] == None)
+                                                               printf("Stop composite 2.\n");
+                                                       else
+                                                               printf("Start composite.\n");
+                                                       server_init_visual();
+                                                       //signal_pending = SIGUSR2;
+                                               }
                                                if (!systray.area.on_screen) break;
                                                if (e.xclient.message_type == server.atom._NET_SYSTEM_TRAY_OPCODE && e.xclient.format == 32 && e.xclient.window == net_sel_win) {
                                                        net_message(&e.xclient);
This page took 0.028029 seconds and 4 git commands to generate.