summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorhurikhan <m4r10.5ch14ck@gmail.com>2015-01-13 15:44:39 +0800
committerhurikhan <m4r10.5ch14ck@gmail.com>2015-01-13 15:44:39 +0800
commitc0d363266755de3ac87f61600f23921d881d99e2 (patch)
tree49d1d9d8f270e061faab3fc4e37ea5f72b8cb66b /platform
parent6b6c5260488d21c399d389d11e676cce0eba3379 (diff)
introduced the scons experimental_wm_api switch:
================================================ Usage: scons p=x11 experimental_wm_api=yes
Diffstat (limited to 'platform')
-rw-r--r--platform/x11/detect.py4
-rw-r--r--platform/x11/os_x11.cpp32
-rw-r--r--platform/x11/os_x11.h7
3 files changed, 41 insertions, 2 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 621a0c66a0..954e5270e8 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -47,6 +47,7 @@ def get_opts():
return [
('use_llvm','Use llvm compiler','no'),
('use_sanitizer','Use llvm compiler sanitize address','no'),
+ ('experimental_wm_api', 'Use experimental window management API','no'),
]
def get_flags():
@@ -148,3 +149,6 @@ def configure(env):
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+ if(env["experimental_wm_api"]=="yes"):
+ env.Append(CPPFLAGS=['-DEXPERIMENTAL_WM_API'])
+
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 063fb17c26..e20d0731e1 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -182,8 +182,38 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
// borderless fullscreen window mode
if (current_videomode.fullscreen) {
+#ifndef EXPERIMENTAL_WM_API
+ // needed for lxde/openbox, possibly others
+ Hints hints;
+ Atom property;
+ hints.flags = 2;
+ hints.decorations = 0;
+ property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
+ XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
+ XMapRaised(x11_display, x11_window);
+ XWindowAttributes xwa;
+ XGetWindowAttributes(x11_display, DefaultRootWindow(x11_display), &xwa);
+ XMoveResizeWindow(x11_display, x11_window, 0, 0, xwa.width, xwa.height);
+
+ // code for netwm-compliants
+ XEvent xev;
+ Atom wm_state = XInternAtom(x11_display, "_NET_WM_STATE", False);
+ Atom fullscreen = XInternAtom(x11_display, "_NET_WM_STATE_FULLSCREEN", False);
+
+ memset(&xev, 0, sizeof(xev));
+ xev.type = ClientMessage;
+ xev.xclient.window = x11_window;
+ xev.xclient.message_type = wm_state;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = 1;
+ xev.xclient.data.l[1] = fullscreen;
+ xev.xclient.data.l[2] = 0;
+
+ XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureNotifyMask, &xev);
+#else
set_wm_border(false);
set_wm_fullscreen(true);
+#endif
}
// disable resizeable window
@@ -496,6 +526,7 @@ void OS_X11::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) cons
}
+#ifdef EXPERIMENTAL_WM_API
void OS_X11::set_wm_border(bool p_enabled) {
// needed for lxde/openbox, possibly others
Hints hints;
@@ -639,6 +670,7 @@ void OS_X11::set_fullscreen(bool p_enabled,int p_screen) {
bool OS_X11::is_fullscreen() const {
return current_videomode.fullscreen;
}
+#endif
InputModifierState OS_X11::get_key_modifier_state(unsigned int p_x11_state) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index a38d511003..4aca996fdc 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -73,7 +73,6 @@ class OS_X11 : public OS_Unix {
Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_videomode;
- VideoMode pre_videomode;
List<String> args;
Window x11_window;
MainLoop *main_loop;
@@ -160,8 +159,11 @@ class OS_X11 : public OS_Unix {
int joystick_count;
Joystick joysticks[JOYSTICKS_MAX];
+#ifdef EXPERIMENTAL_WM_API
+ VideoMode pre_videomode;
void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
+#endif
protected:
@@ -217,6 +219,7 @@ public:
virtual VideoMode get_video_mode(int p_screen=0) const;
virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const;
+#ifdef EXPERIMENTAL_WM_API
virtual int get_screen_count() const;
virtual Size2 get_screen_size(int p_screen=0) const;
virtual Point2 get_window_position() const;
@@ -225,7 +228,7 @@ public:
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;
-
+#endif
virtual void move_window_to_foreground();
void run();