Cocoa: Fix glfwSetWindowSize anchor point

This makes glfwSetWindowSize use the top-left corner as anchor point
instead of the bottom-left corner.

Fixes #1553.
This commit is contained in:
Camilla Löwy 2019-08-29 22:08:29 +02:00
parent aa8e8ab960
commit 7f02898264
2 changed files with 10 additions and 1 deletions

View File

@ -128,6 +128,7 @@ information on what to include when reporting a bug.
event (#1490) event (#1490)
- [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the - [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
window (#1499) window (#1499)
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- [X11] Bugfix: Key names were not updated when the keyboard layout changed - [X11] Bugfix: Key names were not updated when the keyboard layout changed
(#1462,#1528) (#1462,#1528)
@ -228,6 +229,7 @@ skills.
- Peter Knut - Peter Knut
- Christoph Kubisch - Christoph Kubisch
- Yuri Kunde Schlesner - Yuri Kunde Schlesner
- Rokas Kupstys
- Konstantin Käfer - Konstantin Käfer
- Eric Larson - Eric Larson
- Robin Leffmann - Robin Leffmann

View File

@ -1032,7 +1032,14 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
acquireMonitor(window); acquireMonitor(window);
} }
else else
[window->ns.object setContentSize:NSMakeSize(width, height)]; {
NSRect contentRect =
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
contentRect.origin.y += contentRect.size.height - height;
contentRect.size = NSMakeSize(width, height);
[window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect]
display:YES];
}
} // autoreleasepool } // autoreleasepool
} }