Skip to content

Commit

Permalink
x11: Fix mouse button indices
Browse files Browse the repository at this point in the history
In the XCB events the mouse buttons start at index 1, while for WPE we
need to use 0-based indexing: buttons [left, middle, right] are [1, 2,
3] in X11, [0, 1, 2] in WPE.
  • Loading branch information
aperezdc committed Apr 2, 2024
1 parent d93a55a commit 95cf333
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platform/x11/cog-platform-x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ xcb_handle_button_press(xcb_button_press_event_t *event)
case 1:
case 2:
case 3:
s_display->xcb.pointer.button = event->detail;
s_display->xcb.pointer.button = event->detail - 1;
s_display->xcb.pointer.state = 1;
break;
case 4:
Expand Down Expand Up @@ -390,7 +390,7 @@ xcb_handle_button_release (xcb_button_release_event_t *event)
case 1:
case 2:
case 3:
s_display->xcb.pointer.button = event->detail;
s_display->xcb.pointer.button = event->detail - 1;
s_display->xcb.pointer.state = 0;
break;
default:
Expand Down

0 comments on commit 95cf333

Please sign in to comment.