Bug #2703: Fixed a memory leak in the fading code.
[dana/xcompmgr.git] / xcompmgr.c
index 9f90595..816123b 100644 (file)
@@ -1599,7 +1599,7 @@ finish_destroy_win (Display *dpy, Window id, Bool gone)
     for (prev = &list; (w = *prev); prev = &w->next)
        if (w->id == id)
        {
-           if (!gone)
+           if (gone)
                finish_unmap_win (dpy, w);
            *prev = w->next;
            if (w->picture)
@@ -1861,15 +1861,21 @@ usage (char *program)
 }
 
 static void
-give_me_a_name (void)
+register_cm (void)
 {
     Window w;
+    Atom a;
 
     w = XCreateSimpleWindow (dpy, RootWindow (dpy, 0), 0, 0, 1, 1, 0, None,
                             None);
 
     Xutf8SetWMProperties (dpy, w, "xcompmgr", "xcompmgr", NULL, 0, NULL, NULL,
                          NULL);
+
+    /* FIXME: Don't hard code the screen number */
+    a = XInternAtom (dpy, "_NET_WM_CM_S0", False);
+
+    XSetSelectionOwner (dpy, a, w, 0);
 }
 
 int
@@ -1999,7 +2005,7 @@ main (int argc, char **argv)
        exit (1);
     }
 
-    give_me_a_name();
+    register_cm();
 
     /* get atoms */
     opacityAtom = XInternAtom (dpy, OPACITY_PROP, False);