summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-22 08:12:04 +0200
committerGitHub <noreply@github.com>2017-08-22 08:12:04 +0200
commit7f49e2a7a0e74b7de98c4cb176f333f78d6c0e50 (patch)
treecde824812428078fa0c258b6a9204c6186f6cec9 /platform/x11
parent4fc0a2d776cc26a0b372af4c345ccc0f44e47105 (diff)
parent63f847b3065bb7c7a130a199731b4d92a7bdfb91 (diff)
Merge pull request #10487 from marcelofg55/curscr_as_default
p_screen param from get_screen_* funcs now default to the current screen
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/os_x11.cpp11
-rw-r--r--platform/x11/os_x11.h6
2 files changed, 14 insertions, 3 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 8b4253c72c..dbc3914410 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -761,6 +761,10 @@ void OS_X11::set_current_screen(int p_screen) {
}
Point2 OS_X11::get_screen_position(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
// Using Xinerama Extension
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
@@ -782,6 +786,10 @@ Point2 OS_X11::get_screen_position(int p_screen) const {
}
Size2 OS_X11::get_screen_size(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
// Using Xinerama Extension
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base);
@@ -797,6 +805,9 @@ Size2 OS_X11::get_screen_size(int p_screen) const {
}
int OS_X11::get_screen_dpi(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
//invalid screen?
ERR_FAIL_INDEX_V(p_screen, get_screen_count(), 0);
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index db70f8f84a..497ce1dde2 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -233,9 +233,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);
virtual Size2 get_window_size() const;