From eb7c9994bfa34deeac529c0bf6036c3ac67c8165 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 19 Jan 2018 00:24:57 +0100 Subject: [PATCH] Prevent auto-iconify from firing on window creation --- src/wl_platform.h | 3 +++ src/wl_window.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 56291c8d..1eaf4d2a 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -177,6 +177,9 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; + // This is a hack to prevent auto-iconification on creation. + GLFWbool justCreated; + } _GLFWwindowWayland; // Wayland-specific global data diff --git a/src/wl_window.c b/src/wl_window.c index b78233af..82ed2cda 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -338,9 +338,10 @@ static void xdgToplevelHandleConfigure(void* data, _glfwInputWindowDamage(window); } - if (!activated && window->autoIconify) + if (!window->wl.justCreated && !activated && window->autoIconify) _glfwPlatformIconifyWindow(window); _glfwInputWindowFocus(window, activated); + window->wl.justCreated = GLFW_FALSE; } static void xdgToplevelHandleClose(void* data, @@ -561,6 +562,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { + window->wl.justCreated = GLFW_TRUE; window->wl.transparent = fbconfig->transparent; if (!createSurface(window, wndconfig))