diff options
author | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2013-12-04 01:31:18 +0100 |
---|---|---|
committer | Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> | 2013-12-09 15:13:17 +0100 |
commit | 845d87fdf19b01f7447216baa535993283c025d8 (patch) | |
tree | 375a1fc93d089376d2701d3704eb0972bf735d5e /src/compositor | |
parent | a8773f5263642ba2750ca94a6025806e9e78e909 (diff) | |
download | qtwayland-845d87fdf19b01f7447216baa535993283c025d8.tar.gz |
Return window type
Add a method that returns the window type from the shell surface.
While we're here, add the Transient window type.
Change-Id: Iaf0b9de1b418f6066e9e909530d4cec65e51fa38
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 7 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.h | 13 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface.cpp | 19 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlshellsurface_p.h | 11 |
4 files changed, 38 insertions, 12 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 34e851e8..8ed8bcbd 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -178,6 +178,13 @@ QWaylandSurface::WindowFlags QWaylandSurface::windowFlags() const return d->surface->extendedSurface()->windowFlags(); } +QWaylandSurface::WindowType QWaylandSurface::windowType() const +{ + Q_D(const QWaylandSurface); + if (d->surface->shellSurface()) + return d->surface->shellSurface()->windowType(); + return QWaylandSurface::None; +} QImage QWaylandSurface::image() const { diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 3aa0684b..333144a6 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -76,13 +76,14 @@ class Q_COMPOSITOR_EXPORT QWaylandSurface : public QObject Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) Q_PROPERTY(QPointF pos READ pos WRITE setPos NOTIFY posChanged) Q_PROPERTY(QWaylandSurface::WindowFlags windowFlags READ windowFlags NOTIFY windowFlagsChanged) + Q_PROPERTY(QWaylandSurface::WindowType windowType READ windowType NOTIFY windowTypeChanged) Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged) Q_PROPERTY(QString className READ className NOTIFY classNameChanged) Q_PROPERTY(QString title READ title NOTIFY titleChanged) Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask NOTIFY orientationUpdateMaskChanged) Q_PROPERTY(QWindow::Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged) - Q_ENUMS(WindowFlag) + Q_ENUMS(WindowFlag WindowType) Q_FLAGS(WindowFlag WindowFlags) public: @@ -93,6 +94,13 @@ public: }; Q_DECLARE_FLAGS(WindowFlags, WindowFlag) + enum WindowType { + None, + Toplevel, + Transient, + Popup + }; + enum Type { Invalid, Shm, @@ -121,6 +129,8 @@ public: WindowFlags windowFlags() const; + WindowType windowType() const; + QImage image() const; #ifdef QT_COMPOSITOR_WAYLAND_GL GLuint texture(QOpenGLContext *context) const; @@ -174,6 +184,7 @@ signals: void posChanged(); void windowPropertyChanged(const QString &name, const QVariant &value); void windowFlagsChanged(WindowFlags flags); + void windowTypeChanged(WindowType type); void contentOrientationChanged(); void orientationUpdateMaskChanged(); void extendedSurfaceReady(); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp index be552f79..9b61d60b 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp @@ -97,7 +97,7 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface , m_transientParent(0) , m_xOffset(0) , m_yOffset(0) - , m_windowType(None) + , m_windowType(QWaylandSurface::None) , m_popupLocation() , m_popupSerial() { @@ -170,7 +170,7 @@ void ShellSurface::setOffset(const QPointF &offset) m_yOffset = offset.y(); } -ShellSurface::WindowType ShellSurface::windowType() const +QWaylandSurface::WindowType ShellSurface::windowType() const { return m_windowType; } @@ -247,6 +247,11 @@ void ShellSurface::shell_surface_set_toplevel(Resource *resource) m_xOffset = 0; m_yOffset = 0; + if (m_windowType != QWaylandSurface::Toplevel) { + m_windowType = QWaylandSurface::Toplevel; + emit m_surface->waylandSurface()->windowTypeChanged(m_windowType); + } + if (m_surface->extendedSurface()) m_surface->extendedSurface()->setVisibility(QWindow::Windowed, false); } @@ -267,6 +272,11 @@ void ShellSurface::shell_surface_set_transient(Resource *resource, if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) surface()->setTransientInactive(true); + if (m_windowType != QWaylandSurface::Transient) { + m_windowType = QWaylandSurface::Transient; + emit m_surface->waylandSurface()->windowTypeChanged(m_windowType); + } + if (m_surface->extendedSurface()) m_surface->extendedSurface()->setVisibility(QWindow::AutomaticVisibility, false); } @@ -300,7 +310,10 @@ void ShellSurface::shell_surface_set_popup(Resource *resource, wl_resource *inpu m_transientParent = Surface::fromResource(parent)->shellSurface(); m_popupLocation = QPointF(x, y); - m_windowType = Popup; + if (m_windowType != QWaylandSurface::Popup) { + m_windowType = QWaylandSurface::Popup; + emit m_surface->waylandSurface()->windowTypeChanged(m_windowType); + } if (m_surface->extendedSurface()) m_surface->extendedSurface()->setVisibility(QWindow::AutomaticVisibility, false); diff --git a/src/compositor/wayland_wrapper/qwlshellsurface_p.h b/src/compositor/wayland_wrapper/qwlshellsurface_p.h index 9c566b7a..91042934 100644 --- a/src/compositor/wayland_wrapper/qwlshellsurface_p.h +++ b/src/compositor/wayland_wrapper/qwlshellsurface_p.h @@ -42,6 +42,7 @@ #define WLSHELLSURFACE_H #include <QtCompositor/qwaylandexport.h> +#include <QtCompositor/qwaylandsurface.h> #include <wayland-server.h> #include <QHash> @@ -84,12 +85,6 @@ private: class Q_COMPOSITOR_EXPORT ShellSurface : public QtWaylandServer::wl_shell_surface { public: - enum WindowType { - None, - Toplevel, - Popup - }; - ShellSurface(Shell *shell, struct wl_client *client, uint32_t id, Surface *surface); void sendConfigure(uint32_t edges, int32_t width, int32_t height); void ping(); @@ -104,7 +99,7 @@ public: ShellSurface *transientParent() const; void setOffset(const QPointF &offset); - WindowType windowType() const; + QWaylandSurface::WindowType windowType() const; void mapPopup(); @@ -121,7 +116,7 @@ private: int32_t m_xOffset; int32_t m_yOffset; - WindowType m_windowType; + QWaylandSurface::WindowType m_windowType; QPointF m_popupLocation; uint32_t m_popupSerial; |