mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 19:19:35 +02:00
Ensure mouse cursor is in default state when focus is switched to the OSWindow
This commit is contained in:
@@ -274,6 +274,7 @@ unsigned int safe_wcwidth(uint32_t ch);
|
||||
void change_wcwidth(bool use9);
|
||||
void set_mouse_cursor(MouseShape);
|
||||
void mouse_event(int, int);
|
||||
void focus_in_event();
|
||||
void scroll_event(double, double);
|
||||
void fake_scroll(bool);
|
||||
void set_special_key_combo(int glfw_key, int mods);
|
||||
|
||||
@@ -145,7 +145,10 @@ static void
|
||||
window_focus_callback(GLFWwindow *w, int focused) {
|
||||
if (!set_callback_window(w)) return;
|
||||
global_state.callback_os_window->is_focused = focused ? true : false;
|
||||
if (focused) show_mouse_cursor(w);
|
||||
if (focused) {
|
||||
show_mouse_cursor(w);
|
||||
focus_in_event();
|
||||
}
|
||||
double now = monotonic();
|
||||
global_state.callback_os_window->last_mouse_activity_at = now;
|
||||
global_state.callback_os_window->cursor_blink_zero_time = now;
|
||||
|
||||
@@ -324,6 +324,17 @@ window_for_event(unsigned int *window_idx, bool *in_tab_bar) {
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
focus_in_event() {
|
||||
// Ensure that no URL is highlighted and the mouse cursor is in default shape
|
||||
bool in_tab_bar;
|
||||
unsigned int window_idx = 0;
|
||||
mouse_cursor_shape = BEAM;
|
||||
set_mouse_cursor(BEAM);
|
||||
Window *w = window_for_event(&window_idx, &in_tab_bar);
|
||||
if (w) screen_mark_url(w->render_data.screen, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
mouse_event(int button, int modifiers) {
|
||||
MouseShape old_cursor = mouse_cursor_shape;
|
||||
|
||||
Reference in New Issue
Block a user