Commit 487e0419 authored by Camilla Löwy's avatar Camilla Löwy
Browse files

X11: Fix BadMatch focusing a window on non-EWMH WM

When the WM does not support EWMH or there is no WM running, GLFW falls
back to XSetInputFocus, which will emit BadMatch if the window is not
viewable, which will terminate the program.

Bug spotted on IRC.

(cherry picked from commit aa5e31356178de43d42f43f48914a62c25033f4b)
parent 09384626
...@@ -118,7 +118,7 @@ information on what to include when reporting a bug. ...@@ -118,7 +118,7 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
There is nothing here yet. - [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
## Contact ## Contact
......
...@@ -2457,7 +2457,7 @@ void _glfwPlatformFocusWindow(_GLFWwindow* window) ...@@ -2457,7 +2457,7 @@ void _glfwPlatformFocusWindow(_GLFWwindow* window)
{ {
if (_glfw.x11.NET_ACTIVE_WINDOW) if (_glfw.x11.NET_ACTIVE_WINDOW)
sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0); sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0);
else else if (_glfwPlatformWindowVisible(window))
{ {
XRaiseWindow(_glfw.x11.display, window->x11.handle); XRaiseWindow(_glfw.x11.display, window->x11.handle);
XSetInputFocus(_glfw.x11.display, window->x11.handle, XSetInputFocus(_glfw.x11.display, window->x11.handle,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment