diff --git a/src/x11_init.c b/src/x11_init.c index fd1ccb91..f16f9604 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -864,6 +864,8 @@ static GLFWbool initExtensions(void) _glfw_dlsym(_glfw.x11.xshape.handle, "XShapeCombineRegion"); _glfw.x11.xshape.QueryVersion = (PFN_XShapeQueryVersion) _glfw_dlsym(_glfw.x11.xshape.handle, "XShapeQueryVersion"); + _glfw.x11.xshape.ShapeCombineMask = (PFN_XShapeCombineMask) + _glfw_dlsym(_glfw.x11.xshape.handle, "XShapeCombineMask"); if (XShapeQueryExtension(_glfw.x11.display, &_glfw.x11.xshape.errorBase, @@ -1285,8 +1287,6 @@ int _glfwPlatformInit(void) _glfw_dlsym(_glfw.x11.xlib.handle, "XUndefineCursor"); _glfw.x11.xlib.UngrabPointer = (PFN_XUngrabPointer) _glfw_dlsym(_glfw.x11.xlib.handle, "XUngrabPointer"); - _glfw.x11.xlib.UnionRectWithRegion = (PFN_XUnionRectWithRegion) - _glfw_dlsym(_glfw.x11.xlib.handle, "XUnionRectWithRegion"); _glfw.x11.xlib.UnmapWindow = (PFN_XUnmapWindow) _glfw_dlsym(_glfw.x11.xlib.handle, "XUnmapWindow"); _glfw.x11.xlib.UnsetICFocus = (PFN_XUnsetICFocus) diff --git a/src/x11_platform.h b/src/x11_platform.h index ab2f3aec..c879df4c 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -129,7 +129,6 @@ typedef int (* PFN_XSync)(Display*,Bool); typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*); typedef int (* PFN_XUndefineCursor)(Display*,Window); typedef int (* PFN_XUngrabPointer)(Display*,Time); -typedef int (* PFN_XUnionRectWithRegion)(XRectangle*,Region,Region); typedef int (* PFN_XUnmapWindow)(Display*,Window); typedef void (* PFN_XUnsetICFocus)(XIC); typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*); @@ -232,7 +231,6 @@ typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char #define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates #define XUndefineCursor _glfw.x11.xlib.UndefineCursor #define XUngrabPointer _glfw.x11.xlib.UngrabPointer -#define XUnionRectWithRegion _glfw.x11.xlib.UnionRectWithRegion #define XUnmapWindow _glfw.x11.xlib.UnmapWindow #define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus #define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual @@ -340,9 +338,12 @@ typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*); typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*); typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int); +typedef void (* PFN_XShapeCombineMask)(Display*,Window,int,int,int,Pixmap,int); + #define XShapeQueryExtension _glfw.x11.xshape.QueryExtension #define XShapeQueryVersion _glfw.x11.xshape.QueryVersion #define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion +#define XShapeCombineMask _glfw.x11.xshape.ShapeCombineMask typedef VkFlags VkXlibSurfaceCreateFlagsKHR; typedef VkFlags VkXcbSurfaceCreateFlagsKHR; @@ -596,7 +597,6 @@ typedef struct _GLFWlibraryX11 PFN_XTranslateCoordinates TranslateCoordinates; PFN_XUndefineCursor UndefineCursor; PFN_XUngrabPointer UngrabPointer; - PFN_XUnionRectWithRegion UnionRectWithRegion; PFN_XUnmapWindow UnmapWindow; PFN_XUnsetICFocus UnsetICFocus; PFN_XVisualIDFromVisual VisualIDFromVisual; @@ -746,6 +746,7 @@ typedef struct _GLFWlibraryX11 PFN_XShapeQueryExtension QueryExtension; PFN_XShapeCombineRegion ShapeCombineRegion; PFN_XShapeQueryVersion QueryVersion; + PFN_XShapeCombineMask ShapeCombineMask; } xshape; } _GLFWlibraryX11; diff --git a/src/x11_window.c b/src/x11_window.c index bbbff0d5..566dfae0 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2710,21 +2710,19 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enable if (enabled == window->mousePassthrough) return; - int width = 0; - int height = 0; - if (!enabled) - _glfwPlatformGetWindowSize(window, &width, &height); + if (enabled) + { + Region region = XCreateRegion(); + XShapeCombineRegion(_glfw.x11.display, window->x11.handle, + 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); + XDestroyRegion(region); + } + else + { + XShapeCombineMask(_glfw.x11.display, window->x11.handle, + 2/*ShapeInput*/, 0, 0, None, 0/*ShapeSet*/); + } - XRectangle rect; - rect.x = 0; - rect.y = 0; - rect.width = (unsigned short)width; - rect.height = (unsigned short)height; - - Region region = XCreateRegion(); - XUnionRectWithRegion(&rect, region, region); - XShapeCombineRegion(_glfw.x11.display, window->x11.handle, 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); - XDestroyRegion(region); window->mousePassthrough = enabled; }