Forward mouse motion only on main clicks
Mouse motion events were forwarded as soon as any mouse button was pressed. Instead, only consider left-click (and also middle-click and right-click if --forward-all-clicks is enabled).
This commit is contained in:
parent
8b90e1d3f4
commit
7db0189f23
1 changed files with 6 additions and 2 deletions
|
@ -595,8 +595,12 @@ convert_mouse_motion(const SDL_MouseMotionEvent *from, struct screen *screen,
|
||||||
static void
|
static void
|
||||||
input_manager_process_mouse_motion(struct input_manager *im,
|
input_manager_process_mouse_motion(struct input_manager *im,
|
||||||
const SDL_MouseMotionEvent *event) {
|
const SDL_MouseMotionEvent *event) {
|
||||||
if (!event->state) {
|
uint32_t mask = SDL_BUTTON_LMASK;
|
||||||
// do not send motion events when no button is pressed
|
if (im->forward_all_clicks) {
|
||||||
|
mask |= SDL_BUTTON_MMASK | SDL_BUTTON_RMASK;
|
||||||
|
}
|
||||||
|
if (!(event->state & mask)) {
|
||||||
|
// do not send motion events when no click is pressed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event->which == SDL_TOUCH_MOUSEID) {
|
if (event->which == SDL_TOUCH_MOUSEID) {
|
||||||
|
|
Loading…
Reference in a new issue