wayland: Move additional pointer buttons after the old 4-7 scrolling ones
We were using that range for the extra buttons after left/right/middle, while this is harmless for clients not handling extra buttons (we used to translate those button events into scroll events in x11 anyway) this will be unexpected for clients that do handle additional mouse buttons themselves (eg. back/forward buttons present in some mice). In order to remain compatible with X11, those need to be assigned from button 8 onwards. Also, include input.h, and stop using magic numbers here. https://bugzilla.gnome.org/show_bug.cgi?id=758072
This commit is contained in:
parent
a51c607df7
commit
4c49c0a297
@ -33,9 +33,13 @@
|
||||
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define BUTTON_BASE (BTN_LEFT - 1) /* Used to translate to 1-indexed buttons */
|
||||
|
||||
typedef struct _GdkWaylandTouchData GdkWaylandTouchData;
|
||||
|
||||
struct _GdkWaylandTouchData
|
||||
@ -1018,14 +1022,18 @@ pointer_handle_button (void *data,
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case 273:
|
||||
gdk_button = 3;
|
||||
case BTN_LEFT:
|
||||
gdk_button = GDK_BUTTON_PRIMARY;
|
||||
break;
|
||||
case 274:
|
||||
gdk_button = 2;
|
||||
case BTN_MIDDLE:
|
||||
gdk_button = GDK_BUTTON_MIDDLE;
|
||||
break;
|
||||
case BTN_RIGHT:
|
||||
gdk_button = GDK_BUTTON_SECONDARY;
|
||||
break;
|
||||
default:
|
||||
gdk_button = button - 271;
|
||||
/* For compatibility reasons, all additional buttons go after the old 4-7 scroll ones */
|
||||
gdk_button = button - BUTTON_BASE + 4;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user