summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp11
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/os/os.h3
-rw-r--r--platform/x11/os_x11.cpp18
-rw-r--r--platform/x11/os_x11.h2
5 files changed, 33 insertions, 4 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 3109b8bc84..2b4e2e1239 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -184,6 +184,14 @@ void _OS::set_window_position(const Point2& p_position) {
OS::get_singleton()->set_window_position(p_position);
}
+Size2 _OS::get_window_size() const {
+ return OS::get_singleton()->get_window_size();
+}
+
+void _OS::set_window_size(const Size2& p_size) {
+ OS::get_singleton()->set_window_size(p_size);
+}
+
void _OS::set_fullscreen(bool p_enabled,int p_screen) {
OS::get_singleton()->set_fullscreen(p_enabled, p_screen);
}
@@ -648,9 +656,10 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0));
- //MSC
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);
+ ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size);
ObjectTypeDB::bind_method(_MD("set_fullscreen","enabled","screen"),&_OS::set_fullscreen,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("is_fullscreen"),&_OS::is_fullscreen);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 92056aa0d6..e60bb5e66a 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -108,9 +108,10 @@ public:
bool is_video_mode_resizable(int p_screen=0) const;
Array get_fullscreen_mode_list(int p_screen=0) const;
- //MSC
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
+ virtual Size2 get_window_size() const;
+ virtual void set_window_size(const Size2& p_size);
void set_fullscreen(bool p_enabled, int p_screen=0);
bool is_fullscreen() const;
diff --git a/core/os/os.h b/core/os/os.h
index 9089e7de76..7e9fdcc579 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -150,9 +150,10 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const=0;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const=0;
- //MSC
virtual Point2 get_window_position() const=0;
virtual void set_window_position(const Point2& p_position)=0;
+ virtual Size2 get_window_size() const=0;
+ virtual void set_window_size(const Size2 p_size)=0;
virtual void set_fullscreen(bool p_enabled,int p_screen=0)=0;
virtual bool is_fullscreen() const=0;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 502d510f5b..f21ea4c9a2 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -537,8 +537,11 @@ Point2 OS_X11::get_window_position() const {
}
void OS_X11::set_window_position(const Point2& p_position) {
- // _NET_FRAME_EXTENTS
+ if( current_videomode.fullscreen )
+ return;
+
+ // _NET_FRAME_EXTENTS
Atom property = XInternAtom(x11_display,"_NET_FRAME_EXTENTS", True);
Atom type;
int format;
@@ -579,6 +582,19 @@ void OS_X11::set_window_position(const Point2& p_position) {
XMoveWindow(x11_display,x11_window,p_position.x - left,p_position.y - top);
}
+Size2 OS_X11::get_window_size() const {
+ XWindowAttributes xwa;
+ XGetWindowAttributes(x11_display, x11_window, &xwa);
+ return Size2i(xwa.width, xwa.height);
+}
+
+void OS_X11::set_window_size(const Size2 p_size) {
+ if( current_videomode.fullscreen )
+ return;
+
+ XResizeWindow(x11_display, x11_window, p_size.x, p_size.y);
+}
+
void OS_X11::set_fullscreen(bool p_enabled,int p_screen) {
if(p_enabled) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index ad7364f999..1cedea4223 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -219,6 +219,8 @@ public:
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
+ virtual Size2 get_window_size() const;
+ virtual void set_window_size(const Size2 p_size);
virtual void set_fullscreen(bool p_enabled,int p_screen=0);
virtual bool is_fullscreen() const;