From 45bd991ea981048e874637e6f9d9ab1488f56550 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Feb 2019 18:12:06 +0100 Subject: [PATCH] Wayland: Fix auto-iconify on kwin_wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now keep track of the fullscreen and activated state and only iconify if we were previously fullscreen and now we are either not fullscreen or not activated anymore. This is the proper way to do it, compared to the previous hack where we didn’t iconify only if it was the first configure event received. --- src/wl_platform.h | 3 +-- src/wl_window.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index c17ebe88..9fef848d 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -208,8 +208,7 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; - // This is a hack to prevent auto-iconification on creation. - GLFWbool justCreated; + GLFWbool wasFullscreen; struct { GLFWbool serverSide; diff --git a/src/wl_window.c b/src/wl_window.c index e95a3aea..ebd76bb3 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -641,10 +641,17 @@ static void xdgToplevelHandleConfigure(void* data, _glfwInputWindowDamage(window); } - if (!window->wl.justCreated && !activated && window->monitor && window->autoIconify) - _glfwPlatformIconifyWindow(window); + if (window->wl.wasFullscreen && window->autoIconify) + { + if (!activated || !fullscreen) + { + _glfwPlatformIconifyWindow(window); + window->wl.wasFullscreen = GLFW_FALSE; + } + } + if (fullscreen && activated) + window->wl.wasFullscreen = GLFW_TRUE; _glfwInputWindowFocus(window, activated); - window->wl.justCreated = GLFW_FALSE; } static void xdgToplevelHandleClose(void* data, @@ -913,7 +920,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - window->wl.justCreated = GLFW_TRUE; window->wl.transparent = fbconfig->transparent; if (!createSurface(window, wndconfig))