From ae6bd13bc0190339d65582bbd3bf82ed1f9985ee Mon Sep 17 00:00:00 2001
From: Rick Stockton <rickstockton@reno-computerhelp.com>
Date: Tue, 14 Feb 2012 18:42:37 -0800
Subject: [PATCH] qtwayland: Add support for 16 mouse buttons
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Update expands the mouse button assignment code block, which formerly
handled only values 272, 273, and 274. New version handles all mouse
mouse buttons shown in kernel's input.h header (decimal values 272
through 285).
Value 286 appears to be the first button in the range for joystick
devices, so I did not include any other kernel-enumerated values.
(Other values might be possible- but I don't know of a mouse which
is currently being sold with more than 15 non-wheel buttons. The
mouse with 15 buttons is the Razer Naga, and I don't own it.)

Task-number: QTBUG-22759

Change-Id: I77f16eb89e24d7d6410199badff28c0d48f7df93
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
---
 .../platforms/wayland/qwaylandinputdevice.cpp | 43 ++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
index 88b1bda0..9062ff61 100644
--- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
+++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp
@@ -167,8 +167,47 @@ void QWaylandInputDevice::inputHandleButton(void *data,
 	qt_button = Qt::RightButton;
 	break;
     case 274:
-	qt_button = Qt::MiddleButton;
-	break;
+        qt_button = Qt::MiddleButton;
+        break;
+    case 275:
+        qt_button = Qt::ExtraButton1;   // AKA BackButton
+        break;
+    case 276:
+        qt_button = Qt::ExtraButton2;   // AKA ForwardButton
+        break;
+    case 277:
+        qt_button = Qt::ExtraButton3;   // AKA TaskButton
+        break;
+    case 278:
+        qt_button = Qt::ExtraButton4;
+        break;
+    case 279:
+        qt_button = Qt::ExtraButton5;
+        break;
+    case 280:
+        qt_button = Qt::ExtraButton6;
+        break;
+    case 281:
+        qt_button = Qt::ExtraButton7;
+        break;
+    case 282:
+        qt_button = Qt::ExtraButton8;
+        break;
+    case 283:
+        qt_button = Qt::ExtraButton9;
+        break;
+    case 284:
+        qt_button = Qt::ExtraButton10;
+        break;
+    case 285:
+        qt_button = Qt::ExtraButton11;
+        break;
+    case 286:
+        qt_button = Qt::ExtraButton12;
+        break;
+    case 285:
+        qt_button = Qt::ExtraButton13;
+        break;
     default:
 	return;
     }
-- 
GitLab