GHOST/Wayland: swap tablet middle/right mouse buttons

There looks to be an inconsistency between Gnome/KDE here,
match KDE and Gnome applications under X11 (even XWayland)
by making the button closest to the nib MMB, and the other button RMB.
This commit is contained in:
Campbell Barton 2022-10-25 20:42:46 +11:00
parent 7e3e4751b5
commit c4f9e4afab
1 changed files with 9 additions and 4 deletions

View File

@ -174,9 +174,14 @@ static bool use_gnome_confine_hack = false;
/**
* Tablet events.
*
* \note Gnome/GTK swap middle/right, where the same application in X11 will swap the middle/right
* mouse button when running under WAYLAND. KDE doesn't do this, and according to artists
* at the Blender studio, having the button closest to the nib be MMB is preferable,
* so use this as a default. If needs be - swapping these could be a preference.
*/
#define BTN_STYLUS 0x14b /* Use as right-mouse. */
#define BTN_STYLUS2 0x14c /* Use as middle-mouse. */
#define BTN_STYLUS 0x14b /* Use as middle-mouse. */
#define BTN_STYLUS2 0x14c /* Use as right-mouse. */
/* NOTE(@campbellbarton): Map to an additional button (not sure which hardware uses this). */
#define BTN_STYLUS3 0x149
@ -2969,10 +2974,10 @@ static void tablet_tool_handle_button(void *data,
GHOST_TButton ebutton = GHOST_kButtonMaskLeft;
switch (button) {
case BTN_STYLUS:
ebutton = GHOST_kButtonMaskRight;
ebutton = GHOST_kButtonMaskMiddle;
break;
case BTN_STYLUS2:
ebutton = GHOST_kButtonMaskMiddle;
ebutton = GHOST_kButtonMaskRight;
break;
case BTN_STYLUS3:
ebutton = GHOST_kButtonMaskButton4;