Wayland: Fix decorations not always being created

If a window was initially fullscreen then it would not get an XDG
decoration object.  If the window was later switched to windowed mode it
would then get fallback decorations instead of XDG ones.
This commit is contained in:
Camilla Löwy 2022-12-20 18:34:08 +01:00
parent 228428fa4f
commit 735fc101f5

View File

@ -633,30 +633,30 @@ static GLFWbool createShellObjects(_GLFWwindow* window)
xdg_toplevel_set_maximized(window->wl.xdg.toplevel); xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
setIdleInhibitor(window, GLFW_FALSE); setIdleInhibitor(window, GLFW_FALSE);
}
if (_glfw.wl.decorationManager) if (_glfw.wl.decorationManager)
{ {
window->wl.xdg.decoration = window->wl.xdg.decoration =
zxdg_decoration_manager_v1_get_toplevel_decoration( zxdg_decoration_manager_v1_get_toplevel_decoration(
_glfw.wl.decorationManager, window->wl.xdg.toplevel); _glfw.wl.decorationManager, window->wl.xdg.toplevel);
zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration,
&xdgDecorationListener, &xdgDecorationListener,
window); window);
uint32_t mode; uint32_t mode;
if (window->decorated) if (window->decorated)
mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
else
mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode);
}
else else
{ mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
if (window->decorated)
createFallbackDecorations(window); zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode);
} }
else
{
if (window->decorated && !window->monitor)
createFallbackDecorations(window);
} }
if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE)