[macOS] Fix hiDPI scaling support in `OS.get_real_window_size` and `OS.set_window.size` functions.

This commit is contained in:
bruvzg 2019-03-12 11:41:41 +02:00
parent 6d86450a83
commit 1b6330b125
No known key found for this signature in database
GPG Key ID: 89DD917D9CE4218D
1 changed files with 2 additions and 2 deletions

View File

@ -2270,12 +2270,12 @@ Size2 OS_OSX::get_window_size() const {
Size2 OS_OSX::get_real_window_size() const { Size2 OS_OSX::get_real_window_size() const {
NSRect frame = [window_object frame]; NSRect frame = [window_object frame];
return Size2(frame.size.width, frame.size.height); return Size2(frame.size.width, frame.size.height) * _display_scale();
} }
void OS_OSX::set_window_size(const Size2 p_size) { void OS_OSX::set_window_size(const Size2 p_size) {
Size2 size = p_size; Size2 size = p_size / _display_scale();
if (get_borderless_window() == false) { if (get_borderless_window() == false) {
// NSRect used by setFrame includes the title bar, so add it to our size.y // NSRect used by setFrame includes the title bar, so add it to our size.y