Wayland: If the compositor turns off server side decorations after turning them on do not draw client side decorations

This matches the behavior of GNOME based clients and in any case sway
seems to get very confused if CSD is drawn.

Fixes #3888
This commit is contained in:
Kovid Goyal 2021-07-31 11:41:27 +05:30
parent 91d82ebf4b
commit c26665ec4d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 18 additions and 4 deletions

View File

@ -23,6 +23,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Linux binary: Remove any RPATH build artifacts from bundled libraries
- Wayland: If the compositor turns off server side decorations after turning
them on do not draw client side decorations (:iss:`3888`)
0.22.0 [2021-07-26]
----------------------

19
glfw/wl_window.c vendored
View File

@ -255,13 +255,22 @@ dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height
}
static void xdgDecorationHandleConfigure(void* data,
static void
xdgDecorationHandleConfigure(void* data,
struct zxdg_toplevel_decoration_v1* decoration UNUSED,
uint32_t mode)
{
_GLFWwindow* window = data;
window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
bool has_server_side_decorations = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
debug("XDG decoration configure event received: Has server side decorations: %d\n", has_server_side_decorations);
if (!has_server_side_decorations && window->wl.decorations.serverSide) {
// this can happen for example on sway where it has a "border toggle" function
// that turns on/off the server side decorations. In such a case, we dont turn
// on client side decorations, as that causes things to break.
return;
}
window->wl.decorations.serverSide = has_server_side_decorations;
ensure_csd_resources(window);
}
@ -488,7 +497,8 @@ static const struct xdg_surface_listener xdgSurfaceListener = {
xdgSurfaceHandleConfigure
};
static void setXdgDecorations(_GLFWwindow* window)
static void
setXdgDecorations(_GLFWwindow* window)
{
if (_glfw.wl.decorationManager)
{
@ -510,7 +520,8 @@ static void setXdgDecorations(_GLFWwindow* window)
}
}
static bool createXdgSurface(_GLFWwindow* window)
static bool
createXdgSurface(_GLFWwindow* window)
{
window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase,
window->wl.surface);