mirror of
https://github.com/glfw/glfw.git
synced 2024-11-23 02:25:10 +00:00
X11: Fix race in window hovered query
The window decoration window can go away between calls to XQueryPointer,
for example if the GLFW_DECORATED window attribute was just cleared.
(cherry picked from commit ceb20c7f97
)
This commit is contained in:
parent
606c0fc03e
commit
539f4bdca2
@ -2591,11 +2591,19 @@ int _glfwPlatformWindowHovered(_GLFWwindow* window)
|
|||||||
int rootX, rootY, childX, childY;
|
int rootX, rootY, childX, childY;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
|
||||||
if (!XQueryPointer(_glfw.x11.display, w,
|
_glfwGrabErrorHandlerX11();
|
||||||
&root, &w, &rootX, &rootY, &childX, &childY, &mask))
|
|
||||||
{
|
const Bool result = XQueryPointer(_glfw.x11.display, w,
|
||||||
|
&root, &w, &rootX, &rootY,
|
||||||
|
&childX, &childY, &mask);
|
||||||
|
|
||||||
|
_glfwReleaseErrorHandlerX11();
|
||||||
|
|
||||||
|
if (_glfw.x11.errorCode == BadWindow)
|
||||||
|
w = _glfw.x11.root;
|
||||||
|
|
||||||
|
if (!result)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if (w == window->x11.handle)
|
if (w == window->x11.handle)
|
||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user