Use EWMH for DisplayServerX11::_window_minimize_check() implementation
This commit is contained in:
parent
75f9c97dea
commit
5666656d42
|
@ -2096,9 +2096,10 @@ bool DisplayServerX11::_window_maximize_check(WindowID p_window, const char *p_a
|
||||||
bool DisplayServerX11::_window_minimize_check(WindowID p_window) const {
|
bool DisplayServerX11::_window_minimize_check(WindowID p_window) const {
|
||||||
const WindowData &wd = windows[p_window];
|
const WindowData &wd = windows[p_window];
|
||||||
|
|
||||||
// Using ICCCM -- Inter-Client Communication Conventions Manual
|
// Using EWMH instead of ICCCM, might work better for Wayland users.
|
||||||
Atom property = XInternAtom(x11_display, "WM_STATE", True);
|
Atom property = XInternAtom(x11_display, "_NET_WM_STATE", True);
|
||||||
if (property == None) {
|
Atom hidden = XInternAtom(x11_display, "_NET_WM_STATE_HIDDEN", True);
|
||||||
|
if (property == None || hidden == None) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2106,7 +2107,7 @@ bool DisplayServerX11::_window_minimize_check(WindowID p_window) const {
|
||||||
int format;
|
int format;
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
unsigned long remaining;
|
unsigned long remaining;
|
||||||
unsigned char *data = nullptr;
|
Atom *atoms = nullptr;
|
||||||
|
|
||||||
int result = XGetWindowProperty(
|
int result = XGetWindowProperty(
|
||||||
x11_display,
|
x11_display,
|
||||||
|
@ -2115,20 +2116,21 @@ bool DisplayServerX11::_window_minimize_check(WindowID p_window) const {
|
||||||
0,
|
0,
|
||||||
32,
|
32,
|
||||||
False,
|
False,
|
||||||
AnyPropertyType,
|
XA_ATOM,
|
||||||
&type,
|
&type,
|
||||||
&format,
|
&format,
|
||||||
&len,
|
&len,
|
||||||
&remaining,
|
&remaining,
|
||||||
&data);
|
(unsigned char **)&atoms);
|
||||||
|
|
||||||
if (result == Success && data) {
|
if (result == Success && atoms) {
|
||||||
long *state = (long *)data;
|
for (unsigned int i = 0; i < len; i++) {
|
||||||
if (state[0] == WM_IconicState) {
|
if (atoms[i] == hidden) {
|
||||||
XFree(data);
|
XFree(atoms);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
XFree(data);
|
XFree(atoms);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue