From ea7568d513a2e25d7341a4920917c51ff2f192d7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 6 Nov 2026 05:12:45 +0530 Subject: [PATCH] Fix margins drawn with the wrong viewport with the Vulkan driver The viewport is driver state shared by all surfaces with Vulkan (and Metal), unlike OpenGL where it is per context. It was set only when an OS Window's size changed, so a resize of another OS Window could leave a stale viewport in place, causing the border/margin rects to be drawn at the wrong size. Set it every time an OS Window is rendered. Fixes #10813 --- kitty/child-monitor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 87d4abb66..05f33941b 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1207,8 +1207,12 @@ render_os_window(OSWindow *w, monotonic_t now, bool scan_for_animated_images) { w->render_calls++; make_os_window_context_current(w); bool needs_render = w->redraw_count > 0 || w->live_resize.in_progress || global_state.thumbnail_callback.os_window == w->id; + // The viewport is driver state shared by all surfaces with some GPU + // drivers, such as Vulkan, so it must be set for this window every time, + // as it may have been changed while another OS Window was current, for + // example, by a resize of another OS Window. + set_gpu_viewport(w->viewport_width, w->viewport_height); if (w->viewport_size_dirty) { - set_gpu_viewport(w->viewport_width, w->viewport_height); w->viewport_size_dirty = false; needs_render = true; }