mirror of https://github.com/libsdl-org/SDL.git
Fixed right mouse button emulation when using a pen
Pen button 1 is typically used as right click. Pen button 2 (Wacom eraser) doesn't have a specific mapping, but we'll use middle click for now.
This commit is contained in:
parent
106ccc722e
commit
e3df61b070
|
|
@ -568,7 +568,16 @@ void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *wind
|
||||||
if (window && (!pen_touching || (pen_touching == instance_id))) {
|
if (window && (!pen_touching || (pen_touching == instance_id))) {
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
if (mouse && mouse->pen_mouse_events) {
|
if (mouse && mouse->pen_mouse_events) {
|
||||||
SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, button + 1, down);
|
static const Uint8 mouse_buttons[] = {
|
||||||
|
SDL_BUTTON_LEFT,
|
||||||
|
SDL_BUTTON_RIGHT,
|
||||||
|
SDL_BUTTON_MIDDLE,
|
||||||
|
SDL_BUTTON_X1,
|
||||||
|
SDL_BUTTON_X2
|
||||||
|
};
|
||||||
|
if (button < SDL_arraysize(mouse_buttons)) {
|
||||||
|
SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, mouse_buttons[button], down);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue