Added support for mouse buttons 4-n.

This commit is contained in:
Camilla Berglund 2013-09-08 16:08:15 +02:00
parent c93b120252
commit 57b8be1c24
2 changed files with 20 additions and 0 deletions

View File

@ -205,6 +205,7 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
## Changelog ## Changelog
- [Win32] Bugfix: `_WIN32_WINNT` was not set to Windows XP or later - [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 ## Contact

View File

@ -553,6 +553,16 @@ static void processEvent(XEvent *event)
else if (event->xbutton.button == Button7) else if (event->xbutton.button == Button7)
_glfwInputScroll(window, 1.0, 0.0); _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; break;
} }
@ -581,6 +591,15 @@ static void processEvent(XEvent *event)
GLFW_RELEASE, GLFW_RELEASE,
mods); 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; break;
} }