X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmain.c;h=061d7b73e9c4a214165e4102ea0b677e62807a38;hb=326681cd9c807e5be2fc9fd8e13d3026b7ec39a8;hp=a1d0f1cf43537d0ab1162981415c5344f214b0a3;hpb=74572308adfaf62f0669df4e2369e1b31203042d;p=geometrycompositor.git diff --git a/source/main.c b/source/main.c index a1d0f1c..061d7b7 100644 --- a/source/main.c +++ b/source/main.c @@ -815,25 +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; + screen->root_glx_pixmap = None; } 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; + screen->root_pixmap = None; 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); } @@ -883,8 +892,8 @@ int initialize_screen(Compositor *compositor, unsigned number) return 0; XRRFreeScreenResources(xrr_res); - screen->root_pixmap = 0; - screen->root_glx_pixmap = 0; + screen->root_pixmap = None; + screen->root_glx_pixmap = None; update_geometry_correction(compositor, screen); update_root_pixmap(compositor, screen); @@ -959,8 +968,8 @@ int initialize_compositor(Compositor *compositor) compositor->glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glXGetProcAddress((unsigned char *)"glXReleaseTexImageEXT"); compositor->root_pmap_atom = XInternAtom(compositor->display, "_XROOTPMAP_ID", False); - compositor->correction_atom = XInternAtom(compositor->display, "GEOMETRY_CORRECTION", False); - compositor->monitors_atom = XInternAtom(compositor->display, "GEOMETRY_CORRECTION_MONITORS", False); + compositor->correction_atom = XInternAtom(compositor->display, "_MSP_GEOMETRY_CORRECTION", False); + compositor->monitors_atom = XInternAtom(compositor->display, "_MSP_GEOMETRY_CORRECTION_MONITORS", False); compositor->nscreens = ScreenCount(compositor->display); compositor->screens = (CompositedScreen *)malloc(compositor->nscreens*sizeof(CompositedScreen)); @@ -1002,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); @@ -1011,7 +1023,7 @@ void shutdown_screen(Compositor *compositor, CompositedScreen *screen) for(i=0; i<3; ++i) glDeleteShader(screen->shaders[i]); - glXMakeContextCurrent(compositor->display, 0, 0, NULL); + glXMakeContextCurrent(compositor->display, None, None, NULL); glXDestroyContext(compositor->display, screen->glx_context); glXDestroyWindow(compositor->display, screen->glx_window); XDestroyWindow(compositor->display, screen->render_window);