Remove the mouse button limit

It's possible for at least the Wayland and X11 platforms to report mouse
button codes above the 8 named by GLFW. There is however an arbitrary
limitation in place that causes them to never be reported to the API
consumer. This change removes that limitation.
This commit is contained in:
Grzesiek11 2023-10-31 03:17:15 +01:00
parent 00e86d4b73
commit 42cc7705ca
No known key found for this signature in database
GPG Key ID: 4A5445FB68CDB5C4
3 changed files with 10 additions and 6 deletions

View File

@ -284,6 +284,7 @@ video tutorials.
- Jonas Ådahl
- Lasse Öörni
- Leonard König
- Grzesiek11
- All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement

View File

@ -171,6 +171,7 @@ information on what to include when reporting a bug.
- Disabled tests and examples by default when built as a CMake subdirectory
- Removed `GLFW_USE_OSMESA` CMake option enabling the Null platform (#1958)
- Removed CMake generated configuration header
- Removed the limit of only reporting the 8 named mouse buttons
- [Win32] Added a version info resource to the GLFW DLL
- [Win32] Made hidden helper window use its own window class
- [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user

View File

@ -348,20 +348,22 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
{
assert(window != NULL);
assert(button >= 0);
assert(button <= GLFW_MOUSE_BUTTON_LAST);
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
assert(mods == (mods & GLFW_MOD_MASK));
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
if (button < 0)
return;
if (!window->lockKeyMods)
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
if (action == GLFW_RELEASE && window->stickyMouseButtons)
window->mouseButtons[button] = _GLFW_STICK;
else
window->mouseButtons[button] = (char) action;
if (button <= GLFW_MOUSE_BUTTON_LAST)
{
if (action == GLFW_RELEASE && window->stickyMouseButtons)
window->mouseButtons[button] = _GLFW_STICK;
else
window->mouseButtons[button] = (char) action;
}
if (window->callbacks.mouseButton)
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);