hw/xwin: _NET_WM_STATE is ATOM[] not ATOM

_NET_WM_STATE is ATOM[] not ATOM, a list of window state hints, so check all of
the atoms, not just the first one

See EWMH specifcation, section "Application Window Properties"

v2: Actually use [] on the returned atom data

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2012-02-04 17:04:11 +00:00
parent 682ccac90b
commit c7aa9f7578

View File

@ -1626,23 +1626,27 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
}
if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
1L, False, XA_ATOM, &type, &format,
MAXINT, False, XA_ATOM, &type, &format,
&nitems, &left,
(unsigned char **) &pAtom) == Success) {
if (pAtom && nitems == 1) {
if (*pAtom == skiptaskbarState)
hint |= HINT_SKIPTASKBAR;
if (*pAtom == hiddenState)
maxmin |= HINT_MIN;
else if (*pAtom == fullscreenState)
maxmin |= HINT_MAX;
if (*pAtom == belowState)
*zstyle = HWND_BOTTOM;
else if (*pAtom == aboveState)
*zstyle = HWND_TOPMOST;
}
if (pAtom)
if (pAtom ) {
unsigned long i;
for (i = 0; i < nitems; i++) {
if (pAtom[i] == skiptaskbarState)
hint |= HINT_SKIPTASKBAR;
if (pAtom[i] == hiddenState)
maxmin |= HINT_MIN;
else if (pAtom[i] == fullscreenState)
maxmin |= HINT_MAX;
if (pAtom[i] == belowState)
*zstyle = HWND_BOTTOM;
else if (pAtom[i] == aboveState)
*zstyle = HWND_TOPMOST;
}
XFree(pAtom);
}
}
nitems = left = 0;