From 6df692b61eab2ed12746e3bf8406a5ae64ae73fe Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 26 Apr 2013 17:20:31 +0200 Subject: [PATCH] Renamed CURSOR_CAPTURED to CURSOR_DISABLED. --- examples/wave.c | 2 +- include/GL/glfw3.h | 18 +++++++++--------- src/cocoa_window.m | 10 +++++----- src/input.c | 12 ++++++------ src/win32_window.c | 12 ++++++------ src/x11_window.c | 12 ++++++------ tests/peter.c | 4 ++-- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/examples/wave.c b/examples/wave.c index 693596b2..4e63c4e6 100644 --- a/examples/wave.c +++ b/examples/wave.c @@ -320,7 +320,7 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) if (action == GLFW_PRESS) { - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED); + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); locked = GL_TRUE; } else diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 5f4922e3..f341fe99 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -543,7 +543,7 @@ extern "C" { #define GLFW_CURSOR_NORMAL 0x00040001 #define GLFW_CURSOR_HIDDEN 0x00040002 -#define GLFW_CURSOR_CAPTURED 0x00040003 +#define GLFW_CURSOR_DISABLED 0x00040003 #define GLFW_GAMMA_RAMP_SIZE 256 @@ -1704,8 +1704,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client * area of the window. - * - `GLFW_CURSOR_CAPTURED` makes the cursor invisible and unable to leave the - * window but unconstrained in terms of position. + * - `GLFW_CURSOR_DISABLED` disables the cursor and removes any limitations on + * cursor movement. * * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are @@ -1773,9 +1773,9 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); * This function returns the last reported position of the cursor to the * specified window. * - * If the cursor mode of the specified window is `GLFW_CURSOR_CAPTURED` then - * the cursor position is unbounded and limited only by the minimum and maximum - * values of a `double`. + * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor + * position is unbounded and limited only by the minimum and maximum values of + * a `double`. * * The coordinate can be converted to their integer equivalents with the * `floor` function. Casting directly to an integer type works for positive @@ -1799,9 +1799,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); * focused. If the window does not have focus when this function is called, it * fails silently. * - * If the cursor mode of the specified window is `GLFW_CURSOR_CAPTURED` then - * the cursor position is unbounded and limited only by the minimum and maximum - * values of a `double`. + * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor + * position is unbounded and limited only by the minimum and maximum values of + * a `double`. * * @param[in] window The desired window. * @param[in] xpos The desired x-coordinate, relative to the left edge of the diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 09634b1e..ba093572 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -116,7 +116,7 @@ static void centerCursor(_GLFWwindow *window) _glfwInputWindowSize(window, width, height); _glfwInputWindowDamage(window); - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) centerCursor(window); } @@ -128,7 +128,7 @@ static void centerCursor(_GLFWwindow *window) _glfwPlatformGetWindowPos(window, &x, &y); _glfwInputWindowPos(window, x, y); - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) centerCursor(window); } @@ -149,7 +149,7 @@ static void centerCursor(_GLFWwindow *window) { _glfwInputWindowFocus(window, GL_TRUE); - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) centerCursor(window); } @@ -450,7 +450,7 @@ static int convertMacKeyCode(unsigned int macKeyCode) - (void)mouseMoved:(NSEvent *)event { - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) _glfwInputCursorMotion(window, [event deltaX], [event deltaY]); else { @@ -1020,7 +1020,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) [window->ns.object invalidateCursorRectsForView:window->ns.view]; } - if (mode == GLFW_CURSOR_CAPTURED) + if (mode == GLFW_CURSOR_DISABLED) { CGAssociateMouseAndMouseCursorPosition(false); diff --git a/src/input.c b/src/input.c index 1cbe8d10..37c40908 100644 --- a/src/input.c +++ b/src/input.c @@ -42,7 +42,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode) if (newMode != GLFW_CURSOR_NORMAL && newMode != GLFW_CURSOR_HIDDEN && - newMode != GLFW_CURSOR_CAPTURED) + newMode != GLFW_CURSOR_DISABLED) { _glfwInputError(GLFW_INVALID_ENUM, NULL); return; @@ -54,9 +54,9 @@ static void setCursorMode(_GLFWwindow* window, int newMode) if (window == _glfw.focusedWindow) { - if (oldMode == GLFW_CURSOR_CAPTURED) + if (oldMode == GLFW_CURSOR_DISABLED) _glfwPlatformSetCursorPos(window, _glfw.cursorPosX, _glfw.cursorPosY); - else if (newMode == GLFW_CURSOR_CAPTURED) + else if (newMode == GLFW_CURSOR_DISABLED) { int width, height; @@ -179,7 +179,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods) void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y) { - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (x == 0.0 && y == 0.0) return; @@ -333,8 +333,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos) window->cursorPosX = xpos; window->cursorPosY = ypos; - // Do not move physical cursor in locked cursor mode - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + // Do not move physical cursor if it is disabled + if (window->cursorMode == GLFW_CURSOR_DISABLED) return; // Update physical cursor position diff --git a/src/win32_window.c b/src/win32_window.c index 1b81ce9e..23efc67f 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -412,7 +412,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, { // The window was focused - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) captureCursor(window); else if (window->cursorMode == GLFW_CURSOR_HIDDEN) hideCursor(window); @@ -579,7 +579,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, { double x, y; - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (_glfw.focusedWindow != window) return 0; @@ -638,7 +638,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_SIZE: { - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) updateClipRect(window); _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); @@ -647,7 +647,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_MOVE: { - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) updateClipRect(window); _glfwInputWindowPos(window, LOWORD(lParam), HIWORD(lParam)); @@ -1071,7 +1071,7 @@ void _glfwPlatformPollEvents(void) } // Did the cursor move in an focused window that has captured the cursor - if (window->cursorMode == GLFW_CURSOR_CAPTURED && + if (window->cursorMode == GLFW_CURSOR_DISABLED && !window->win32.cursorCentered) { int width, height; @@ -1109,7 +1109,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) case GLFW_CURSOR_HIDDEN: hideCursor(window); break; - case GLFW_CURSOR_CAPTURED: + case GLFW_CURSOR_DISABLED: captureCursor(window); break; } diff --git a/src/x11_window.c b/src/x11_window.c index 9365d863..ea8a8821 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -626,7 +626,7 @@ static void processEvent(XEvent *event) int x, y; - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (_glfw.focusedWindow != window) break; @@ -705,7 +705,7 @@ static void processEvent(XEvent *event) { _glfwInputWindowFocus(window, GL_TRUE); - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) captureCursor(window); break; @@ -715,7 +715,7 @@ static void processEvent(XEvent *event) { _glfwInputWindowFocus(window, GL_FALSE); - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) showCursor(window); break; @@ -788,7 +788,7 @@ static void processEvent(XEvent *event) double x, y; - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { if (_glfw.focusedWindow != window) break; @@ -1092,7 +1092,7 @@ void _glfwPlatformPollEvents(void) window = _glfw.focusedWindow; if (window) { - if (window->cursorMode == GLFW_CURSOR_CAPTURED) + if (window->cursorMode == GLFW_CURSOR_DISABLED) { int width, height; _glfwPlatformGetWindowSize(window, &width, &height); @@ -1148,7 +1148,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) case GLFW_CURSOR_HIDDEN: hideCursor(window); break; - case GLFW_CURSOR_CAPTURED: + case GLFW_CURSOR_DISABLED: captureCursor(window); break; } diff --git a/tests/peter.c b/tests/peter.c index db9fc63d..12c94fdf 100644 --- a/tests/peter.c +++ b/tests/peter.c @@ -41,7 +41,7 @@ static double cursor_y; static void toggle_cursor(GLFWwindow* window) { - if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_CAPTURED) + if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) { printf("Released cursor\n"); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); @@ -49,7 +49,7 @@ static void toggle_cursor(GLFWwindow* window) else { printf("Captured cursor\n"); - glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED); + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); } }