diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index 20aef5e67..c08953536 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -652,7 +652,7 @@ pyset_iutf8(ChildMonitor *self, PyObject *args) { static bool cursor_needs_render(Window *w) { - return w->cursor_visible_at_last_render != w->render_data.screen->cursor_render_info.is_visible || w->last_cursor_x != w->render_data.screen->cursor_render_info.x || w->last_cursor_y != w->render_data.screen->cursor_render_info.y || w->last_cursor_shape != w->render_data.screen->cursor_render_info.shape; + return w->cursor_visible_at_last_render != w->render_data.screen->cursor_render_info.is_visible || w->render_data.screen->cursor_render_info.last.x != w->render_data.screen->cursor_render_info.x || w->render_data.screen->cursor_render_info.last.y != w->render_data.screen->cursor_render_info.y || w->last_cursor_shape != w->render_data.screen->cursor_render_info.shape; } static bool @@ -799,7 +799,7 @@ render_prepared_os_window(OSWindow *os_window, unsigned int active_window_id, co if (WD.screen->start_visual_bell_at != 0) { set_maximum_wait(OPT(repaint_delay)); } - w->cursor_visible_at_last_render = WD.screen->cursor_render_info.is_visible; w->last_cursor_x = WD.screen->cursor_render_info.x; w->last_cursor_y = WD.screen->cursor_render_info.y; w->last_cursor_shape = WD.screen->cursor_render_info.shape; + w->cursor_visible_at_last_render = WD.screen->cursor_render_info.is_visible; WD.screen->cursor_render_info.last.x = WD.screen->cursor_render_info.x; WD.screen->cursor_render_info.last.y = WD.screen->cursor_render_info.y; w->last_cursor_shape = WD.screen->cursor_render_info.shape; } } if (os_window->live_resize.in_progress) draw_resizing_text(os_window); diff --git a/kitty/data-types.h b/kitty/data-types.h index 782d9f115..a2f0a8545 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -303,6 +303,7 @@ typedef struct { bool is_visible, is_focused, render_even_when_unfocused; CursorShape shape; unsigned int x, y; + struct { unsigned int x, y; } last; } CursorRenderInfo; typedef enum DynamicColorType { diff --git a/kitty/rc/send_text.py b/kitty/rc/send_text.py index d6e58a926..de03bcc3c 100644 --- a/kitty/rc/send_text.py +++ b/kitty/rc/send_text.py @@ -56,7 +56,7 @@ class ClearSession(SessionAction): for wid in s.window_ids: qw = boss.window_id_map.get(wid) if qw is not None: - qw.screen.render_unfocused_cursor = 0 + qw.screen.render_unfocused_cursor = False class FocusChangedSession(SessionAction): @@ -65,11 +65,10 @@ class FocusChangedSession(SessionAction): s = sessions_map.get(self.sid) if s is not None: boss = get_boss() - val = int(focused) for wid in s.window_ids: qw = boss.window_id_map.get(wid) if qw is not None: - qw.screen.render_unfocused_cursor = val + qw.screen.render_unfocused_cursor = focused class SendText(RemoteCommand): @@ -217,7 +216,7 @@ on bracketed paste mode. if session == 'end': s = create_or_update_session() for w in actual_windows: - w.screen.render_unfocused_cursor = 0 + w.screen.render_unfocused_cursor = False s.window_ids.discard(w.id) ClearSession(sid)() elif session == 'start': @@ -232,7 +231,7 @@ on bracketed paste mode. window.actions_on_removal.append(ClearSession(sid)) window.actions_on_focus_change.append(FocusChangedSession(sid)) for w in actual_windows: - w.screen.render_unfocused_cursor = 1 + w.screen.render_unfocused_cursor = True s.window_ids.add(w.id) else: bp = payload_get('bracketed_paste') @@ -240,7 +239,7 @@ on bracketed paste mode. s = create_or_update_session() for w in actual_windows: if sid: - w.screen.render_unfocused_cursor = 1 + w.screen.render_unfocused_cursor = True s.window_ids.add(w.id) if isinstance(data, WindowSystemKeyEvent): kdata = w.encoded_key(data) diff --git a/kitty/state.h b/kitty/state.h index 2ce144f52..f48af19e8 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -151,7 +151,6 @@ typedef struct WindowBarData { typedef struct { id_type id; bool visible, cursor_visible_at_last_render; - unsigned int last_cursor_x, last_cursor_y; CursorShape last_cursor_shape; PyObject *title; WindowRenderData render_data;