]> git.tdb.fi Git - geometrycompositor.git/commitdiff
Use the shape extension to let input events through the overlay window
authorMikko Rasa <tdb@tdb.fi>
Fri, 11 Dec 2015 15:32:47 +0000 (17:32 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 11 Dec 2015 15:32:47 +0000 (17:32 +0200)
Makefile
source/main.c

index 63e1992fa29f4648daf64d3d1b8c49bf3f1b2107..adb93d99f7cd70867f7f3d0cc338c2380df82181 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
 geometrycompositor: source/main.c
-       gcc -o $@ $< -Wall -Wextra -Werror -ggdb -lX11 -lXcomposite -lXdamage -lGL
+       gcc -o $@ $< -Wall -Wextra -Werror -ggdb -lX11 -lXcomposite -lXdamage -lXext -lGL
index 21189b6b2c30cacae8a87801632ee3ba4a982725..35328543cbbb4cfc80329c8a531870ab6690aaa0 100644 (file)
@@ -5,6 +5,7 @@
 #include <X11/Xlib.h>
 #include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/Xdamage.h>
+#include <X11/extensions/shape.h>
 #include <GL/gl.h>
 #include <GL/glx.h>
 
@@ -328,6 +329,7 @@ int initialize_screen(Compositor *compositor, unsigned number)
        XSelectInput(compositor->display, screen->root, SubstructureNotifyMask);
        screen->overlay = XCompositeGetOverlayWindow(compositor->display, screen->root);
        XGetGeometry(compositor->display, screen->overlay, &dummy_root, &x, &y, &screen->width, &screen->height, &border, &depth);
+       XShapeCombineRectangles(compositor->display, screen->overlay, ShapeInput, 0, 0, NULL, 0, ShapeSet, Unsorted);
 
        if(!initialize_gl(compositor, screen))
                return 0;
@@ -382,6 +384,13 @@ int initialize_compositor(Compositor *compositor)
        else if(major_ver<1)
                return with_error("XDamage 1.0 or later is required");
 
+       if(!XShapeQueryExtension(compositor->display, &event_base, &error_base))
+               return with_error("XShape is required but was not found");
+       else if(!XShapeQueryVersion(compositor->display, &major_ver, &minor_ver))
+               return with_error("Cannot determine XShape version");
+       else if(major_ver<1 || (major_ver==1 && minor_ver<1))
+               return with_error("XShape 1.1 or later is required");
+
        compositor->glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((unsigned char *)"glXCreateContextAttribsARB");
        compositor->glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)glXGetProcAddress((unsigned char *)"glXBindTexImageEXT");
        compositor->glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)glXGetProcAddress((unsigned char *)"glXReleaseTexImageEXT");