diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-20 16:12:29 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2017-08-21 18:28:29 -0300 |
commit | 63f847b3065bb7c7a130a199731b4d92a7bdfb91 (patch) | |
tree | d9a1ea56e14cd11417a8abd6acead4a028a6d0d2 /platform/osx | |
parent | f6c39830cb7cf0d664bdfa25642b333a1249b96f (diff) |
p_screen param from get_screen_* funcs now default to the current screen
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/os_osx.h | 6 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 56e6802eeb..827114cd2b 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -187,9 +187,9 @@ public: virtual int get_screen_count() const; virtual int get_current_screen() const; virtual void set_current_screen(int p_screen); - virtual Point2 get_screen_position(int p_screen = 0) const; - virtual Size2 get_screen_size(int p_screen = 0) const; - virtual int get_screen_dpi(int p_screen = 0) const; + virtual Point2 get_screen_position(int p_screen = -1) const; + virtual Size2 get_screen_size(int p_screen = -1) const; + virtual int get_screen_dpi(int p_screen = -1) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2 &p_position); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 6d8a6eca66..bf862f265c 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1428,6 +1428,10 @@ void OS_OSX::set_current_screen(int p_screen) { }; Point2 OS_OSX::get_screen_position(int p_screen) const { + if (p_screen == -1) { + p_screen = get_current_screen(); + } + NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { float displayScale = 1.0; @@ -1444,6 +1448,10 @@ Point2 OS_OSX::get_screen_position(int p_screen) const { } int OS_OSX::get_screen_dpi(int p_screen) const { + if (p_screen == -1) { + p_screen = get_current_screen(); + } + NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { float displayScale = 1.0; @@ -1464,6 +1472,10 @@ int OS_OSX::get_screen_dpi(int p_screen) const { } Size2 OS_OSX::get_screen_size(int p_screen) const { + if (p_screen == -1) { + p_screen = get_current_screen(); + } + NSArray *screenArray = [NSScreen screens]; if (p_screen < [screenArray count]) { float displayScale = 1.0; |