diff --git a/glfw/wl_window.c b/glfw/wl_window.c index f7e329609..41c427214 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -396,7 +396,16 @@ _glfwPlatformToggleFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) { return !already_fullscreen; } -static void xdgToplevelHandleConfigure(void* data, +static void +inform_compositor_of_window_geometry(_GLFWwindow *window, const char *event) { +#define geometry window->wl.decorations.geometry + debug("Setting window geometry in %s event: x=%d y=%d %dx%d\n", event, geometry.x, geometry.y, geometry.width, geometry.height); + xdg_surface_set_window_geometry(window->wl.xdg.surface, geometry.x, geometry.y, geometry.width, geometry.height); +#undef geometry +} + +static void +xdgToplevelHandleConfigure(void* data, struct xdg_toplevel* toplevel UNUSED, int32_t width, int32_t height, @@ -452,10 +461,7 @@ static void xdgToplevelHandleConfigure(void* data, _glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED); ensure_csd_resources(window); wl_surface_commit(window->wl.surface); -#define geometry window->wl.decorations.geometry - debug("Setting window geometry: x=%d y=%d %dx%d\n", geometry.x, geometry.y, geometry.width, geometry.height); - xdg_surface_set_window_geometry(window->wl.xdg.surface, geometry.x, geometry.y, geometry.width, geometry.height); -#undef geometry + inform_compositor_of_window_geometry(window, "configure"); if (live_resize_done) _glfwInputLiveResize(window, false); } @@ -872,6 +878,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) resizeFramebuffer(window); ensure_csd_resources(window); wl_surface_commit(window->wl.surface); + inform_compositor_of_window_geometry(window, "SetWindowSize"); } } diff --git a/kitty/glfw.c b/kitty/glfw.c index 950c1ad34..177c3693c 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -502,7 +502,7 @@ get_window_content_scale(GLFWwindow *w, float *xscale, float *yscale, double *xd *ydpi = *yscale * factor; } -static inline void +static void get_window_dpi(GLFWwindow *w, double *x, double *y) { float xscale, yscale; get_window_content_scale(w, &xscale, &yscale, x, y); @@ -513,7 +513,7 @@ set_os_window_dpi(OSWindow *w) { get_window_dpi(w->handle, &w->logical_dpi_x, &w->logical_dpi_y); } -static inline bool +static bool do_toggle_fullscreen(OSWindow *w) { int width, height, x, y; glfwGetWindowSize(w->handle, &width, &height); @@ -534,9 +534,9 @@ static bool toggle_fullscreen_for_os_window(OSWindow *w) { if (w && w->handle) { #ifdef __APPLE__ - if (!OPT(macos_traditional_fullscreen)) return glfwToggleFullscreen(w->handle, 1); + if (!OPT(macos_traditional_fullscreen)) return glfwToggleFullscreen(w->handle, 1); #endif - return do_toggle_fullscreen(w); + return do_toggle_fullscreen(w); } return false; }