From 57b8be1c24e3a832c5709a5d24fed12020f8eb0f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 8 Sep 2013 16:08:15 +0200 Subject: [PATCH] Added support for mouse buttons 4-n. --- README.md | 1 + src/x11_window.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 0a8854ae..f24de6a1 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/). ## Changelog - [Win32] Bugfix: `_WIN32_WINNT` was not set to Windows XP or later + - [X11] Bugfix: Events for mouse buttons 4 and above were not reported ## Contact diff --git a/src/x11_window.c b/src/x11_window.c index 33c4b8e4..f0e872e4 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -553,6 +553,16 @@ static void processEvent(XEvent *event) else if (event->xbutton.button == Button7) _glfwInputScroll(window, 1.0, 0.0); + else + { + // Additional buttons after 7 are treated as regular buttons + // We subtract 4 to fill the gap left by scroll input above + _glfwInputMouseClick(window, + event->xbutton.button - 4, + GLFW_PRESS, + mods); + } + break; } @@ -581,6 +591,15 @@ static void processEvent(XEvent *event) GLFW_RELEASE, mods); } + else if (event->xbutton.button > Button7) + { + // Additional buttons after 7 are treated as regular buttons + // We subtract 4 to fill the gap left by scroll input above + _glfwInputMouseClick(window, + event->xbutton.button - 4, + GLFW_RELEASE, + mods); + } break; }