From 21ce21cc070424d8b1b49b27ec549d3c60a2ea21 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 15 Jun 2015 14:41:15 +0200 Subject: [PATCH] Improved X11 full screen focus control flow. --- README.md | 1 + src/x11_window.c | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 114d28bb..43ad0575 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ GLFW bundles a number of dependencies in the `deps/` directory. - [X11] Bugfix: `glfwInit` would segfault on systems without RandR - [X11] Bugfix: The response to `_NET_WM_PING` was sent to the wrong window - [X11] Bugfix: Character input via XIM did not work in many cases + - [X11] Bugfix: No fallback existed for missing `_NET_ACTIVE_WINDOW` support - [WGL] Removed `GLFW_USE_DWM_SWAP_INTERVAL` compile-time option - [WGL] Bugfix: Swap interval was ignored when DWM was enabled - [GLX] Added dependency on `libdl` on systems where it provides `dlopen` diff --git a/src/x11_window.c b/src/x11_window.c index 0692aeaf..8b16134b 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -778,16 +778,22 @@ static void enterFullscreenMode(_GLFWwindow* window) 0); } + if (_glfw.x11.NET_ACTIVE_WINDOW) + { + // Ask the window manager to raise and focus the GLFW window + // Only focused windows with the _NET_WM_STATE_FULLSCREEN state end up + // on top of all other windows ("Stacking order" in EWMH spec) + sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0); + } + else + { + XRaiseWindow(_glfw.x11.display, window->x11.handle); + XSetInputFocus(_glfw.x11.display, window->x11.handle, + RevertToParent, CurrentTime); + } + if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) { - if (_glfw.x11.NET_ACTIVE_WINDOW) - { - // Ask the window manager to raise and focus the GLFW window - // Only focused windows with the _NET_WM_STATE_FULLSCREEN state end - // up on top of all other windows ("Stacking order" in EWMH spec) - sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0); - } - // Ask the window manager to make the GLFW window a full screen window // Full screen windows are undecorated and, when focused, are kept // on top of all other windows @@ -807,9 +813,6 @@ static void enterFullscreenMode(_GLFWwindow* window) _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(window->monitor, &mode); - XRaiseWindow(_glfw.x11.display, window->x11.handle); - XSetInputFocus(_glfw.x11.display, window->x11.handle, - RevertToParent, CurrentTime); XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos); XResizeWindow(_glfw.x11.display, window->x11.handle, mode.width, mode.height);