From dbae857b293231882307c52217e9569a17da0f23 Mon Sep 17 00:00:00 2001 From: Dana Olson Date: Mon, 25 Aug 2014 02:54:10 -0400 Subject: [PATCH] borderless fullscreen window support for x11 move disable resize x11 code from context_gl to os_x11 --- platform/x11/context_gl_x11.cpp | 11 ----------- platform/x11/os_x11.cpp | 33 +++++++++++++++++++++++++++++++++ platform/x11/os_x11.h | 9 +++++++++ 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index b56b54822e2..38e3479e5d0 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 62af302791e..eab9be7f9ba 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -168,6 +168,39 @@ 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) { + 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); + // get the window root, then the res for the root + XWindowAttributes xwa; + XGetWindowAttributes(x11_display,x11_window,&xwa); + XGetWindowAttributes(x11_display,xwa.root,&xwa); + XMoveResizeWindow(x11_display, x11_window ,0 ,0 , xwa.width, xwa.height); + } + + // disable resizeable window + if (!current_videomode.resizable) { + XSizeHints *xsh; + xsh = XAllocSizeHints(); + xsh->flags = PMinSize | PMaxSize; + XWindowAttributes xwa; + XGetWindowAttributes(x11_display,x11_window,&xwa); + if (current_videomode.fullscreen) { + XGetWindowAttributes(x11_display,xwa.root,&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 77ef37f6f4c..e1cd5ddd9dc 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -49,6 +49,15 @@ #include #include +// Hints for X11 fullscreen +typedef struct { + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; +} Hints; + //bitch #undef CursorShape /**