From 6808288823239b0f3a76f9be377e4de82e91b35a Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 8 Jul 2024 16:38:15 +0200 Subject: [PATCH] Make pointer id independent of mouse bindings The device source (MOUSE or FINGER) to use depended on whether a secondary click was possible via mouse bindings. As a first step, always use a mouse source to break this dependency. Note that this change might cause regressions in some (unknown) cases (refs f70359f14fb13f277c65b96f43ec83aba4722457), but hopefully not. Further commits will restore a finger source in some specific use cases, but independent of secondary clicks. Refs #5055 Fixes #5067 PR #5076 --- app/src/input_manager.c | 20 +++----------------- app/src/input_manager.h | 1 - 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 415c12936d..71c4434bc6 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -52,14 +52,6 @@ is_shortcut_key(struct sc_input_manager *im, SDL_Keycode keycode) { || (im->sdl_shortcut_mods & KMOD_RGUI && keycode == SDLK_RGUI); } -static inline bool -mouse_bindings_has_secondary_click(const struct sc_mouse_bindings *mb) { - return mb->right_click == SC_MOUSE_BINDING_CLICK - || mb->middle_click == SC_MOUSE_BINDING_CLICK - || mb->click4 == SC_MOUSE_BINDING_CLICK - || mb->click5 == SC_MOUSE_BINDING_CLICK; -} - void sc_input_manager_init(struct sc_input_manager *im, const struct sc_input_manager_params *params) { @@ -76,8 +68,6 @@ sc_input_manager_init(struct sc_input_manager *im, im->mp = params->mp; im->mouse_bindings = params->mouse_bindings; - im->has_secondary_click = - mouse_bindings_has_secondary_click(&im->mouse_bindings); im->legacy_paste = params->legacy_paste; im->clipboard_autosync = params->clipboard_autosync; @@ -375,9 +365,7 @@ simulate_virtual_finger(struct sc_input_manager *im, msg.inject_touch_event.action = action; msg.inject_touch_event.position.screen_size = im->screen->frame_size; msg.inject_touch_event.position.point = point; - msg.inject_touch_event.pointer_id = - im->has_secondary_click ? SC_POINTER_ID_VIRTUAL_MOUSE - : SC_POINTER_ID_VIRTUAL_FINGER; + msg.inject_touch_event.pointer_id = SC_POINTER_ID_VIRTUAL_MOUSE; msg.inject_touch_event.pressure = up ? 0.0f : 1.0f; msg.inject_touch_event.action_button = 0; msg.inject_touch_event.buttons = 0; @@ -662,8 +650,7 @@ sc_input_manager_process_mouse_motion(struct sc_input_manager *im, struct sc_mouse_motion_event evt = { .position = sc_input_manager_get_position(im, event->x, event->y), - .pointer_id = im->has_secondary_click ? SC_POINTER_ID_MOUSE - : SC_POINTER_ID_GENERIC_FINGER, + .pointer_id = SC_POINTER_ID_MOUSE, .xrel = event->xrel, .yrel = event->yrel, .buttons_state = @@ -817,8 +804,7 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im, .position = sc_input_manager_get_position(im, event->x, event->y), .action = sc_action_from_sdl_mousebutton_type(event->type), .button = sc_mouse_button_from_sdl(event->button), - .pointer_id = im->has_secondary_click ? SC_POINTER_ID_MOUSE - : SC_POINTER_ID_GENERIC_FINGER, + .pointer_id = SC_POINTER_ID_MOUSE, .buttons_state = sc_mouse_buttons_state_from_sdl(sdl_buttons_state, &im->mouse_bindings), }; diff --git a/app/src/input_manager.h b/app/src/input_manager.h index 03c42fe676..d5a5a64d3f 100644 --- a/app/src/input_manager.h +++ b/app/src/input_manager.h @@ -23,7 +23,6 @@ struct sc_input_manager { struct sc_mouse_processor *mp; struct sc_mouse_bindings mouse_bindings; - bool has_secondary_click; bool legacy_paste; bool clipboard_autosync;