]> Dogcows Code - chaz/tint2/blobdiff - src/tint.c
reverted my last checkin, because I forgot that XCopyArea only works if src.depth...
[chaz/tint2] / src / tint.c
index a6065465754f380e28a1dbe83c2f7c712fe9d7d8..1a5c4bbe8ba68bb8251693dfcb722aa8dddccf78 100644 (file)
@@ -31,6 +31,7 @@
 #include <Imlib2.h>
 #include <signal.h>
 
+#include "version.h"
 #include "server.h"
 #include "window.h"
 #include "config.h"
@@ -59,7 +60,7 @@ void init (int argc, char *argv[])
                        exit(0);
                }
                if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version"))    {
-                       printf("tint2 version 0.8\n");
+                       printf("tint2 version %s\n", VERSION_STRING);
                        exit(0);
                }
                if (!strcmp(argv[i], "-c")) {
@@ -635,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;
@@ -676,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);
@@ -699,7 +703,6 @@ int main (int argc, char *argv[])
                        panel = (Panel*)systray.area.panel;
                        if (refresh_systray && !panel->is_hidden) {
                                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
@@ -780,6 +783,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)) {
@@ -791,6 +800,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.026899 seconds and 4 git commands to generate.