From 6c0e5f09d3249cc9336d7e5a720ddcdbd5a0169b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 May 2025 08:01:35 +0530 Subject: [PATCH] Fix layer size calculation on high DPI displays under X11 --- glfw/x11_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glfw/x11_window.c b/glfw/x11_window.c index decce2cd7..58ee33d22 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -556,11 +556,11 @@ calculate_layer_geometry(_GLFWwindow *window) { _glfwPlatformGetWindowContentScale(window, &xscale, &yscale); unsigned cell_width, cell_height; double left_edge_spacing, top_edge_spacing, right_edge_spacing, bottom_edge_spacing; config.size_callback((GLFWwindow*)window, xscale, yscale, &cell_width, &cell_height, &left_edge_spacing, &top_edge_spacing, &right_edge_spacing, &bottom_edge_spacing); + debug_rendering("Calculating layer size at scale: %f cell size: (%u, %u) \n", xscale, cell_width, cell_height) double spacing_x = left_edge_spacing + right_edge_spacing; double spacing_y = top_edge_spacing + bottom_edge_spacing; double xsz = config.x_size_in_pixels ? (unsigned)(config.x_size_in_pixels * xscale) : (cell_width * config.x_size_in_cells); double ysz = config.y_size_in_pixels ? (unsigned)(config.y_size_in_pixels * yscale) : (cell_height * config.y_size_in_cells); - xsz /= xscale; ysz /= yscale; ans.width = (int)(1. + spacing_x + xsz); ans.height = (int)(1. + spacing_y + ysz); GeometryRect m = config.type == GLFW_LAYER_SHELL_TOP || config.type == GLFW_LAYER_SHELL_OVERLAY ? mg.workarea : mg.full; static const struct {