diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2017-01-06 10:06:17 +0100 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org> | 2017-01-19 10:27:13 +0000 |
commit | 20632f711e6b13b14e7beb28786b9de0f4f9e151 (patch) | |
tree | cc928ae636896e5c6aaf294a54be185f0a4789bf /src/compositor | |
parent | 7c1f9e78fbc251b48a4093e9c40b64255b3b21e8 (diff) |
compositor: Set windowType property for QWaylandXdgSurfaceV5
QWaylandShellSurface has a windowType property, set that instead of
keeping the window type as an internal detail.
QWaylandXdgSurfaceV5 now behaves like QWaylandWlShellSurface.
[ChangeLog][Compositor] QWaylandXdgSurfaceV5 now sets the windowType
property and behaves like other shell surface implementations.
Change-Id: Iffd91adaff7a2caab3c15b56b839ae2251cf8324
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5.cpp | 38 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5.h | 2 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5_p.h | 10 |
3 files changed, 38 insertions, 12 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index 0a86b9f6f..80aa52e70 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -225,7 +225,7 @@ QWaylandXdgSurfaceV5Private::QWaylandXdgSurfaceV5Private() , m_xdgShell(nullptr) , m_surface(nullptr) , m_parentSurface(nullptr) - , m_windowType(UnknownWindowType) + , m_windowType(Qt::WindowType::Window) , m_unsetWindowGeometry(true) , m_lastAckedConfigure({{}, QSize(0, 0), 0}) { @@ -272,6 +272,17 @@ void QWaylandXdgSurfaceV5Private::updateFallbackWindowGeometry() emit q->windowGeometryChanged(); } +void QWaylandXdgSurfaceV5Private::setWindowType(Qt::WindowType windowType) +{ + if (m_windowType == windowType) + return; + + m_windowType = windowType; + + Q_Q(QWaylandXdgSurfaceV5); + emit q->windowTypeChanged(); +} + void QWaylandXdgSurfaceV5Private::xdg_surface_destroy_resource(Resource *resource) { Q_UNUSED(resource); @@ -358,13 +369,13 @@ void QWaylandXdgSurfaceV5Private::xdg_surface_set_parent(Resource *resource, wl_ emit q->parentSurfaceChanged(); } - if (m_parentSurface && m_windowType != TransientWindowType) { + if (m_parentSurface && m_windowType != Qt::WindowType::SubWindow) { // There's a parent now, which means the surface is transient - m_windowType = TransientWindowType; + setWindowType(Qt::WindowType::SubWindow); emit q->setTransient(); - } else if (!m_parentSurface && m_windowType != TopLevelWindowType) { + } else if (!m_parentSurface && m_windowType != Qt::WindowType::Window) { // When the surface has no parent it is toplevel - m_windowType = TopLevelWindowType; + setWindowType(Qt::WindowType::Window); emit q->setTopLevel(); } } @@ -758,6 +769,23 @@ QWaylandSurface *QWaylandXdgSurfaceV5::surface() const } /*! + * \qmlproperty enum QtWaylandCompositor::XdgSurfaceV5::windowType + * + * This property holds the window type of the XdgSurfaceV5. + */ + +/*! + * \property QWaylandXdgSurfaceV5::windowType + * + * This property holds the window type of the QWaylandXdgSurfaceV5. + */ +Qt::WindowType QWaylandXdgSurfaceV5::windowType() const +{ + Q_D(const QWaylandXdgSurfaceV5); + return d->m_windowType; +} + +/*! * \qmlproperty object QtWaylandCompositor::XdgSurface::parentSurface * * This property holds the XdgSurface parent of this XdgSurface. diff --git a/src/compositor/extensions/qwaylandxdgshellv5.h b/src/compositor/extensions/qwaylandxdgshellv5.h index bcc740c7d..b465e92e6 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.h +++ b/src/compositor/extensions/qwaylandxdgshellv5.h @@ -135,6 +135,8 @@ public: Q_INVOKABLE void initialize(QWaylandXdgShellV5* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); + Qt::WindowType windowType() const override; + QString title() const; QString appId() const; QRect windowGeometry() const; diff --git a/src/compositor/extensions/qwaylandxdgshellv5_p.h b/src/compositor/extensions/qwaylandxdgshellv5_p.h index 31aa2112c..acc93e834 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5_p.h +++ b/src/compositor/extensions/qwaylandxdgshellv5_p.h @@ -99,12 +99,6 @@ public: QWaylandXdgSurfaceV5Private(); static QWaylandXdgSurfaceV5Private *get(QWaylandXdgSurfaceV5 *xdgSurface) { return xdgSurface->d_func(); } - enum WindowType { - UnknownWindowType, - TopLevelWindowType, - TransientWindowType - }; - struct ConfigureEvent { QVector<uint> states; QSize size; @@ -116,12 +110,14 @@ public: QRect calculateFallbackWindowGeometry() const; void updateFallbackWindowGeometry(); + void setWindowType(Qt::WindowType windowType); + private: QWaylandXdgShellV5 *m_xdgShell; QWaylandSurface *m_surface; QWaylandXdgSurfaceV5 *m_parentSurface; - WindowType m_windowType; + Qt::WindowType m_windowType; QString m_title; QString m_appId; |