mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
parent
309d79376f
commit
f4d0365a5a
24
src/input.c
24
src/input.c
@ -522,7 +522,9 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (mode == GLFW_CURSOR)
|
||||
switch (mode)
|
||||
{
|
||||
case GLFW_CURSOR:
|
||||
{
|
||||
if (value != GLFW_CURSOR_NORMAL &&
|
||||
value != GLFW_CURSOR_HIDDEN &&
|
||||
@ -543,8 +545,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||
&window->virtualCursorPosX,
|
||||
&window->virtualCursorPosY);
|
||||
_glfw.platform.setCursorMode(window, value);
|
||||
return;
|
||||
}
|
||||
else if (mode == GLFW_STICKY_KEYS)
|
||||
|
||||
case GLFW_STICKY_KEYS:
|
||||
{
|
||||
value = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
if (window->stickyKeys == value)
|
||||
@ -563,8 +567,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||
}
|
||||
|
||||
window->stickyKeys = value;
|
||||
return;
|
||||
}
|
||||
else if (mode == GLFW_STICKY_MOUSE_BUTTONS)
|
||||
|
||||
case GLFW_STICKY_MOUSE_BUTTONS:
|
||||
{
|
||||
value = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
if (window->stickyMouseButtons == value)
|
||||
@ -583,12 +589,16 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||
}
|
||||
|
||||
window->stickyMouseButtons = value;
|
||||
return;
|
||||
}
|
||||
else if (mode == GLFW_LOCK_KEY_MODS)
|
||||
|
||||
case GLFW_LOCK_KEY_MODS:
|
||||
{
|
||||
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
}
|
||||
else if (mode == GLFW_RAW_MOUSE_MOTION)
|
||||
|
||||
case GLFW_RAW_MOUSE_MOTION:
|
||||
{
|
||||
if (!_glfw.platform.rawMouseMotionSupported())
|
||||
{
|
||||
@ -603,8 +613,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
|
||||
|
||||
window->rawMouseMotion = value;
|
||||
_glfw.platform.setRawMouseMotion(window, value);
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
|
||||
}
|
||||
|
||||
|
34
src/window.c
34
src/window.c
@ -882,34 +882,40 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
|
||||
|
||||
value = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
|
||||
if (attrib == GLFW_AUTO_ICONIFY)
|
||||
window->autoIconify = value;
|
||||
else if (attrib == GLFW_RESIZABLE)
|
||||
switch (attrib)
|
||||
{
|
||||
case GLFW_AUTO_ICONIFY:
|
||||
window->autoIconify = value;
|
||||
return;
|
||||
|
||||
case GLFW_RESIZABLE:
|
||||
window->resizable = value;
|
||||
if (!window->monitor)
|
||||
_glfw.platform.setWindowResizable(window, value);
|
||||
}
|
||||
else if (attrib == GLFW_DECORATED)
|
||||
{
|
||||
return;
|
||||
|
||||
case GLFW_DECORATED:
|
||||
window->decorated = value;
|
||||
if (!window->monitor)
|
||||
_glfw.platform.setWindowDecorated(window, value);
|
||||
}
|
||||
else if (attrib == GLFW_FLOATING)
|
||||
{
|
||||
return;
|
||||
|
||||
case GLFW_FLOATING:
|
||||
window->floating = value;
|
||||
if (!window->monitor)
|
||||
_glfw.platform.setWindowFloating(window, value);
|
||||
}
|
||||
else if (attrib == GLFW_FOCUS_ON_SHOW)
|
||||
return;
|
||||
|
||||
case GLFW_FOCUS_ON_SHOW:
|
||||
window->focusOnShow = value;
|
||||
else if (attrib == GLFW_MOUSE_PASSTHROUGH)
|
||||
{
|
||||
return;
|
||||
|
||||
case GLFW_MOUSE_PASSTHROUGH:
|
||||
window->mousePassthrough = value;
|
||||
_glfw.platform.setWindowMousePassthrough(window, value);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user