Skip to content

Commit e040643

Browse files
committed
Fixed right click mouse emulation for the Wacom tablet
The problems are two-fold. When this happens a WM_POINTERDOWN event is sent with IS_POINTER_INCONTACT_WPARAM() evaluating as true. So when SDL_SendPenButton() is sent for the barrel button, there is no pen in contact yet, so the right mouse button is sent. Then SDL_SendPenTouch() is sent, which generates a left button press event. Fixes #12926
1 parent a163257 commit e040643

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/events/SDL_pen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, SDL_Window *wind
565565
event.pbutton.down = down;
566566
SDL_PushEvent(&event);
567567

568-
if (window && (pen_touching == instance_id)) {
568+
if (window && !pen_touching || (pen_touching == instance_id)) {
569569
SDL_Mouse *mouse = SDL_GetMouse();
570570
if (mouse && mouse->pen_mouse_events) {
571571
SDL_SendMouseButton(timestamp, window, SDL_PEN_MOUSEID, button + 1, down);

src/video/windows/SDL_windowsevents.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
13281328
const Uint64 timestamp = WIN_GetEventTimestamp();
13291329
SDL_Window *window = data->window;
13301330

1331-
const bool istouching = IS_POINTER_INCONTACT_WPARAM(wParam);
1331+
const bool istouching = IS_POINTER_INCONTACT_WPARAM(wParam) && IS_POINTER_FIRSTBUTTON_WPARAM(wParam);
13321332

13331333
// if lifting off, do it first, so any motion changes don't cause app issues.
13341334
if (!istouching) {

0 commit comments

Comments
 (0)