mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-12 02:09:52 +00:00
Fixed: #1044 Window content is black after switching windowed <-> fullscreen
This commit is contained in:
parent
fbae333941
commit
46de2a84b1
1 changed files with 44 additions and 17 deletions
|
@ -1442,6 +1442,9 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
if (_win == EmptyWindow || !_DestroyWindow)
|
if (_win == EmptyWindow || !_DestroyWindow)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (getWindowStyle() == windowStyle)
|
||||||
|
return true;
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
// get current style
|
// get current style
|
||||||
|
@ -1493,6 +1496,12 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
|
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
|
|
||||||
|
XWindowAttributes attr;
|
||||||
|
XGetWindowAttributes(_dpy, _win, &attr);
|
||||||
|
|
||||||
|
// if window is mapped use events else properties
|
||||||
|
if (attr.map_state != IsUnmapped)
|
||||||
|
{
|
||||||
// Toggle fullscreen
|
// Toggle fullscreen
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
xev.xclient.type = ClientMessage;
|
xev.xclient.type = ClientMessage;
|
||||||
|
@ -1512,6 +1521,24 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
nlwarning("3D: Failed to toggle to fullscreen");
|
nlwarning("3D: Failed to toggle to fullscreen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Atom _NET_WM_STATE = XInternAtom(_dpy, "_NET_WM_STATE", False);
|
||||||
|
|
||||||
|
if (windowStyle == EWSFullscreen)
|
||||||
|
{
|
||||||
|
Atom _NET_WM_STATE_FULLSCREEN = XInternAtom(_dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
|
|
||||||
|
// set state property to fullscreen
|
||||||
|
XChangeProperty(_dpy, _win, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (const unsigned char*)&_NET_WM_STATE_FULLSCREEN, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// delete state property
|
||||||
|
XDeleteProperty(_dpy, _win, _NET_WM_STATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// show window (hack to avoid black window bug)
|
// show window (hack to avoid black window bug)
|
||||||
if (_WindowVisible)
|
if (_WindowVisible)
|
||||||
|
|
Loading…
Reference in a new issue