summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-07-01 13:29:52 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-08-15 10:43:53 +0000
commitb9f0673a7928c896f44caf282c61b1080651f6b8 (patch)
treecff32cb46504cc303f519608a89fccc49ca386aa
parentf964f85dde7b847a725371da80b4860735a0aa28 (diff)
Compositor: Add windowType property to QWaylandWlShellSurface
Change-Id: I61ee336d3bc83e034faa3b0bb69b8bbeb3a139fb Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@hawaiios.org>
-rw-r--r--src/compositor/extensions/qwaylandshellsurface.h5
-rw-r--r--src/compositor/extensions/qwaylandwlshell.cpp33
-rw-r--r--src/compositor/extensions/qwaylandwlshell.h1
-rw-r--r--src/compositor/extensions/qwaylandwlshell_p.h4
-rw-r--r--src/compositor/extensions/qwaylandxdgshell.h2
5 files changed, 45 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandshellsurface.h b/src/compositor/extensions/qwaylandshellsurface.h
index 88c736d24..e8c75327c 100644
--- a/src/compositor/extensions/qwaylandshellsurface.h
+++ b/src/compositor/extensions/qwaylandshellsurface.h
@@ -49,15 +49,20 @@ class QWaylandShellSurfaceTemplatePrivate;
class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandCompositorExtension
{
Q_OBJECT
+ Q_PROPERTY(Qt::WindowType windowType READ windowType NOTIFY windowTypeChanged)
public:
#ifdef QT_WAYLAND_COMPOSITOR_QUICK
virtual QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) = 0;
#endif
QWaylandShellSurface(QWaylandObject *waylandObject) : QWaylandCompositorExtension(waylandObject) {}
+ virtual Qt::WindowType windowType() const { return Qt::WindowType::Window; }
protected:
QWaylandShellSurface(QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(dd){}
QWaylandShellSurface(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd) : QWaylandCompositorExtension(container, dd) {}
+
+Q_SIGNALS:
+ void windowTypeChanged();
};
template <typename T>
diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp
index a644e4f4d..6d11fd50e 100644
--- a/src/compositor/extensions/qwaylandwlshell.cpp
+++ b/src/compositor/extensions/qwaylandwlshell.cpp
@@ -104,6 +104,7 @@ QWaylandWlShellSurfacePrivate::QWaylandWlShellSurfacePrivate()
, m_shell(Q_NULLPTR)
, m_surface(Q_NULLPTR)
, m_focusPolicy(QWaylandWlShellSurface::DefaultFocus)
+ , m_windowType(Qt::WindowType::Window)
{
}
@@ -117,6 +118,16 @@ void QWaylandWlShellSurfacePrivate::ping(uint32_t serial)
send_ping(serial);
}
+void QWaylandWlShellSurfacePrivate::setWindowType(Qt::WindowType windowType)
+{
+ if (m_windowType == windowType)
+ return;
+ m_windowType = windowType;
+
+ Q_Q(QWaylandWlShellSurface);
+ emit q->windowTypeChanged();
+}
+
void QWaylandWlShellSurfacePrivate::shell_surface_destroy_resource(Resource *)
{
Q_Q(QWaylandWlShellSurface);
@@ -154,6 +165,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_toplevel(Resource *resourc
Q_UNUSED(resource);
Q_Q(QWaylandWlShellSurface);
setFocusPolicy(QWaylandWlShellSurface::DefaultFocus);
+ setWindowType(Qt::WindowType::Window);
emit q->setDefaultToplevel();
}
@@ -171,6 +183,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_transient(Resource *resour
flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE ? QWaylandWlShellSurface::NoKeyboardFocus
: QWaylandWlShellSurface::DefaultFocus;
setFocusPolicy(focusPolicy);
+ setWindowType(Qt::WindowType::SubWindow);
emit q->setTransient(parent_surface, QPoint(x,y), focusPolicy);
}
@@ -187,6 +200,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_fullscreen(Resource *resou
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
+ setWindowType(Qt::WindowType::Window);
emit q->setFullScreen(QWaylandWlShellSurface::FullScreenMethod(method), framerate, output);
}
@@ -199,6 +213,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_popup(Resource *resource,
setFocusPolicy(QWaylandWlShellSurface::DefaultFocus);
QWaylandSeat *input = QWaylandSeat::fromSeatResource(input_device);
QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent);
+ setWindowType(Qt::WindowType::Popup);
emit q->setPopup(input, parentSurface, QPoint(x,y));
}
@@ -212,6 +227,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_maximized(Resource *resour
QWaylandOutput *output = output_resource
? QWaylandOutput::fromResource(output_resource)
: Q_NULLPTR;
+ setWindowType(Qt::WindowType::Window);
emit q->setMaximized(output);
}
@@ -594,6 +610,23 @@ QWaylandWlShellSurface::FocusPolicy QWaylandWlShellSurface::focusPolicy() const
}
/*!
+ * \qmlproperty enum QtWaylandCompositor::WlShellSurface::windowType
+ *
+ * This property holds the window type of the WlShellSurface.
+ */
+
+/*!
+ * \property QWaylandWlShellSurface::windowType
+ *
+ * This property holds the window type of the QWaylandWlShellSurface.
+ */
+Qt::WindowType QWaylandWlShellSurface::windowType() const
+{
+ Q_D(const QWaylandWlShellSurface);
+ return d->m_windowType;
+}
+
+/*!
* \qmlproperty string QtWaylandCompositor::WlShellSurface::title
*
* This property holds the title of the WlShellSurface.
diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h
index d6f71439a..c2d40a87c 100644
--- a/src/compositor/extensions/qwaylandwlshell.h
+++ b/src/compositor/extensions/qwaylandwlshell.h
@@ -125,6 +125,7 @@ public:
QWaylandWlShell *shell() const;
FocusPolicy focusPolicy() const;
+ Qt::WindowType windowType() const override;
static const struct wl_interface *interface();
static QByteArray interfaceName();
diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h
index 3693845a9..e840a01fe 100644
--- a/src/compositor/extensions/qwaylandwlshell_p.h
+++ b/src/compositor/extensions/qwaylandwlshell_p.h
@@ -102,6 +102,9 @@ public:
m_focusPolicy = focusPolicy;
emit q->focusPolicyChanged();
}
+
+ void setWindowType(Qt::WindowType windowType);
+
private:
QWaylandWlShell *m_shell;
QWaylandSurface *m_surface;
@@ -111,6 +114,7 @@ private:
QString m_title;
QString m_className;
QWaylandWlShellSurface::FocusPolicy m_focusPolicy;
+ Qt::WindowType m_windowType;
void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h
index 29b78699f..3886f122b 100644
--- a/src/compositor/extensions/qwaylandxdgshell.h
+++ b/src/compositor/extensions/qwaylandxdgshell.h
@@ -210,6 +210,8 @@ public:
QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface,
const QPoint &position, const QWaylandResource &resource);
+ Qt::WindowType windowType() const override { return Qt::WindowType::Popup; }
+
Q_INVOKABLE void initialize(QWaylandXdgShell *shell, QWaylandSurface *surface,
QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource);