Fix window maximize on Linux if it's not shown yet

This commit is contained in:
mafiesto4
2021-02-08 22:19:18 +01:00
parent 034890ee7c
commit dfe7963436

View File

@@ -591,6 +591,8 @@ void LinuxWindow::Maximize(bool enable)
X11::Atom wmMaxHorz = X11::XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", 0); X11::Atom wmMaxHorz = X11::XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", 0);
X11::Atom wmMaxVert = X11::XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", 0); X11::Atom wmMaxVert = X11::XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", 0);
if (IsWindowMapped())
{
X11::XEvent event; X11::XEvent event;
Platform::MemoryClear(&event, sizeof(event)); Platform::MemoryClear(&event, sizeof(event));
event.type = ClientMessage; event.type = ClientMessage;
@@ -602,6 +604,14 @@ void LinuxWindow::Maximize(bool enable)
event.xclient.data.l[2] = wmMaxVert; event.xclient.data.l[2] = wmMaxVert;
XSendEvent(display, X11_DefaultRootWindow(display), 0, SubstructureRedirectMask | SubstructureNotifyMask, &event); XSendEvent(display, X11_DefaultRootWindow(display), 0, SubstructureRedirectMask | SubstructureNotifyMask, &event);
}
else
{
X11::Atom states[2];
states[0] = wmMaxVert;
states[1] = wmMaxHorz;
X11::XChangeProperty(display, window, wmState, (X11::Atom)4, 32, PropModeReplace, (unsigned char*)states, 2);
}
} }
void LinuxWindow::Minimize(bool enable) void LinuxWindow::Minimize(bool enable)