diff --git a/docs/changelog.rst b/docs/changelog.rst index d63cf2f70..6ad53a713 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -218,6 +218,9 @@ Detailed list of changes - Grid layout: Fix vertical :opt:`placement_strategy` values being ignored +- Fix the padding beside window title bars not being drawn when + :opt:`padding_fill_strategy` is set to :code:`neighboring_cell` + 0.49.2 [2026-10-01] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 959c005ee..5892482a4 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1033,7 +1033,7 @@ render_prepared_os_window( BorderRects *br = &tab->border_rects; draw_borders(br->vao_idx, br->num_border_rects, br->rect_buf, br->is_dirty, active_window_bg, num_visible_windows, all_windows_have_same_bg, os_window); br->is_dirty = false; - if (TD.screen && os_window->num_tabs && !os_window->has_too_few_tabs) draw_cells(&TD, os_window, true, true, false, NULL, now); + if (TD.screen && os_window->num_tabs && !os_window->has_too_few_tabs) draw_cells(&TD, os_window, true, true, false, NULL, NULL, now); unsigned int num_of_visible_windows = 0; Window *active_window = NULL; for (unsigned int i = 0; i < tab->num_windows; i++) { @@ -1044,12 +1044,12 @@ render_prepared_os_window( if (w->visible && WD.screen) { bool is_active_window = i == tab->active_window; if (is_active_window) active_window = w; - draw_cells(&WD, os_window, is_active_window, false, num_of_visible_windows == 1, w, now); + draw_cells(&WD, os_window, is_active_window, false, num_of_visible_windows == 1, w, NULL, now); if (WD.screen->start_visual_bell_at | WD.screen->start_drag_overlay_at) set_maximum_wait(ANIMATION_SAMPLE_WAIT); if (OPT(progress_bar) != PROGRESS_BAR_HIDDEN && WD.screen->progress_state == PROGRESS_STATE_INDETERMINATE) set_maximum_wait(ANIMATION_SAMPLE_WAIT); WindowRenderData *trd = &w->window_title_render_data; if (trd->screen && trd->geometry.right > trd->geometry.left && trd->geometry.bottom > trd->geometry.top) - draw_cells(trd, os_window, i == tab->active_window, true, false, NULL, now); + draw_cells(trd, os_window, i == tab->active_window, true, false, NULL, w, now); } } draw_rounded_borders(br, active_window_bg, num_visible_windows, all_windows_have_same_bg, os_window); diff --git a/kitty/shaders.c b/kitty/shaders.c index f38d81549..1624b6032 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -1914,7 +1914,7 @@ configure_padding_vao_attributes(ssize_t vao_idx) { } static void -draw_window_padding(const UIRenderData *ui, Window *window, ssize_t vao_idx, bool for_final_output) { +draw_window_padding(const UIRenderData *ui, unsigned int cl, unsigned int ct, unsigned int cr, unsigned int cb, ssize_t vao_idx, bool for_final_output) { // Color the compensatory padding strips (the innermost slice of the window // padding, arising from the window size not being an exact multiple of the // cell size) to match their neighboring cell. The strips lie outside the @@ -1924,10 +1924,7 @@ draw_window_padding(const UIRenderData *ui, Window *window, ssize_t vao_idx, boo // and one the vertical pair (left+right). Each draw packs its strip cells into // a dedicated buffer so the VAO needs no per-strip reconfiguration. The shader // selects per-strip geometry and cell indices branch-free via lerp. - if (!window || OPT(padding_fill_strategy) != PADDING_FILL_NEIGHBORING_CELL) return; - const unsigned int cl = window->size_mismatch_padding.left, ct = window->size_mismatch_padding.top, cr = window->size_mismatch_padding.right, - cb = window->size_mismatch_padding.bottom; - if (!(cl | ct | cr | cb)) return; + if (OPT(padding_fill_strategy) != PADDING_FILL_NEIGHBORING_CELL || !(cl | ct | cr | cb)) return; Screen *screen = ui->screen; const unsigned int columns = screen->columns, lines = screen->lines; if (!columns || !lines) return; @@ -2132,7 +2129,15 @@ send_cell_data_to_gpu(ssize_t vao_idx, Screen *screen, OSWindow *os_window) { } void -draw_cells(const WindowRenderData *srd, OSWindow *os_window, bool is_active_window, bool is_tab_bar, bool is_single_window, Window *window, monotonic_t now) { +draw_cells( + const WindowRenderData *srd, + OSWindow *os_window, + bool is_active_window, + bool is_tab_bar, + bool is_single_window, + Window *window, + const Window *title_bar_of, + monotonic_t now) { Screen *screen = srd->screen; CELL_BUFFERS; bind_vertex_array(srd->vao_idx); @@ -2183,7 +2188,22 @@ draw_cells(const WindowRenderData *srd, OSWindow *os_window, bool is_active_wind restore_viewport(); // The compensatory padding lies outside the per-window cell viewport, so it // is drawn after restoring the full framebuffer viewport. - draw_window_padding(&ui, window, srd->vao_idx, !ui.os_window->needs_layers); + if (window) { + draw_window_padding( + &ui, + window->size_mismatch_padding.left, + window->size_mismatch_padding.top, + window->size_mismatch_padding.right, + window->size_mismatch_padding.bottom, + srd->vao_idx, + !ui.os_window->needs_layers); + } else if (title_bar_of) { + // The left and right compensatory padding of a window extends alongside + // its title bar. The layout ensures there is no compensatory padding + // between the title bar and the window border. + draw_window_padding( + &ui, title_bar_of->size_mismatch_padding.left, 0, title_bar_of->size_mismatch_padding.right, 0, srd->vao_idx, !ui.os_window->needs_layers); + } } // }}} diff --git a/kitty/state.h b/kitty/state.h index d6e94b60a..3ce002f6d 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -731,7 +731,7 @@ ssize_t create_border_vao(void); void bind_shader_globals_to_current_context(void); void upload_gamma_lut(void); bool send_cell_data_to_gpu(ssize_t, Screen *, OSWindow *); -void draw_cells(const WindowRenderData *, OSWindow *, bool, bool, bool, Window *, monotonic_t); +void draw_cells(const WindowRenderData *, OSWindow *, bool, bool, bool, Window *, const Window *, monotonic_t); bool update_cursor_trail(CursorTrail *ct, Window *w, monotonic_t now, OSWindow *os_window); void set_gpu_viewport(unsigned w, unsigned h); void free_texture(uint32_t *);