From 423f8e59ccbe9d50150a4c15644677c014d55bef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Feb 2019 10:35:39 +0530 Subject: [PATCH] Wayland: Fix auto-iconify on kwin_wayland Upstream: https://github.com/glfw/glfw/commit/45bd991ea981048e874637e6f9d9ab1488f56550 --- glfw/wl_platform.h | 2 +- glfw/wl_window.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index d2a42ee50..c46e957bc 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -169,7 +169,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/glfw/wl_window.c b/glfw/wl_window.c index 2aa60aa1d..8ff6bad04 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -633,10 +633,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, @@ -877,7 +884,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - window->wl.justCreated = GLFW_TRUE; window->wl.transparent = fbconfig->transparent; strncpy(window->wl.appId, wndconfig->wl.appId, sizeof(window->wl.appId));