mirror of
https://github.com/glfw/glfw.git
synced 2025-06-07 16:24:57 +00:00
Replace GLFW_MOUSE_BUTTON_LIMIT with GLFW_DISABLE_MOUSE_BUTTON_LIMIT
Normally I'd be against such a double negative, but it seems more intuitive in this case - enabling new handling makes more sense than disabling old handling.
This commit is contained in:
parent
571dfb80ba
commit
e23231de5d
@ -155,7 +155,7 @@ information on what to include when reporting a bug.
|
|||||||
- Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan
|
- Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan
|
||||||
surface extension (#1793)
|
surface extension (#1793)
|
||||||
- Added `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu
|
- Added `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu
|
||||||
- Added `GLFW_MOUSE_BUTTON_LIMIT` input mode for disabling the limit of
|
- Added `GLFW_DISABLE_MOUSE_BUTTON_LIMIT` input mode that disables the limit of
|
||||||
reported mouse buttons to only those with associated mouse button tokens (#2423)
|
reported mouse buttons to only those with associated mouse button tokens (#2423)
|
||||||
- Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
|
- Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
|
||||||
- Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958)
|
- Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958)
|
||||||
|
@ -494,20 +494,19 @@ a mouse button callback.
|
|||||||
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@anchor GLFW_MOUSE_BUTTON_LIMIT
|
@anchor GLFW_DISABLE_MOUSE_BUTTON_LIMIT
|
||||||
To handle all mouse buttons, instead of only ones with associated
|
To handle all mouse buttons, instead of only ones with associated
|
||||||
[button tokens](@ref buttons), set the @ref GLFW_MOUSE_BUTTON_LIMIT
|
[button tokens](@ref buttons), set the @ref GLFW_DISABLE_MOUSE_BUTTON_LIMIT
|
||||||
input mode to `GLFW_FALSE`.
|
input mode.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
glfwSetInputMode(window, GLFW_MOUSE_BUTTON_LIMIT, GLFW_FALSE);
|
glfwSetInputMode(window, GLFW_DISABLE_MOUSE_BUTTON_LIMIT, GLFW_TRUE);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
This input mode specifies whether to limit reported mouse buttons to only those
|
When this input mode is enabled, GLFW doesn't limit the reported mouse buttons
|
||||||
that have an associated button token, for compatibility with earlier versions of
|
to only those that have an associated button token, for compatibility with
|
||||||
GLFW that would only report buttons with an associated button token: users may
|
earlier versions of GLFW, which never reported any buttons over
|
||||||
have assumed that reported buttons always are in the range of
|
@ref GLFW_MOUSE_BUTTON_LAST, on which users could have relied on.
|
||||||
@ref GLFW_MOUSE_BUTTON_1 to @ref GLFW_MOUSE_BUTTON_LAST.
|
|
||||||
|
|
||||||
The callback function receives the [mouse button](@ref buttons), button action
|
The callback function receives the [mouse button](@ref buttons), button action
|
||||||
and [modifier bits](@ref mods).
|
and [modifier bits](@ref mods).
|
||||||
@ -521,8 +520,8 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The mouse button is an integer that can be one of the
|
The mouse button is an integer that can be one of the
|
||||||
[mouse button tokens](@ref buttons) or, if @ref GLFW_MOUSE_BUTTON_LIMIT is
|
[mouse button tokens](@ref buttons) or, if the
|
||||||
set to `GLFW_FALSE`, any other value.
|
@ref GLFW_DISABLE_MOUSE_BUTTON_LIMIT input mode is set, any other value.
|
||||||
|
|
||||||
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ applications.
|
|||||||
GLFW now allows disabling the limit of reported mouse buttons to only those with
|
GLFW now allows disabling the limit of reported mouse buttons to only those with
|
||||||
associated [button tokens](@ref buttons). This allows using mouse buttons with
|
associated [button tokens](@ref buttons). This allows using mouse buttons with
|
||||||
values over 8. For compatibility with older versions, the
|
values over 8. For compatibility with older versions, the
|
||||||
@ref GLFW_MOUSE_BUTTON_LIMIT input mode needs to be set to `GLFW_FALSE` to make
|
@ref GLFW_DISABLE_MOUSE_BUTTON_LIMIT input mode needs to be set to make use of
|
||||||
use of this.
|
this.
|
||||||
|
|
||||||
|
|
||||||
@subsection caveats Caveats for version 3.4
|
@subsection caveats Caveats for version 3.4
|
||||||
|
@ -1144,7 +1144,7 @@ extern "C" {
|
|||||||
#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
|
#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
|
||||||
#define GLFW_LOCK_KEY_MODS 0x00033004
|
#define GLFW_LOCK_KEY_MODS 0x00033004
|
||||||
#define GLFW_RAW_MOUSE_MOTION 0x00033005
|
#define GLFW_RAW_MOUSE_MOTION 0x00033005
|
||||||
#define GLFW_MOUSE_BUTTON_LIMIT 0x00033006
|
#define GLFW_DISABLE_MOUSE_BUTTON_LIMIT 0x00033006
|
||||||
|
|
||||||
#define GLFW_CURSOR_NORMAL 0x00034001
|
#define GLFW_CURSOR_NORMAL 0x00034001
|
||||||
#define GLFW_CURSOR_HIDDEN 0x00034002
|
#define GLFW_CURSOR_HIDDEN 0x00034002
|
||||||
@ -5202,7 +5202,7 @@ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmods
|
|||||||
*
|
*
|
||||||
* The reported `button` value can be higher than `GLFW_MOUSE_BUTTON_LAST` if
|
* The reported `button` value can be higher than `GLFW_MOUSE_BUTTON_LAST` if
|
||||||
* the button does not have an associated [button token](@ref buttons) and the
|
* the button does not have an associated [button token](@ref buttons) and the
|
||||||
* @ref GLFW_MOUSE_BUTTON_LIMIT init hint is set to `GLFW_FALSE`.
|
* @ref GLFW_MOUSE_BUTTON_LIMIT input mode is set.
|
||||||
*
|
*
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
* @param[in] callback The new callback, or `NULL` to remove the currently set
|
* @param[in] callback The new callback, or `NULL` to remove the currently set
|
||||||
|
10
src/input.c
10
src/input.c
@ -351,7 +351,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
|||||||
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
|
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
|
||||||
assert(mods == (mods & GLFW_MOD_MASK));
|
assert(mods == (mods & GLFW_MOD_MASK));
|
||||||
|
|
||||||
if (button < 0 || (window->mouseButtonLimit && button > GLFW_MOUSE_BUTTON_LAST))
|
if (button < 0 || (!window->disableMouseButtonLimit && button > GLFW_MOUSE_BUTTON_LAST))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!window->lockKeyMods)
|
if (!window->lockKeyMods)
|
||||||
@ -578,8 +578,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
|||||||
return window->lockKeyMods;
|
return window->lockKeyMods;
|
||||||
case GLFW_RAW_MOUSE_MOTION:
|
case GLFW_RAW_MOUSE_MOTION:
|
||||||
return window->rawMouseMotion;
|
return window->rawMouseMotion;
|
||||||
case GLFW_MOUSE_BUTTON_LIMIT:
|
case GLFW_DISABLE_MOUSE_BUTTON_LIMIT:
|
||||||
return window->mouseButtonLimit;
|
return window->disableMouseButtonLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
||||||
@ -688,9 +688,9 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GLFW_MOUSE_BUTTON_LIMIT:
|
case GLFW_DISABLE_MOUSE_BUTTON_LIMIT:
|
||||||
{
|
{
|
||||||
window->mouseButtonLimit = value ? GLFW_TRUE : GLFW_FALSE;
|
window->disableMouseButtonLimit = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ struct _GLFWwindow
|
|||||||
GLFWbool stickyKeys;
|
GLFWbool stickyKeys;
|
||||||
GLFWbool stickyMouseButtons;
|
GLFWbool stickyMouseButtons;
|
||||||
GLFWbool lockKeyMods;
|
GLFWbool lockKeyMods;
|
||||||
GLFWbool mouseButtonLimit;
|
GLFWbool disableMouseButtonLimit;
|
||||||
int cursorMode;
|
int cursorMode;
|
||||||
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
|
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
|
||||||
char keys[GLFW_KEY_LAST + 1];
|
char keys[GLFW_KEY_LAST + 1];
|
||||||
|
@ -233,7 +233,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->focusOnShow = wndconfig.focusOnShow;
|
window->focusOnShow = wndconfig.focusOnShow;
|
||||||
window->mousePassthrough = wndconfig.mousePassthrough;
|
window->mousePassthrough = wndconfig.mousePassthrough;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
window->mouseButtonLimit = GLFW_TRUE;
|
|
||||||
|
|
||||||
window->doublebuffer = fbconfig.doublebuffer;
|
window->doublebuffer = fbconfig.doublebuffer;
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ int main(int argc, char** argv)
|
|||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
glfwSetInputMode(slots[i].window, GLFW_MOUSE_BUTTON_LIMIT, GLFW_FALSE);
|
glfwSetInputMode(slots[i].window, GLFW_DISABLE_MOUSE_BUTTON_LIMIT, GLFW_TRUE);
|
||||||
|
|
||||||
glfwSetWindowUserPointer(slots[i].window, slots + i);
|
glfwSetWindowUserPointer(slots[i].window, slots + i);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ int main(int argc, char** argv)
|
|||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
glfwSetInputMode(window, GLFW_MOUSE_BUTTON_LIMIT, GLFW_TRUE);
|
glfwSetInputMode(window, GLFW_DISABLE_MOUSE_BUTTON_LIMIT, GLFW_FALSE);
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
gladLoadGL(glfwGetProcAddress);
|
gladLoadGL(glfwGetProcAddress);
|
||||||
|
Loading…
Reference in New Issue
Block a user