diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-08-17 13:20:04 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-09-11 13:49:48 +0000 |
commit | 8828bf4dbeb90e479b3b461905f974774d6e20a4 (patch) | |
tree | 457b1904b1de1bd57b2d83a4da5006836725a2e4 /src/client/qwaylandwindow_p.h | |
parent | 3f400e31fecd1c0436ad17d1be1dae7745c6a4f5 (diff) |
Set window screen from wl_surface.enter and leave events
Removes the pointer mScreen, which would previously cause a crash if the screen
was removed.
Ensures that QWindow::screen() is correct, except in the cases where:
- The compositor has not yet sent enter and leave events (in which case the
primary output is returned).
- The compositor is not sending enter and leave events (although this is
mandatory, some compositors don't do this).
- The application developer has tried to move the window with
QWindow::setScreen(QScreen *). Since there is no way for a client to ask to
be moved to a specific monitor in windowed mode, we return the requested
screen until a new enter or leave event is received.
This will also be useful when implementing/fixing features where the current
screen matters. Examples are QT_AUTO_SCREEN_SCALE_FACTOR and the optional
output parameter to wl_shell_surface.set_fullscreen.
Task-number: QTBUG-62044
Change-Id: Iafde2e278fbc8876e8dafe5b2a4d2482fdc7961a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow_p.h')
-rw-r--r-- | src/client/qwaylandwindow_p.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index e7b9e3d38..bd4a35909 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -142,7 +142,7 @@ public: QWaylandDisplay *display() const { return mDisplay; } QWaylandShellSurface *shellSurface() const; QWaylandSubSurface *subSurfaceWindow() const; - QWaylandScreen *screen() const { return mScreen; } + QWaylandScreen *screen() const; void handleContentOrientationChange(Qt::ScreenOrientation orientation) override; void setOrientationMask(Qt::ScreenOrientations mask); @@ -209,7 +209,10 @@ public slots: void requestResize(); protected: - QWaylandScreen *mScreen; + void surface_enter(struct ::wl_output *output) override; + void surface_leave(struct ::wl_output *output) override; + + QVector<QWaylandScreen *> mScreens; //As seen by wl_surface.enter/leave events. Chronological order. QWaylandDisplay *mDisplay; QWaylandShellSurface *mShellSurface; QWaylandSubSurface *mSubSurfaceWindow; @@ -244,6 +247,9 @@ protected: QWaylandShmBackingStore *mBackingStore; +private slots: + void handleScreenRemoved(QScreen *qScreen); + private: bool setWindowStateInternal(Qt::WindowState flags); void setGeometry_helper(const QRect &rect); @@ -254,6 +260,7 @@ private: void reset(); void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); + QWaylandScreen *calculateScreenFromSurfaceEvents() const; void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); |