mirror of
https://github.com/glfw/glfw.git
synced 2025-06-06 15:54:56 +00:00
Add GLFW_MOUSE_BUTTON_LIMIT initialization hint
Provide an initialization hint for the removal of the mouse button limit, as users might have assumed GLFW_MOUSE_BUTTON_LAST to be the last possible mouse button, and not the last named mouse button.
This commit is contained in:
parent
7a0012a1a2
commit
4bc709b952
@ -119,6 +119,13 @@ The ANGLE platform type is specified via the `EGL_ANGLE_platform_angle`
|
||||
extension. This extension is not used if this hint is
|
||||
`GLFW_ANGLE_PLATFORM_TYPE_NONE`, which is the default value.
|
||||
|
||||
@anchor GLFW_MOUSE_BUTTON_LIMIT
|
||||
__GLFW_MOUSE_BUTTON_LIMIT__ specifies whether to limit reported mouse buttons to
|
||||
only the named buttons, for compatibility with earlier versions of GLFW that
|
||||
could only report buttons from the named set, as users might have assumed
|
||||
@ref GLFW_MOUSE_BUTTON_LAST to be the last possible mouse button, and not the
|
||||
last named mouse button. Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
|
||||
|
||||
|
||||
@subsubsection init_hints_osx macOS specific init hints
|
||||
|
||||
@ -160,6 +167,7 @@ Initialization hint | Default value | Supported v
|
||||
@ref GLFW_PLATFORM | `GLFW_ANY_PLATFORM` | `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, `GLFW_PLATFORM_X11`, `GLFW_PLATFORM_WAYLAND` or `GLFW_PLATFORM_NULL`
|
||||
@ref GLFW_JOYSTICK_HAT_BUTTONS | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
@ref GLFW_ANGLE_PLATFORM_TYPE | `GLFW_ANGLE_PLATFORM_TYPE_NONE` | `GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`, `GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` or `GLFW_ANGLE_PLATFORM_TYPE_METAL`
|
||||
@ref GLFW_MOUSE_BUTTON_LIMIT | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
@ref GLFW_COCOA_MENUBAR | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
@ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE`
|
||||
|
@ -1297,6 +1297,11 @@ extern "C" {
|
||||
* Platform selection [init hint](@ref GLFW_PLATFORM).
|
||||
*/
|
||||
#define GLFW_PLATFORM 0x00050003
|
||||
/*! @brief Mouse button limit init hint.
|
||||
*
|
||||
* Mouse button limit [init hint](@ref GLFW_PLATFORM).
|
||||
*/
|
||||
#define GLFW_MOUSE_BUTTON_LIMIT 0x00050004
|
||||
/*! @brief macOS specific init hint.
|
||||
*
|
||||
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
|
||||
|
@ -53,6 +53,7 @@ static _GLFWinitconfig _glfwInitHints =
|
||||
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
|
||||
.platformID = GLFW_ANY_PLATFORM,
|
||||
.vulkanLoader = NULL,
|
||||
.mouseButtonLimit = GLFW_TRUE,
|
||||
.ns =
|
||||
{
|
||||
.menubar = GLFW_TRUE,
|
||||
@ -474,6 +475,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
||||
case GLFW_PLATFORM:
|
||||
_glfwInitHints.platformID = value;
|
||||
return;
|
||||
case GLFW_MOUSE_BUTTON_LIMIT:
|
||||
_glfwInitHints.mouseButtonLimit = value;
|
||||
return;
|
||||
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||
_glfwInitHints.ns.chdir = value;
|
||||
return;
|
||||
|
@ -351,7 +351,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
|
||||
assert(action == GLFW_PRESS || action == GLFW_RELEASE);
|
||||
assert(mods == (mods & GLFW_MOD_MASK));
|
||||
|
||||
if (button < 0)
|
||||
if (button < 0 || (_glfw.hints.init.mouseButtonLimit && button > GLFW_MOUSE_BUTTON_LAST))
|
||||
return;
|
||||
|
||||
if (!window->lockKeyMods)
|
||||
|
@ -365,6 +365,7 @@ struct _GLFWinitconfig
|
||||
GLFWbool hatButtons;
|
||||
int angleType;
|
||||
int platformID;
|
||||
GLFWbool mouseButtonLimit;
|
||||
PFN_vkGetInstanceProcAddr vulkanLoader;
|
||||
struct {
|
||||
GLFWbool menubar;
|
||||
|
Loading…
Reference in New Issue
Block a user