summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbwindow.h
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-03-20 17:30:26 +0100
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-04-14 15:12:30 +0000
commit4e1b09fa8ff1a9ab42c0a29a2efe1ae7f4700d71 (patch)
tree67c75c66f6ba4b236943b254717221b959f09997 /src/plugins/platforms/xcb/qxcbwindow.h
parenta02c04a51b34fc780fa680383f2aee3b3f37fa51 (diff)
Keep screen geometries from overlapping
The simple mapping of dividing each position by the devicePixelRatio does not work when screens have different DPR. If the low-DPR screen above or to the left of the high-DPR screen, the geometries will overlap in the Qt coordinate system. This change introduces a new mapping where the origin of each screen does not move. This mapping is not perfect: it will have gaps between contiguous screens. However, it will keep non-overlapping screens non-overlapping in the Qt coordinate system. Since there is no longer a simple linear coordinate transform, we have to add screen-dependent mapping functions, and distinguish between local and non-local coordinates. A side benefit is that the code is now easier to read, since we remove most manual coordinate transformation. We also have to cache the screen of each window: since we send resize events before screen change events, we cannot rely on QPlatformWindow::screen() (which is set from the screen change event). Task-number: QTBUG-45076 Change-Id: Ie95a0b71ae274e02903caa102a98af2050a44129 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.h')
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index c08408a1ca..fbf3cfe172 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -155,7 +155,7 @@ public:
virtual void create();
virtual void destroy();
void maybeSetScreen(QXcbScreen *screen);
- QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const;
+ QXcbScreen *screenForNativeGeometry(const QRect &newGeometry) const;
public Q_SLOTS:
void updateSyncRequestCounter();
@@ -165,6 +165,12 @@ protected:
virtual void *createVisual() { return Q_NULLPTR; }
virtual bool supportsSyncProtocol() { return !window()->supportsOpenGL(); }
+ QPoint mapToNative(const QPoint &pos, const QXcbScreen *screen) const;
+ QPoint mapFromNative(const QPoint &pos, const QXcbScreen *screen) const;
+ QRect mapToNative(const QRect &rect, const QXcbScreen *screen) const;
+ QRect mapFromNative(const QRect &rect, const QXcbScreen *screen) const;
+ QXcbScreen *parentScreen();
+
void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0);
NetWmStates netWmStates();
void setNetWmStates(NetWmStates);
@@ -192,6 +198,8 @@ protected:
xcb_window_t m_window;
+ QXcbScreen *m_xcbScreen;
+
uint m_depth;
QImage::Format m_imageFormat;
bool m_imageRgbSwap;