summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-03-18 16:36:34 +0100
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-03-20 13:00:08 +0000
commit08f268ba22ddb129ab0bb29cef7494be067d8dfc (patch)
tree989577a8c874a0934dc02c11c1ce0baeacd132db /src/plugins
parentd425563bac3d44eb360027f49622c29b8b4e84f5 (diff)
Proper screen change handling for devicePixelRatio
We need to make sure that we know which screen we are on, and use the correct devicePixelRatio, depending on the screen. Task-number: QTBUG-45076 Change-Id: Ic56ad4ca8a807d584ce4938b64905ce4dd10f7aa Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 41b24e302f..78ccf8a3e9 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -318,6 +318,12 @@ void QXcbWindow::create()
// currently no way to implement it for frame-exclusive geometries.
QRect rect = window()->geometry();
QPlatformWindow::setGeometry(rect);
+ QXcbScreen *currentScreen = xcbScreen();
+ QPlatformScreen *newScreen = screenForGeometry(rect);
+
+ if (newScreen != currentScreen)
+ QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
+
const int dpr = int(devicePixelRatio());
QSize minimumSize = window()->minimumSize();
@@ -582,9 +588,18 @@ void QXcbWindow::setGeometry(const QRect &rect)
propagateSizeHints();
- const QRect xRect = mapToNative(rect, int(devicePixelRatio()));
+ QXcbScreen *currentScreen = xcbScreen();
+ QPlatformScreen *newScreen = screenForGeometry(rect);
+ if (!newScreen)
+ newScreen = currentScreen;
+
+ const QRect xRect = mapToNative(rect, int(newScreen->devicePixelRatio()));
const QRect wmGeometry = windowToWmGeometry(xRect);
+
+ if (newScreen != currentScreen)
+ QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
+
if (qt_window_private(window())->positionAutomatic) {
const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
const qint32 values[] = {
@@ -1858,7 +1873,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
if (newScreen != screen()) {
if (newScreen)
QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen());
- int newDpr = devicePixelRatio();
+ int newDpr = newScreen->devicePixelRatio();
if (newDpr != dpr) {
QRect newRect = mapGeometryFromNative(nativeRect, newDpr);
QPlatformWindow::setGeometry(newRect);