Fix fake scroll when scrolling in unfocused kitty window

Scrolling should happen in the kitty window under the mouse cursor, not in the currently active kitty window.
This commit is contained in:
Luflosi 2020-06-04 23:57:01 +02:00
parent 04b6bf3b74
commit 85fe783652
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0
4 changed files with 3 additions and 4 deletions

View File

@ -303,7 +303,6 @@ void enter_event(void);
void mouse_event(int, int, int);
void focus_in_event(void);
void scroll_event(double, double, int, int);
void fake_scroll(int, bool);
void set_special_key_combo(int glfw_key, int mods, bool is_native);
void on_key_input(GLFWkeyevent *ev);
void request_window_attention(id_type, bool);

View File

@ -203,8 +203,7 @@ on_key_input(GLFWkeyevent *ev) {
}
void
fake_scroll(int amount, bool upwards) {
Window *w = active_window();
fake_scroll(Window *w, int amount, bool upwards) {
if (!w) return;
int key = upwards ? GLFW_KEY_UP : GLFW_KEY_DOWN;
while (amount-- > 0) {

View File

@ -698,7 +698,7 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) {
}
}
} else {
fake_scroll(abs(s), upwards);
fake_scroll(w, abs(s), upwards);
}
}
}

View File

@ -277,3 +277,4 @@ void stop_main_loop(void);
void os_window_update_size_increments(OSWindow *window);
void set_os_window_title_from_window(Window *w, OSWindow *os_window);
void update_os_window_title(OSWindow *os_window);
void fake_scroll(Window *w, int amount, bool upwards);