|
@@ -67,15 +67,6 @@ static NSUInteger getStyleMask(_GLFWwindow* window)
|
|
return styleMask;
|
|
return styleMask;
|
|
}
|
|
}
|
|
|
|
|
|
-// Center the cursor in the view of the window
|
|
|
|
-//
|
|
|
|
-static void centerCursor(_GLFWwindow *window)
|
|
|
|
-{
|
|
|
|
- int width, height;
|
|
|
|
- _glfwPlatformGetWindowSize(window, &width, &height);
|
|
|
|
- _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// Returns whether the cursor is in the client area of the specified window
|
|
// Returns whether the cursor is in the client area of the specified window
|
|
//
|
|
//
|
|
static GLFWbool cursorInClientArea(_GLFWwindow* window)
|
|
static GLFWbool cursorInClientArea(_GLFWwindow* window)
|
|
@@ -133,7 +124,7 @@ static void updateCursorMode(_GLFWwindow* window)
|
|
_glfwPlatformGetCursorPos(window,
|
|
_glfwPlatformGetCursorPos(window,
|
|
&_glfw.ns.restoreCursorPosX,
|
|
&_glfw.ns.restoreCursorPosX,
|
|
&_glfw.ns.restoreCursorPosY);
|
|
&_glfw.ns.restoreCursorPosY);
|
|
- centerCursor(window);
|
|
|
|
|
|
+ _glfwCenterCursor(window);
|
|
CGAssociateMouseAndMouseCursorPosition(false);
|
|
CGAssociateMouseAndMouseCursorPosition(false);
|
|
}
|
|
}
|
|
else if (_glfw.ns.disabledCursorWindow == window)
|
|
else if (_glfw.ns.disabledCursorWindow == window)
|
|
@@ -280,7 +271,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|
[window->context.nsgl.object update];
|
|
[window->context.nsgl.object update];
|
|
|
|
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
- centerCursor(window);
|
|
|
|
|
|
+ _glfwCenterCursor(window);
|
|
|
|
|
|
const int maximized = [window->ns.object isZoomed];
|
|
const int maximized = [window->ns.object isZoomed];
|
|
if (window->ns.maximized != maximized)
|
|
if (window->ns.maximized != maximized)
|
|
@@ -315,7 +306,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|
[window->context.nsgl.object update];
|
|
[window->context.nsgl.object update];
|
|
|
|
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
- centerCursor(window);
|
|
|
|
|
|
+ _glfwCenterCursor(window);
|
|
|
|
|
|
int x, y;
|
|
int x, y;
|
|
_glfwPlatformGetWindowPos(window, &x, &y);
|
|
_glfwPlatformGetWindowPos(window, &x, &y);
|
|
@@ -341,7 +332,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
|
{
|
|
{
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
if (_glfw.ns.disabledCursorWindow == window)
|
|
- centerCursor(window);
|
|
|
|
|
|
+ _glfwCenterCursor(window);
|
|
|
|
|
|
_glfwInputWindowFocus(window, GLFW_TRUE);
|
|
_glfwInputWindowFocus(window, GLFW_TRUE);
|
|
updateCursorMode(window);
|
|
updateCursorMode(window);
|