summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-17 09:54:03 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-09-17 09:54:03 -0300
commitce92999b6a0e943dd78455ec9a38c3c38f1a3f4e (patch)
treecbf069bfbe09396d780fbb4e0335fc1011827106 /platform
parent11898dd475643479ea1fb4fbf6bcc41fdc21bf1c (diff)
parent29fa278c6a039adef517861376ee0beef5f550cf (diff)
Merge pull request #642 from adolson/x11-fullscreen-borderless
thanks enormously, this is fantastic!
Diffstat (limited to 'platform')
-rw-r--r--platform/x11/context_gl_x11.cpp11
-rw-r--r--platform/x11/os_x11.cpp49
-rw-r--r--platform/x11/os_x11.h10
3 files changed, 58 insertions, 12 deletions
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index b56b54822e..38e3479e5d 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -129,17 +129,6 @@ Error ContextGL_X11::initialize() {
}
//};
- if (!OS::get_singleton()->get_video_mode().resizable) {
- XSizeHints *xsh;
- xsh = XAllocSizeHints();
- xsh->flags = PMinSize | PMaxSize;
- xsh->min_width = OS::get_singleton()->get_video_mode().width;
- xsh->max_width = OS::get_singleton()->get_video_mode().width;
- xsh->min_height = OS::get_singleton()->get_video_mode().height;
- xsh->max_height = OS::get_singleton()->get_video_mode().height;
- XSetWMNormalHints(x11_display, x11_window, xsh);
- }
-
if (!opengl_3_context) {
//oldstyle context:
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 62af302791..708c167c54 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -168,6 +168,55 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
+ // borderless fullscreen window mode
+ if (current_videomode.fullscreen) {
+ // 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);
+ }
+
+ // disable resizeable window
+ if (!current_videomode.resizable) {
+ XSizeHints *xsh;
+ xsh = XAllocSizeHints();
+ xsh->flags = PMinSize | PMaxSize;
+ XWindowAttributes xwa;
+ if (current_videomode.fullscreen) {
+ XGetWindowAttributes(x11_display,DefaultRootWindow(x11_display),&xwa);
+ } else {
+ XGetWindowAttributes(x11_display,x11_window,&xwa);
+ }
+ xsh->min_width = xwa.width;
+ xsh->max_width = xwa.width;
+ xsh->min_height = xwa.height;
+ xsh->max_height = xwa.height;
+ XSetWMNormalHints(x11_display, x11_window, xsh);
+ }
+
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 77ef37f6f4..fedf41ad0f 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -49,7 +49,15 @@
#include <X11/Xlib.h>
#include <X11/Xcursor/Xcursor.h>
-//bitch
+// Hints for X11 fullscreen
+typedef struct {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long inputMode;
+ unsigned long status;
+} Hints;
+
#undef CursorShape
/**
@author Juan Linietsky <reduzio@gmail.com>