Fix regression in minimized state handling

WM_STATE and _NET_WM_STATE are not the same.
c6e271da6d1d972ad73a97871baafe57578a69a9 introduces a severe regression
in this respect, making applications on xcb not to follow window state
changes properly.

Task-number: QTBUG-37695
Change-Id: Ia058bc11d5aa988eab513939c9f755c2f77512ee
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Laszlo Agocs 2014-03-25 13:12:48 +01:00 committed by The Qt Project
parent 7f41e56ec3
commit d668f1be22

View File

@ -1829,21 +1829,21 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
return;
Qt::WindowState newState = Qt::WindowNoState;
if (event->atom == atom(QXcbAtom::_NET_WM_STATE)) { // WM_STATE: Quick check for 'Minimize'.
if (event->atom == atom(QXcbAtom::WM_STATE)) { // WM_STATE: Quick check for 'Minimize'.
const xcb_get_property_cookie_t get_cookie =
xcb_get_property(xcb_connection(), 0, m_window, atom(QXcbAtom::_NET_WM_STATE),
XCB_ATOM_ANY, 0, 1024);
xcb_get_property(xcb_connection(), 0, m_window, atom(QXcbAtom::WM_STATE),
XCB_ATOM_ANY, 0, 1024);
xcb_get_property_reply_t *reply =
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::_NET_WM_STATE)) {
if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::WM_STATE)) {
const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
newState = Qt::WindowMinimized;
}
free(reply);
} // WM_STATE: Quick check for 'Minimize'.
}
if (newState != Qt::WindowMinimized) { // Something else changed, get _NET_WM_STATE.
const NetWmStates states = netWmStates();
if ((states & NetWmStateMaximizedHorz) && (states & NetWmStateMaximizedVert))