]> git.tdb.fi Git - geometrycompositor.git/blobdiff - source/main.c
Monitor changes to the root window pixmap
[geometrycompositor.git] / source / main.c
index 2d5dd9186e8f890175b5acae7006390bd3e71dfd..a1d0f1cf43537d0ab1162981415c5344f214b0a3 100644 (file)
@@ -506,6 +506,7 @@ CompositedWindow *add_window(Compositor *compositor, CompositedScreen *screen, W
 
        window->texture = create_2d_texture();
        window->mask_texture = create_2d_texture();
+       window->use_mask = 0;
        window->recreate_mask = (window->map_state==IsViewable);
 
        XShapeSelectInput(compositor->display, window->window, ShapeNotifyMask);
@@ -815,16 +816,19 @@ void update_root_pixmap(Compositor *compositor, CompositedScreen *screen)
        unsigned long length;
        long *pixmap;
 
+       use_gl(compositor, screen);
+
+       if(screen->root_glx_pixmap)
+       {
+               glXDestroyPixmap(compositor->display, screen->root_glx_pixmap);
+               screen->root_glx_pixmap = 0;
+       }
+
        XGetWindowProperty(compositor->display, screen->root, compositor->root_pmap_atom, 0, 1, False, XA_PIXMAP,
                &prop_type, &prop_format, &length, &overflow, (unsigned char **)&pixmap);
        if(prop_type!=XA_PIXMAP || prop_format!=32)
        {
                screen->root_pixmap = 0;
-               if(screen->root_glx_pixmap)
-               {
-                       glXDestroyPixmap(compositor->display, screen->root_glx_pixmap);
-                       screen->root_glx_pixmap = 0;
-               }
                return;
        }
 
@@ -879,6 +883,9 @@ int initialize_screen(Compositor *compositor, unsigned number)
                        return 0;
        XRRFreeScreenResources(xrr_res);
 
+       screen->root_pixmap = 0;
+       screen->root_glx_pixmap = 0;
+
        update_geometry_correction(compositor, screen);
        update_root_pixmap(compositor, screen);
 
@@ -1145,14 +1152,14 @@ void process_property_event(Compositor *compositor, XPropertyEvent *event)
 {
        CompositedScreen *screen;
 
-       if(event->atom!=compositor->correction_atom)
-               return;
-
        screen = find_screen_by_root(compositor, event->window);
        if(!screen)
                return;
 
-       update_geometry_correction(compositor, screen);
+       if(event->atom==compositor->correction_atom)
+               update_geometry_correction(compositor, screen);
+       else if(event->atom==compositor->root_pmap_atom)
+               update_root_pixmap(compositor, screen);
 }
 
 void process_damage_event(Compositor *compositor, XDamageNotifyEvent *event)