qt5-qtbase/0019-xcb-Don-t-send-Qt-Wind...

44 lines
1.8 KiB
Diff

From 2cf3dee10be1d2163eff0893f51f9ece643c2540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
Date: Mon, 12 Sep 2016 15:22:20 +0200
Subject: [PATCH 019/352] 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>
---
src/plugins/platforms/xcb/qxcbwindow.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index da50201..d46228c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2543,8 +2543,13 @@ 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])
- newState = Qt::WindowMinimized;
+ 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
--
2.9.3