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/extensions/qwaylandxdgshellv5.cpp | |
parent | 7c1f9e78fbc251b48a4093e9c40b64255b3b21e8 (diff) | |
download | qtwayland-20632f711e6b13b14e7beb28786b9de0f4f9e151.tar.gz |
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/extensions/qwaylandxdgshellv5.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index 0a86b9f6..80aa52e7 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. |