From 487e0419a7dc8becf3577e5ae9c79896eca7259d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 5 Jan 2020 14:34:39 +0100 Subject: [PATCH] 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) --- README.md | 2 +- src/x11_window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 339b70e7..64924b7a 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ information on what to include when reporting a bug. ## Changelog -There is nothing here yet. + - [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index 522c293c..ed4e2513 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2457,7 +2457,7 @@ void _glfwPlatformFocusWindow(_GLFWwindow* window) { if (_glfw.x11.NET_ACTIVE_WINDOW) sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0); - else + else if (_glfwPlatformWindowVisible(window)) { XRaiseWindow(_glfw.x11.display, window->x11.handle); XSetInputFocus(_glfw.x11.display, window->x11.handle,