diff --git a/src/wl_platform.h b/src/wl_platform.h index 66c5886b..bd59fcd1 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -199,6 +199,7 @@ typedef struct _GLFWwindowWayland struct xdg_surface* surface; struct xdg_toplevel* toplevel; struct zxdg_toplevel_decoration_v1* decoration; + uint32_t decorationMode; } xdg; _GLFWcursor* currentCursor; @@ -221,7 +222,6 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; struct { - GLFWbool serverSide; struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; int focus; diff --git a/src/wl_window.c b/src/wl_window.c index 6d301da8..a95c37ba 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -262,7 +262,7 @@ static void createFallbackDecorations(_GLFWwindow* window) unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) + if (!_glfw.wl.viewporter || !window->decorated) return; if (!window->wl.decorations.buffer) @@ -315,9 +315,9 @@ static void xdgDecorationHandleConfigure(void* userData, { _GLFWwindow* window = userData; - window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + window->wl.xdg.decorationMode = mode; - if (!window->wl.decorations.serverSide) + if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) createFallbackDecorations(window); } @@ -474,7 +474,7 @@ static void acquireMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_TRUE); - if (!window->wl.decorations.serverSide) + if (window->wl.decorations.top.surface) destroyFallbackDecorations(window); } @@ -487,7 +487,7 @@ static void releaseMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_FALSE); - if (!_glfw.wl.decorationManager) + if (window->wl.xdg.decorationMode != ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) createFallbackDecorations(window); } @@ -678,10 +678,7 @@ static GLFWbool createShellObjects(_GLFWwindow* window) ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); } else - { - window->wl.decorations.serverSide = GLFW_FALSE; createFallbackDecorations(window); - } } if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) @@ -732,6 +729,7 @@ static void destroyShellObjects(_GLFWwindow* window) xdg_surface_destroy(window->wl.xdg.surface); window->wl.xdg.decoration = NULL; + window->wl.xdg.decorationMode = 0; window->wl.xdg.toplevel = NULL; window->wl.xdg.surface = NULL; } @@ -2043,7 +2041,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { - if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) + if (window->decorated && !window->monitor && window->wl.decorations.top.surface) { if (top) *top = GLFW_CAPTION_HEIGHT;