xcb: Don't send "Qt::WindowNoState" event when hiding minimized window

This prevents getting "QWidget::showEvent()" when hiding minimized
widget on some WMs like Marco or Xfwm4.

If QWindow is minimized and it gets the new "XCB_WM_STATE_WITHDRAWN"
event from XCB, then don't change the QWindow state.

Task-number: QTBUG-55942
Change-Id: I90cfc2bf55e507864ad8f26c8f569ea562c27314
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Błażej Szczygieł 2016-09-12 15:22:20 +02:00
parent 258e4d05ed
commit 2cf3dee10b

View File

@ -2543,9 +2543,14 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
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])
if (reply->length != 0) {
if (data[0] == XCB_WM_STATE_ICONIC
|| (data[0] == XCB_WM_STATE_WITHDRAWN
&& m_lastWindowStateEvent == Qt::WindowMinimized)) {
newState = Qt::WindowMinimized;
}
}
}
free(reply);
} else { // _NET_WM_STATE can't change minimized state
if (m_lastWindowStateEvent == Qt::WindowMinimized)