Fix mouse move events not having modifiers

The lack of modifiers meant that detect of whether the event should be
tracked in kitty was not working
This commit is contained in:
Kovid Goyal
2019-07-19 19:02:09 +05:30
parent 195d987331
commit 4e427d05b7

View File

@@ -241,10 +241,13 @@ cursor_enter_callback(GLFWwindow *w, int entered) {
global_state.callback_os_window = NULL;
}
static int mods_at_last_button_event = 0;
static void
mouse_button_callback(GLFWwindow *w, int button, int action, int mods) {
if (!set_callback_window(w)) return;
show_mouse_cursor(w);
mods_at_last_button_event = mods;
double now = monotonic();
global_state.callback_os_window->last_mouse_activity_at = now;
if (button >= 0 && (unsigned int)button < arraysz(global_state.callback_os_window->mouse_button_pressed)) {
@@ -264,7 +267,7 @@ cursor_pos_callback(GLFWwindow *w, double x, double y) {
global_state.callback_os_window->cursor_blink_zero_time = now;
global_state.callback_os_window->mouse_x = x * global_state.callback_os_window->viewport_x_ratio;
global_state.callback_os_window->mouse_y = y * global_state.callback_os_window->viewport_y_ratio;
if (is_window_ready_for_callbacks()) mouse_event(-1, 0, -1);
if (is_window_ready_for_callbacks()) mouse_event(-1, mods_at_last_button_event, -1);
request_tick_callback();
global_state.callback_os_window = NULL;
}