File xcb-dont-assume-creating-window-will-result-in-ConfigureNotify-event.patch of Package libqt5-qtbase.1959

From f30b75e569332558add552cde2b988c3a65e98cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?=
 <tor.arne.vestbo@theqtcompany.com>
Date: Mon, 16 Nov 2015 14:25:48 +0100
Subject: [PATCH] xcb: Don't assume creating a window will result in
 ConfigureNotify event
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We assumed that creating a window would always result in a configure
notify event, so we delayed sending the initial expose event until
receiving the configure notify.

That strategy fails in cases where the window does not need a reconfigure
after being created, such as when not running a window manager, or when
creating child windows. In those cases the window is just mapped, and
we ended up never sending an expose event.

The problem was masked by sometimes receiving an explicit expose event
from X, just after the mapped notification, which we then sent without
waiting for configure. Unfortunately we can't rely on this behavior
and need to remove the deferred expose event logic, so that we always
ensure that at least one expose event is sent to Qt.

Change-Id: I702be7f24de2a1e89c085fb6bd95bb8ff7792a27
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
---
 src/plugins/platforms/xcb/qxcbwindow.cpp | 14 +++-----------
 src/plugins/platforms/xcb/qxcbwindow.h   |  2 --
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index d76f124..6023ee6 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -314,8 +314,6 @@ void QXcbWindow::create()
 
     destroy();
 
-    m_deferredExpose = false;
-    m_configureNotifyPending = true;
     m_windowState = Qt::WindowNoState;
 
     Qt::WindowType type = window()->type();
@@ -2022,12 +2020,8 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
     if (newScreen != currentScreen)
         QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
 
-    m_configureNotifyPending = false;
-
-    if (m_deferredExpose) {
-        m_deferredExpose = false;
+    if (m_mapped)
         QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
-    }
 
     if (m_usingSyncProtocol && m_syncState == SyncReceived)
         m_syncState = SyncAndConfigureReceived;
@@ -2094,10 +2088,8 @@ void QXcbWindow::handleMapNotifyEvent(const xcb_map_notify_event_t *event)
         m_mapped = true;
         if (m_deferredActivation)
             requestActivateWindow();
-        if (m_configureNotifyPending)
-            m_deferredExpose = true;
-        else
-            QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
+
+        QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size()));
     }
 }
 
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 41c4b44..43e66a7 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -231,8 +231,6 @@ protected:
     bool m_transparent;
     bool m_usingSyncProtocol;
     bool m_deferredActivation;
-    bool m_deferredExpose;
-    bool m_configureNotifyPending;
     bool m_embedded;
     bool m_alertState;
     xcb_window_t m_netWmUserTimeWindow;
-- 
2.6.2