Use the proper number for wayland CSD vertical shadow geometry

Apparently set_wayland_geometry uses buffer co-ordinates not surface
co-ords so the numbers need to be multiplied by the scale
This commit is contained in:
Kovid Goyal 2021-04-06 22:11:30 +05:30
parent ac3080f0e2
commit f849f383cb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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);