mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 22:14:53 +02:00
Wayland GNOME: Fix incorrect window size when in some circumstances when switching between windows with window decorations disabled
Only call wl_surface_commit() after a resize when the correct size buffer is attached to the surface. This is ensured by setting a flag on the window that prevents all surface commits till it is cleared. The flag is cleared at next eglSwapBuffers(). I dont actually understand if this guarantees that the buffer size is always correct. For example, if the back buffer is latched when wl_egl_resize_window() is called, the backbuffer will be correct only after two swaps (I think). Or maybe the old back buffer is discarded, I cant find any documentation about it. All I can say is that doing it this way seems to fix the issue. Thanks to @jadahl for his help with tracking down the root cause. Fixes #4802
This commit is contained in:
10
kitty/glfw.c
10
kitty/glfw.c
@@ -312,14 +312,6 @@ dpi_change_callback(GLFWwindow *w, float x_scale UNUSED, float y_scale UNUSED) {
|
||||
window->live_resize.last_resize_event_at = monotonic();
|
||||
global_state.callback_os_window = NULL;
|
||||
request_tick_callback();
|
||||
if (global_state.is_wayland) {
|
||||
// because of the stupidity of Wayland design, the GLFW wayland backend
|
||||
// will need to swap buffers immediately after a scale change to ensure
|
||||
// the buffer size is a multiple of the scale. So blank the new buffer to
|
||||
// ensure we dont leak any unintialized pixels to the screen. The OpenGL viewport
|
||||
// will already have been resized to its new size in framebuffer_size_callback
|
||||
blank_os_window(window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1539,8 +1531,8 @@ request_frame_render(OSWindow *w) {
|
||||
// Some Wayland compositors are too fragile to handle multiple
|
||||
// render frame requests, see https://github.com/kovidgoyal/kitty/issues/2329
|
||||
if (w->render_state != RENDER_FRAME_REQUESTED) {
|
||||
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
|
||||
w->render_state = RENDER_FRAME_REQUESTED;
|
||||
glfwRequestWaylandFrameEvent(w->handle, w->id, wayland_frame_request_callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user