summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformscreen.h
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-07 12:18:22 +0100
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-08 08:44:00 +0100
commitf0a43a9def456784fd9408e3026d6689c8b715c1 (patch)
treeea882de670519b33374b7db4d51d5128090c8cb8 /src/gui/kernel/qplatformscreen.h
parentc17a5cec1901dd23f4c39ec2ae47a060fbb06895 (diff)
Make QPlatformPlaceholderScreen a sibling of other screens
This is how the fake screen currently behaves in the xcb plugin. So if we are to deduplicate, it's probably best to match current behavior first. I still left an option for not being a virtual sibling in case other platforms don't support showing a window on a placeholder screen. Task-number: QTBUG-79711 Change-Id: I4e8b44d892efb85fdb003f1d473d0867442d7e4e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformscreen.h')
-rw-r--r--src/gui/kernel/qplatformscreen.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index e27355a940..0be7646032 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -105,7 +105,7 @@ public:
QPlatformScreen();
virtual ~QPlatformScreen();
- virtual bool isPlaceholder() const { return false; };
+ virtual bool isPlaceholder() const { return false; }
virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
@@ -176,12 +176,23 @@ private:
// Qt doesn't currently support running with no platform screen
// QPA plugins can use this class to create a fake screen
-class QPlatformPlaceholderScreen : public QPlatformScreen {
- bool isPlaceholder() const override { return true; };
+class Q_GUI_EXPORT QPlatformPlaceholderScreen : public QPlatformScreen {
+public:
+ // virtualSibling can be passed in to make the placeholder a sibling with other screens during
+ // the transitioning phase when the real screen is about to be removed, or the first real screen
+ // is about to be added. This is useful because Qt will currently recreate (but now show!)
+ // windows when they are moved from one virtual desktop to another, so if the last monitor is
+ // unplugged, then plugged in again, windows will be hidden unless the placeholder belongs to
+ // the same virtual desktop as the other screens.
+ QPlatformPlaceholderScreen(bool virtualSibling = true) : m_virtualSibling(virtualSibling) {}
+ bool isPlaceholder() const override { return true; }
QRect geometry() const override { return QRect(); }
QRect availableGeometry() const override { return QRect(); }
int depth() const override { return 32; }
QImage::Format format() const override { return QImage::Format::Format_RGB32; }
+ QList<QPlatformScreen *> virtualSiblings() const override;
+private:
+ bool m_virtualSibling = true;
};
QT_END_NAMESPACE