diff --git a/glfw/wl_client_side_decorations.c b/glfw/wl_client_side_decorations.c index 0bc59b72a..1f3e0ef34 100644 --- a/glfw/wl_client_side_decorations.c +++ b/glfw/wl_client_side_decorations.c @@ -337,7 +337,7 @@ ensure_csd_resources(_GLFWwindow *window) { if (!create_shm_buffers(window)) return false; } - int x, y, scale = window->wl.scale < 1 ? 1 : window->wl.scale; + int32_t x, y, scale = window->wl.scale < 1 ? 1 : window->wl.scale; x = 0; y = -decs.metrics.top; if (!decs.top.surface) create_csd_surfaces(window, &decs.top); position_csd_surface(&decs.top, x, y, scale); @@ -396,10 +396,12 @@ set_csd_window_geometry(_GLFWwindow *window, int32_t *width, int32_t *height) { bool has_csd = window->decorated && !window->wl.decorations.serverSide && window->wl.decorations.left.surface && !window->wl.fullscreened; bool size_specified_by_compositor = *width > 0 && *height > 0; if (!size_specified_by_compositor) { *width = window->wl.width; *height = window->wl.height; } - struct { int32_t x, y, width, height; } geometry = {.x = 0, .y = 0, .width = *width, .height = *height}; + int32_t scale = window->wl.scale >= 1 ? window->wl.scale : 1; + struct { int32_t x, y, width, height; } geometry = {.x = 0, .y = 0, .width = scale * *width, .height = scale * *height}; if (has_csd) { + // I dont know why GNOME wants geometry.x to be zero, but thats what works + geometry.y = -decs.metrics.width * scale; int32_t visible_titlebar_height = decs.metrics.top - decs.metrics.width; - geometry.y = -visible_titlebar_height; *height -= visible_titlebar_height; } xdg_surface_set_window_geometry(window->wl.xdg.surface, geometry.x, geometry.y, geometry.width, geometry.height);