X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmain.c;h=23c061b86fc3a5557dfba3b2266499f29b36ef1c;hb=6f6754fda1a75575ac37ee685f24d585369d9fde;hp=2d5dd9186e8f890175b5acae7006390bd3e71dfd;hpb=e4d258345d33560b0e8fd176526d81f4d9b11cb7;p=geometrycompositor.git diff --git a/source/main.c b/source/main.c index 2d5dd91..23c061b 100644 --- a/source/main.c +++ b/source/main.c @@ -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); @@ -814,22 +815,34 @@ void update_root_pixmap(Compositor *compositor, CompositedScreen *screen) unsigned long overflow; unsigned long length; long *pixmap; + Window root; + int x, y; + unsigned width; + unsigned height; + unsigned border; + unsigned depth; + + 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; } screen->root_pixmap = pixmap[0]; - screen->root_glx_pixmap = pixmap_to_glx_pixmap(compositor, screen, screen->root_pixmap); + if(XGetGeometry(compositor->display, screen->root_pixmap, &root, &x, &y, &width, &height, &border, &depth)) + screen->root_glx_pixmap = pixmap_to_glx_pixmap(compositor, screen, screen->root_pixmap); + else + screen->root_pixmap = None; XFree(pixmap); } @@ -879,6 +892,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); @@ -995,6 +1011,9 @@ void shutdown_screen(Compositor *compositor, CompositedScreen *screen) } } + glDeleteTextures(1, &screen->root_texture); + glXDestroyPixmap(compositor->display, screen->root_glx_pixmap); + glDeleteBuffers(1, &screen->window_vertex_buffer); glDeleteVertexArrays(1, &screen->window_vertex_array); glDeleteFramebuffers(1, &screen->framebuffer); @@ -1145,14 +1164,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)