X11: Fix disabling of GLFW_MOUSE_PASSTHROUGH

The client clip region was left in place when mouse passthrough was
disabled, leading to missing mouse input if the window grew beyond it.

Related to #1568.
This commit is contained in:
Camilla Löwy
2020-07-06 23:09:28 +02:00
parent d285a9fdeb
commit e81d381256
3 changed files with 18 additions and 19 deletions
+12 -14
View File
@@ -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;
}