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