mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #10510 from marcelofg55/osx_window_position_2.1
Fix y axis for set_window_position on OS X
This commit is contained in:
commit
371473db89
1 changed files with 8 additions and 3 deletions
|
|
@ -1465,9 +1465,14 @@ void OS_OSX::_update_window() {
|
||||||
|
|
||||||
void OS_OSX::set_window_position(const Point2 &p_position) {
|
void OS_OSX::set_window_position(const Point2 &p_position) {
|
||||||
|
|
||||||
Point2 size = p_position;
|
Size2 scr = get_screen_size();
|
||||||
size /= display_scale;
|
NSPoint pos;
|
||||||
[window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
|
|
||||||
|
pos.x = p_position.x / display_scale;
|
||||||
|
// For OS X the y starts at the bottom
|
||||||
|
pos.y = (scr.height - p_position.y) / display_scale;
|
||||||
|
|
||||||
|
[window_object setFrameTopLeftPoint:pos];
|
||||||
|
|
||||||
_update_window();
|
_update_window();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue