diff options
-rw-r--r-- | core/bind/core_bind.cpp | 5 | ||||
-rw-r--r-- | core/bind/core_bind.h | 1 | ||||
-rw-r--r-- | core/os/os.h | 1 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 8 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 1 |
5 files changed, 16 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 3f86efc879..47bfba1cbb 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -180,6 +180,10 @@ int _OS::get_screen_count() const { return OS::get_singleton()->get_screen_count(); } +Size2 _OS::get_screen_size(int p_screen) const { + return OS::get_singleton()->get_screen_size(p_screen); +} + Point2 _OS::get_window_position() const { return OS::get_singleton()->get_window_position(); } @@ -661,6 +665,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); + ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position); ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index cb9a5da479..2a87f85ec7 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -109,6 +109,7 @@ public: Array get_fullscreen_mode_list(int p_screen=0) const; virtual int get_screen_count() 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); virtual Size2 get_window_size() const; diff --git a/core/os/os.h b/core/os/os.h index 68769e7ad4..edb5d57c5f 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -151,6 +151,7 @@ public: virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const=0; virtual int get_screen_count() const=0; + virtual Size2 get_screen_size(int p_screen=0) const=0; virtual Point2 get_window_position() const=0; virtual void set_window_position(const Point2& p_position)=0; virtual Size2 get_window_size() const=0; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index c37358139c..063fb17c26 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -530,6 +530,14 @@ int OS_X11::get_screen_count() const { return XScreenCount(x11_display); } +Size2 OS_X11::get_screen_size(int p_screen) const { + Window root = XRootWindow(x11_display, p_screen); + XWindowAttributes xwa; + XGetWindowAttributes(x11_display, root, &xwa); + return Size2i(xwa.width, xwa.height); +} + + Point2 OS_X11::get_window_position() const { int x,y; XWindowAttributes xwa; diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index f55b7dc0e3..a38d511003 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -218,6 +218,7 @@ public: virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const; virtual int get_screen_count() 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); virtual Size2 get_window_size() const; |