Merge pull request #16762 from RandomShaper/improve-fullscreen-2.1
Improve/fix fullscreen on X11 (2.1)
This commit is contained in:
commit
aed100a3c3
1 changed files with 15 additions and 6 deletions
|
@ -691,10 +691,14 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) {
|
||||||
hints.decorations = 0;
|
hints.decorations = 0;
|
||||||
property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
|
property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);
|
||||||
XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
|
XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5);
|
||||||
XMapRaised(x11_display, x11_window);
|
if (p_enabled) {
|
||||||
XWindowAttributes xwa;
|
XMapRaised(x11_display, x11_window);
|
||||||
XGetWindowAttributes(x11_display, DefaultRootWindow(x11_display), &xwa);
|
XWindowAttributes xwa;
|
||||||
XMoveResizeWindow(x11_display, x11_window, 0, 0, xwa.width, xwa.height);
|
XGetWindowAttributes(x11_display, DefaultRootWindow(x11_display), &xwa);
|
||||||
|
XMoveResizeWindow(x11_display, x11_window, 0, 0, xwa.width, xwa.height);
|
||||||
|
} else {
|
||||||
|
XResizeWindow(x11_display, x11_window, current_videomode.width, current_videomode.height);
|
||||||
|
}
|
||||||
|
|
||||||
// code for netwm-compliants
|
// code for netwm-compliants
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
|
@ -706,12 +710,17 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) {
|
||||||
xev.xclient.window = x11_window;
|
xev.xclient.window = x11_window;
|
||||||
xev.xclient.message_type = wm_state;
|
xev.xclient.message_type = wm_state;
|
||||||
xev.xclient.format = 32;
|
xev.xclient.format = 32;
|
||||||
xev.xclient.data.l[0] = 1;
|
xev.xclient.data.l[0] = p_enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||||
xev.xclient.data.l[1] = fullscreen;
|
xev.xclient.data.l[1] = fullscreen;
|
||||||
xev.xclient.data.l[2] = 0;
|
xev.xclient.data.l[2] = 0;
|
||||||
|
|
||||||
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureNotifyMask, &xev);
|
XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureNotifyMask, &xev);
|
||||||
|
|
||||||
|
// set bypass compositor hint
|
||||||
|
Atom bypass_compositor = XInternAtom(x11_display, "_NET_WM_BYPASS_COMPOSITOR", False);
|
||||||
|
unsigned long compositing_disable_on = p_enabled ? 1 : 0;
|
||||||
|
XChangeProperty(x11_display, x11_window, bypass_compositor, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&compositing_disable_on, 1);
|
||||||
|
|
||||||
XFlush(x11_display);
|
XFlush(x11_display);
|
||||||
|
|
||||||
if (!p_enabled && !is_window_resizable()) {
|
if (!p_enabled && !is_window_resizable()) {
|
||||||
|
@ -900,7 +909,7 @@ Size2 OS_X11::get_real_window_size() const {
|
||||||
unsigned long remaining;
|
unsigned long remaining;
|
||||||
unsigned char *data = NULL;
|
unsigned char *data = NULL;
|
||||||
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
|
if (XGetWindowProperty(x11_display, x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
|
||||||
long *extents = (long*) data;
|
long *extents = (long *)data;
|
||||||
w += extents[0] + extents[1]; // left, right
|
w += extents[0] + extents[1]; // left, right
|
||||||
h += extents[2] + extents[3]; // top, bottom
|
h += extents[2] + extents[3]; // top, bottom
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue