diff options
author | hurikhan <m4r10.5ch14ck@gmail.com> | 2015-01-13 17:25:50 +0800 |
---|---|---|
committer | hurikhan <m4r10.5ch14ck@gmail.com> | 2015-01-13 17:25:50 +0800 |
commit | ce7c7a862ebe37fada7708c342c07d70fa80465a (patch) | |
tree | c2cf4799ae9cf9351b1e4f7d15249ddbf4dbd95d /platform | |
parent | 1445b6806b8a359594b1789726aa87d64b279286 (diff) |
get_screen_position() added
Diffstat (limited to 'platform')
-rw-r--r-- | platform/x11/os_x11.cpp | 12 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index e20d0731e1..01d62f333d 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -561,7 +561,19 @@ int OS_X11::get_screen_count() const { return XScreenCount(x11_display); } +Point2 OS_X11::get_screen_position(int p_screen) const { + if( p_screen >= XScreenCount(x11_display) ) + return Point2i(0,0); + + Window root = XRootWindow(x11_display, p_screen); + XWindowAttributes xwa; + XGetWindowAttributes(x11_display, root, &xwa); + return Point2i(xwa.x, xwa.y); +} + Size2 OS_X11::get_screen_size(int p_screen) const { + if( p_screen >= XScreenCount(x11_display) ) + return Size2i(0,0); Window root = XRootWindow(x11_display, p_screen); XWindowAttributes xwa; XGetWindowAttributes(x11_display, root, &xwa); diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 4aca996fdc..ca35bf2c0a 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -221,6 +221,7 @@ public: #ifdef EXPERIMENTAL_WM_API virtual int get_screen_count() const; + virtual Point2 get_screen_position(int p_screen=0) const; virtual Size2 get_screen_size(int p_screen=0) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2& p_position); |