Wayland: Allow hiding window decorations on compositors with SSD as well

This commit is contained in:
Kovid Goyal
2024-04-05 19:17:06 +05:30
parent 2c4ffba0f3
commit 9d86448585
2 changed files with 18 additions and 25 deletions

View File

@@ -87,6 +87,8 @@ Detailed list of changes
- Wayland: A new option :opt:`wayland_enable_ime` to turn off Input Method Extensions which add latency and create bugs
- Wayland: Fix :opt:`hide_window_decorations` not working on non GNOME desktops
0.33.1 [2024-03-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

41
glfw/wl_window.c vendored
View File

@@ -871,26 +871,23 @@ static const struct xdg_surface_listener xdgSurfaceListener = {
static void
setXdgDecorations(_GLFWwindow* window)
{
if (_glfw.wl.decorationManager)
{
if (window->wl.xdg.decoration) {
window->wl.decorations.serverSide = true;
window->wl.xdg.decoration =
zxdg_decoration_manager_v1_get_toplevel_decoration(
_glfw.wl.decorationManager, window->wl.xdg.toplevel);
zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration,
&xdgDecorationListener,
window);
zxdg_toplevel_decoration_v1_set_mode(
window->wl.xdg.decoration,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
else
{
zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, window->decorated ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE: ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
} else {
window->wl.decorations.serverSide = false;
ensure_csd_resources(window);
}
}
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled UNUSED) {
setXdgDecorations(window);
if (window->decorated) ensure_csd_resources(window); else free_csd_surfaces(window);
inform_compositor_of_window_geometry(window, "SetWindowDecorated");
commit_window_surface_if_safe(window);
}
static struct wl_output*
find_output_by_name(const char* name) {
if (!name) return NULL;
@@ -1047,6 +1044,11 @@ create_window_desktop_surface(_GLFWwindow* window)
xdg_toplevel_add_listener(window->wl.xdg.toplevel,
&xdgToplevelListener,
window);
if (_glfw.wl.decorationManager) {
window->wl.xdg.decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
_glfw.wl.decorationManager, window->wl.xdg.toplevel);
zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, &xdgDecorationListener, window);
}
if (window->wl.title)
xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title);
@@ -1644,17 +1646,6 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window UNUSED, bool enabled UN
"Wayland: Window attribute setting not implemented yet");
}
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
{
if (!window->monitor)
{
if (enabled)
ensure_csd_resources(window);
else
free_csd_surfaces(window);
}
}
void _glfwPlatformSetWindowFloating(_GLFWwindow* window UNUSED, bool enabled UNUSED)
{
// TODO