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);
}
+3 -3
View File
@@ -333,7 +333,7 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
}
// Notifies shared code of a cursor motion event
// The position is specified in client-area relative screen coordinates
// The position is specified in content area relative screen coordinates
//
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
{
@@ -453,9 +453,9 @@ void _glfwFreeJoystick(_GLFWjoystick* js)
memset(js, 0, sizeof(_GLFWjoystick));
}
// Center the cursor in the middle of the window
// Center the cursor in the content area of the specified window
//
void _glfwCenterCursor(_GLFWwindow* window)
void _glfwCenterCursorInContentArea(_GLFWwindow* window)
{
int width, height;
+1 -1
View File
@@ -760,7 +760,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
int buttonCount,
int hatCount);
void _glfwFreeJoystick(_GLFWjoystick* js);
void _glfwCenterCursor(_GLFWwindow* window);
void _glfwCenterCursorInContentArea(_GLFWwindow* window);
GLFWbool _glfwInitVulkan(int mode);
void _glfwTerminateVulkan(void);
+12 -12
View File
@@ -186,14 +186,14 @@ static HICON createIcon(const GLFWimage* image,
return handle;
}
// Translate client window size to full window size according to styles and DPI
// Translate content area size to full window size according to styles and DPI
//
static void getFullWindowSize(DWORD style, DWORD exStyle,
int clientWidth, int clientHeight,
int contentWidth, int contentHeight,
int* fullWidth, int* fullHeight,
UINT dpi)
{
RECT rect = { 0, 0, clientWidth, clientHeight };
RECT rect = { 0, 0, contentWidth, contentHeight };
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
@@ -204,7 +204,7 @@ static void getFullWindowSize(DWORD style, DWORD exStyle,
*fullHeight = rect.bottom - rect.top;
}
// Enforce the client rect aspect ratio based on which edge is being dragged
// Enforce the content area aspect ratio based on which edge is being dragged
//
static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area)
{
@@ -278,7 +278,7 @@ static void disableCursor(_GLFWwindow* window)
&_glfw.win32.restoreCursorPosX,
&_glfw.win32.restoreCursorPosY);
updateCursorImage(window);
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
updateClipRect(window);
if (!RegisterRawInputDevices(&rid, 1, sizeof(rid)))
@@ -308,9 +308,9 @@ static void enableCursor(_GLFWwindow* window)
}
}
// 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)
{
RECT area;
POINT pos;
@@ -1074,7 +1074,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->win32.scaleToMonitor)
break;
// Adjust the window size to keep the client area size constant
// Adjust the window size to keep the content area size constant
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32())
{
RECT source = {0}, target = {0};
@@ -1244,7 +1244,7 @@ static int createNativeWindow(_GLFWwindow* window,
window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
// Adjust window size to account for DPI scaling of the window frame and
// optionally DPI scaling of the client area
// optionally DPI scaling of the content area
// This cannot be done until we know what monitor it was placed on
if (!window->monitor)
{
@@ -1779,7 +1779,7 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window)
int _glfwPlatformWindowHovered(_GLFWwindow* window)
{
return cursorInClientArea(window);
return cursorInContentArea(window);
}
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
@@ -1972,7 +1972,7 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
}
else if (_glfw.win32.disabledCursorWindow == window)
enableCursor(window);
else if (cursorInClientArea(window))
else if (cursorInContentArea(window))
updateCursorImage(window);
}
@@ -2035,7 +2035,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
if (cursorInClientArea(window))
if (cursorInContentArea(window))
updateCursorImage(window);
}
+2 -2
View File
@@ -67,7 +67,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused)
}
// Notifies shared code that a window has moved
// The position is specified in client-area relative screen coordinates
// The position is specified in content area relative screen coordinates
//
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
{
@@ -229,7 +229,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
if (window->monitor)
{
if (wndconfig.centerCursor)
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
}
else
{
+1 -1
View File
@@ -544,7 +544,7 @@ static void disableCursor(_GLFWwindow* window)
&_glfw.x11.restoreCursorPosX,
&_glfw.x11.restoreCursorPosY);
updateCursorImage(window);
_glfwCenterCursor(window);
_glfwCenterCursorInContentArea(window);
XGrabPointer(_glfw.x11.display, window->x11.handle, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync,