qt5-qtbase/0011-xcb-Don-t-cache-the-screen-for-a-window.patch

117 lines
4.8 KiB
Diff

From 0c33a823c560bdf18a513ae460eea4d7bdf9e115 Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Tue, 24 Nov 2015 15:09:41 +0300
Subject: [PATCH 11/12] xcb: Don't cache the screen for a window
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
QXcbWindow::m_xcbScreen was introduced in 4e1b09fa8ff1a9ab42c0a29a2efe1ae7f4700d71
(Keep screen geometries from overlapping) to map the window
geometry for the right screen, because it wasn't possible to
rely on QPlatformWindow::screen().
But we don't need it since a705b4ec1f6f7133390054f8b6b8077ef0550311
(Introduce cross platform high-dpi scaling), because QGuiApplication
triggers GeometryChangeEvent right after processing WindowScreenChangedEvent.
So just use QPlatformWindow::screen() instead of cached m_xcbScreen.
m_xcbScreen was also used in d4bc56cb4218f6f8378f04c23865156b349b037d
(Fix screen detection on configureNotify) to compare the new screen
after receiving ConfigureNotify to the correct old screen. Just send
WindowScreenChangedEvent event and leave making the comparison to
QGuiApplication.
Change-Id: Ibe717ae4bf4c40b0a04cd62fe2ecaee5df5f4060
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
---
src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++----------
src/plugins/platforms/xcb/qxcbwindow.h | 2 --
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 98bcc62..6add0a6 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -143,7 +143,7 @@ const quint32 XEMBED_VERSION = 0;
QXcbScreen *QXcbWindow::parentScreen()
{
- return parent() ? static_cast<QXcbWindow*>(parent())->parentScreen() : m_xcbScreen;
+ return parent() ? static_cast<QXcbWindow*>(parent())->parentScreen() : xcbScreen();
}
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
@@ -266,7 +266,6 @@ static const char *wm_window_type_property_id = "_q_xcb_wm_window_type";
QXcbWindow::QXcbWindow(QWindow *window)
: QPlatformWindow(window)
, m_window(0)
- , m_xcbScreen(0)
, m_syncCounter(0)
, m_gravity(XCB_GRAVITY_STATIC)
, m_mapped(false)
@@ -322,7 +321,6 @@ void QXcbWindow::create()
QRect rect = windowGeometry();
QXcbScreen *platformScreen = parent() ? parentScreen() : static_cast<QXcbScreen*>(screenForGeometry(rect));
- m_xcbScreen = platformScreen;
if (type == Qt::Desktop) {
m_window = platformScreen->root();
m_depth = platformScreen->screen()->root_depth;
@@ -638,13 +636,12 @@ void QXcbWindow::setGeometry(const QRect &rect)
propagateSizeHints();
- QXcbScreen *currentScreen = m_xcbScreen;
+ QXcbScreen *currentScreen = xcbScreen();
QXcbScreen *newScreen = parent() ? parentScreen() : static_cast<QXcbScreen*>(screenForGeometry(rect));
if (!newScreen)
newScreen = xcbScreen();
- m_xcbScreen = newScreen;
const QRect wmGeometry = windowToWmGeometry(rect);
if (newScreen && newScreen != currentScreen)
@@ -2013,9 +2010,6 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
const QRect actualGeometry = QRect(pos, QSize(event->width, event->height));
QPlatformScreen *newScreen = parent() ? parent()->screen() : screenForGeometry(actualGeometry);
-
- QXcbScreen *currentScreen = m_xcbScreen;
- m_xcbScreen = static_cast<QXcbScreen*>(newScreen);
if (!newScreen)
return;
@@ -2032,8 +2026,10 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
QWindowSystemInterface::handleGeometryChange(window(), actualGeometry,
requestedGeometry != actualGeometry ? requestedGeometry : QRect());
- if (newScreen != currentScreen)
- QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
+ // QPlatformScreen::screen() is updated asynchronously, so we can't compare it
+ // with the newScreen. Just send the WindowScreenChanged event and QGuiApplication
+ // will make the comparison later.
+ QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
// For expose events we have no way of telling QGuiApplication to used the locally
// cached version of the previous state, so we may in some situations end up with
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 43e66a7..0d14673 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -214,8 +214,6 @@ protected:
xcb_window_t m_window;
- QXcbScreen *m_xcbScreen;
-
uint m_depth;
QImage::Format m_imageFormat;
bool m_imageRgbSwap;
--
2.5.0