Replace client area with content area.
This commit is contained in:
Camilla Löwy
2019-01-22 20:54:16 +01:00
parent a46104ee69
commit d5ab3e919a
12 changed files with 191 additions and 186 deletions
+8 -8
View File
@@ -67,9 +67,9 @@ static NSUInteger getStyleMask(_GLFWwindow* window)
return styleMask;
}
// Returns whether the cursor is in the client area of the specified window
// Returns whether the cursor is in the content area of the specified window
//
static GLFWbool cursorInClientArea(_GLFWwindow* window)
static GLFWbool cursorInContentArea(_GLFWwindow* window)
{
const NSPoint pos = [window->ns.object mouseLocationOutsideOfEventStream];
return [window->ns.view mouse:pos inRect:[window->ns.view frame]];
@@ -124,7 +124,7 @@ static void updateCursorMode(_GLFWwindow* window)
_glfwPlatformGetCursorPos(window,
&_glfw.ns.restoreCursorPosX,
&_glfw.ns.restoreCursorPosY);
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
CGAssociateMouseAndMouseCursorPosition(false);
}
else if (_glfw.ns.disabledCursorWindow == window)
@@ -136,7 +136,7 @@ static void updateCursorMode(_GLFWwindow* window)
_glfw.ns.restoreCursorPosY);
}
if (cursorInClientArea(window))
if (cursorInContentArea(window))
updateCursorImage(window);
}
@@ -271,7 +271,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
[window->context.nsgl.object update];
if (_glfw.ns.disabledCursorWindow == window)
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
const int maximized = [window->ns.object isZoomed];
if (window->ns.maximized != maximized)
@@ -306,7 +306,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
[window->context.nsgl.object update];
if (_glfw.ns.disabledCursorWindow == window)
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
int x, y;
_glfwPlatformGetWindowPos(window, &x, &y);
@@ -332,7 +332,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)windowDidBecomeKey:(NSNotification *)notification
{
if (_glfw.ns.disabledCursorWindow == window)
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
_glfwInputWindowFocus(window, GLFW_TRUE);
updateCursorMode(window);
@@ -1513,7 +1513,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
if (cursorInClientArea(window))
if (cursorInContentArea(window))
updateCursorImage(window);
}