mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Use glfwSetInputMode to change raw input mode
This commit is contained in:
parent
86544e7c3a
commit
02c2a77362
@ -1002,6 +1002,7 @@ extern "C" {
|
|||||||
#define GLFW_STICKY_KEYS 0x00033002
|
#define GLFW_STICKY_KEYS 0x00033002
|
||||||
#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_INPUT 0x00033005
|
||||||
|
|
||||||
#define GLFW_CURSOR_NORMAL 0x00034001
|
#define GLFW_CURSOR_NORMAL 0x00034001
|
||||||
#define GLFW_CURSOR_HIDDEN 0x00034002
|
#define GLFW_CURSOR_HIDDEN 0x00034002
|
||||||
@ -3415,16 +3416,6 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
|
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
|
||||||
|
|
||||||
/*!
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
GLFWAPI int glfwGetWindowUseRawInput(GLFWwindow* handle);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
GLFWAPI void glfwSetWindowUseRawInput(GLFWwindow* handle, int value);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
|
@ -475,6 +475,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
|
|||||||
return window->stickyMouseButtons;
|
return window->stickyMouseButtons;
|
||||||
case GLFW_LOCK_KEY_MODS:
|
case GLFW_LOCK_KEY_MODS:
|
||||||
return window->lockKeyMods;
|
return window->lockKeyMods;
|
||||||
|
case GLFW_RAW_INPUT:
|
||||||
|
return window->useRawInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
||||||
@ -552,6 +554,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
|||||||
}
|
}
|
||||||
else if (mode == GLFW_LOCK_KEY_MODS)
|
else if (mode == GLFW_LOCK_KEY_MODS)
|
||||||
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
|
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
|
else if (mode == GLFW_RAW_INPUT)
|
||||||
|
_glfwPlatformSetWindowUseRawInput(window, value ? GLFW_TRUE : GLFW_FALSE);
|
||||||
else
|
else
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
||||||
}
|
}
|
||||||
|
17
src/window.c
17
src/window.c
@ -971,23 +971,6 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
|
|||||||
return window->userPointer;
|
return window->userPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI int glfwGetWindowUseRawInput(GLFWwindow* handle)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
assert(window != NULL);
|
|
||||||
|
|
||||||
return window->useRawInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI void glfwSetWindowUseRawInput(GLFWwindow* handle,
|
|
||||||
int value)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
assert(window != NULL);
|
|
||||||
|
|
||||||
_glfwPlatformSetWindowUseRawInput(window, value ? GLFW_TRUE : GLFW_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
|
||||||
GLFWwindowposfun cbfun)
|
GLFWwindowposfun cbfun)
|
||||||
{
|
{
|
||||||
|
@ -164,14 +164,14 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GLFW_KEY_R:
|
case GLFW_KEY_R:
|
||||||
if (glfwGetWindowUseRawInput(window))
|
if (glfwGetInputMode(window, GLFW_RAW_INPUT))
|
||||||
{
|
{
|
||||||
glfwSetWindowUseRawInput(window, GLFW_FALSE);
|
glfwSetInputMode(window, GLFW_RAW_INPUT, GLFW_FALSE);
|
||||||
printf("(( raw input is disabled ))\n");
|
printf("(( raw input is disabled ))\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glfwSetWindowUseRawInput(window, GLFW_TRUE);
|
glfwSetInputMode(window, GLFW_RAW_INPUT, GLFW_TRUE);
|
||||||
printf("(( raw input is enabled ))\n");
|
printf("(( raw input is enabled ))\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user