Hi,

libinput has the mouse buttons in order: left, right, middle. So fix
the mappings. While here replace the comment before that code that
doesn't make sense anymore.

I've done this as a patch but if you prefer to commit it upstreams and
do a new release, it also works for me.

Index: Makefile
===================================================================
RCS file: /local/cvs/ports/wayland/libinput-openbsd/Makefile,v
diff -u -p -u -r1.5 Makefile
--- Makefile    5 Nov 2023 16:58:38 -0000       1.5
+++ Makefile    8 Nov 2023 16:15:12 -0000
@@ -18,6 +18,7 @@ GH_PROJECT =  libopeninput
 GH_COMMIT =    26b7c6bc8b79f2fbc8c58e01d3432ffd7e346d8d
 
 DISTNAME =     libinput-openbsd-1.24.0
+REVISION =     0
 
 SHARED_LIBS =  input   0.0
 
Index: patches/patch-src_wscons_c
===================================================================
RCS file: patches/patch-src_wscons_c
diff -N patches/patch-src_wscons_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_wscons_c  8 Nov 2023 16:15:12 -0000
@@ -0,0 +1,30 @@
+Fix mouse button ordering
+
+Index: src/wscons.c
+--- src/wscons.c.orig
++++ src/wscons.c
+@@ -103,12 +103,18 @@ wscons_process(struct libinput_device *device, struct 
+ 
+       case WSCONS_EVENT_MOUSE_UP:
+       case WSCONS_EVENT_MOUSE_DOWN:
+-              /*
+-               * Do not return wscons(4) values directly because
+-               * the left button value being 0 it will be
+-               * interpreted as an error.
+-               */
+-              button = wsevent->value + BTN_LEFT;
++              /* button to Linux events */
++              switch (wsevent->value) {
++              case 1:
++                      button = BTN_MIDDLE;
++                      break;
++              case 2:
++                      button = BTN_RIGHT;
++                      break;
++              default:
++                      button = wsevent->value + BTN_LEFT;
++                      break;
++              }
+               if (wsevent->type == WSCONS_EVENT_MOUSE_UP)
+                       bstate = LIBINPUT_BUTTON_STATE_RELEASED;
+               else

-- 
Matthieu Herrb

Reply via email to