mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 09:18:08 +02:00
Add drag-and-drop quadrant preview overlay
During a window title-bar drag, render a semi-transparent tint over the destination window to preview the drop outcome: - Full-window tint (quadrant=5) when hovering any window in swap-based layouts (Tall, Stack, Fat, etc.) or over a title bar — swap is the result so the whole window is highlighted. - Half-window directional tint (quadrant 1-4) when hovering in the Splits layout — a real directional insert happens so only the target half is highlighted. - 150ms fade-in; clears immediately on drop or drag exit. Implementation follows the visual_bell TINT_PROGRAM infrastructure: two new Screen fields (start_drag_overlay_at, drag_overlay_quadrant), draw_drag_preview_overlay() in shaders.c called from draw_cells() after both render paths, set_window_drag_overlay() C→Python bridge in state.c, and the same child-monitor.c needs_render + set_maximum_wait hooks that visual_bell uses to keep frames firing during animation. Layout detection uses hasattr(layout, 'insert_window_next_to') — the same guard _insert_window_in_direction uses internally — so the overlay always matches the actual drop behavior.
This commit is contained in:
@@ -129,6 +129,8 @@ typedef struct {
|
||||
ScreenModes modes, saved_modes;
|
||||
ColorProfile *color_profile;
|
||||
monotonic_t start_visual_bell_at;
|
||||
monotonic_t start_drag_overlay_at; // 0 = inactive
|
||||
uint8_t drag_overlay_quadrant; // 1=left 2=right 3=top 4=bottom 0=none
|
||||
|
||||
uint8_t *write_buf;
|
||||
size_t write_buf_sz, write_buf_used;
|
||||
|
||||
Reference in New Issue
Block a user