summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-27 12:29:52 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:33 +0200
commitc45c1e13c95426116b2b9cc945939bb0b9598079 (patch)
treeac0b71232e0899b757affa82c19f0086e2ef5098 /src/compositor/extensions
parentc9500b6eff3dc8fbcc6e9fc569b2e246541a2a05 (diff)
Make it possible to create the shell surface from qml
Diffstat (limited to 'src/compositor/extensions')
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp38
-rw-r--r--src/compositor/extensions/qwaylandshell.h10
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h2
3 files changed, 39 insertions, 11 deletions
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp
index d7f504308..29069287e 100644
--- a/src/compositor/extensions/qwaylandshell.cpp
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -42,6 +42,7 @@
#include <QtCompositor/QWaylandView>
#include <QtCompositor/QWaylandOutput>
#include <QtCompositor/QWaylandOutputSpace>
+#include <QtCompositor/QWaylandClient>
#include <QtCore/QObject>
#include <QtCore/QDebug>
@@ -66,15 +67,15 @@ void QWaylandShellPrivate::shell_get_shell_surface(Resource *resource, uint32_t
{
Q_Q(QWaylandShell);
QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res);
- QWaylandShellSurface *shell_surface = new QWaylandShellSurface(q, resource->client(), id, surface);
- emit q_func()->shellSurfaceCreated(surface, shell_surface);
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ emit q_func()->createShellSurface(surface, QWaylandClient::fromWlClient(compositor, resource->client()), id);
}
-QWaylandShellSurfacePrivate::QWaylandShellSurfacePrivate(QWaylandShell *shell, wl_client *client, uint32_t id, QWaylandSurface *surface)
+QWaylandShellSurfacePrivate::QWaylandShellSurfacePrivate()
: QWaylandExtensionTemplatePrivate()
- , wl_shell_surface(client, id, 1)
- , m_shell(shell)
- , m_surface(surface)
+ , wl_shell_surface()
+ , m_shell(Q_NULLPTR)
+ , m_surface(Q_NULLPTR)
, m_view(0)
, m_resizeGrabber(0)
, m_moveGrabber(0)
@@ -491,11 +492,32 @@ QByteArray QWaylandShell::interfaceName()
return QWaylandShellPrivate::interfaceName();
}
-QWaylandShellSurface::QWaylandShellSurface(QWaylandShell *shell, struct wl_client *client, uint32_t id, QWaylandSurface *surface)
- : QWaylandExtensionTemplate<QWaylandShellSurface>(surface, *new QWaylandShellSurfacePrivate(shell, client, id, surface))
+QWaylandShellSurface::QWaylandShellSurface()
+ : QWaylandExtensionTemplate<QWaylandShellSurface>(*new QWaylandShellSurfacePrivate)
{
+}
+
+QWaylandShellSurface::QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id)
+ : QWaylandExtensionTemplate<QWaylandShellSurface>(*new QWaylandShellSurfacePrivate)
+{
+ initialize(shell, surface, view, client, id);
+}
+
+void QWaylandShellSurface::initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id)
+{
+ Q_D(QWaylandShellSurface);
+ d->m_shell = shell;
+ d->m_surface = surface;
+ d->m_view = view;
+ d->init(client->client(), id, 1);
connect(surface, &QWaylandSurface::mappedChanged, this, &QWaylandShellSurface::mappedChanged);
connect(surface, &QWaylandSurface::offsetForNextFrame, this, &QWaylandShellSurface::adjustOffset);
+ setExtensionContainer(surface);
+ QWaylandExtension::initialize();
+}
+void QWaylandShellSurface::initialize()
+{
+ QWaylandExtensionTemplate::initialize();
}
const struct wl_interface *QWaylandShellSurface::interface()
diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h
index a44c08030..0cd510065 100644
--- a/src/compositor/extensions/qwaylandshell.h
+++ b/src/compositor/extensions/qwaylandshell.h
@@ -44,6 +44,7 @@ class QWaylandShellSurfacePrivate;
class QWaylandSurface;
class QWaylandView;
class QWaylandShellPrivate;
+class QWaylandClient;
class Q_COMPOSITOR_EXPORT QWaylandShell : public QWaylandExtensionTemplate<QWaylandShell>
{
@@ -59,7 +60,7 @@ public:
static QByteArray interfaceName();
Q_SIGNALS:
- void shellSurfaceCreated(QWaylandSurface *surface, QWaylandShellSurface *shellSurface);
+ void createShellSurface(QWaylandSurface *surface, QWaylandClient *client, uint id);
};
class Q_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandExtensionTemplate<QWaylandShellSurface>
@@ -81,7 +82,10 @@ public:
Popup
};
- QWaylandShellSurface(QWaylandShell *shell, struct wl_client *client, uint32_t id, QWaylandSurface *surface);
+ QWaylandShellSurface();
+ QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id);
+
+ Q_INVOKABLE void initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandView *view, QWaylandClient *client, uint id);
SurfaceType surfaceType() const;
@@ -111,6 +115,8 @@ Q_SIGNALS:
private Q_SLOTS:
void mappedChanged();
void adjustOffset(const QPoint &p);
+private:
+ void initialize();
};
#endif /*QWAYLANDSHELL_H*/
diff --git a/src/compositor/extensions/qwaylandshell_p.h b/src/compositor/extensions/qwaylandshell_p.h
index 7e2e99a84..4aeef67f4 100644
--- a/src/compositor/extensions/qwaylandshell_p.h
+++ b/src/compositor/extensions/qwaylandshell_p.h
@@ -81,7 +81,7 @@ class Q_COMPOSITOR_EXPORT QWaylandShellSurfacePrivate
{
Q_DECLARE_PUBLIC(QWaylandShellSurface)
public:
- QWaylandShellSurfacePrivate(QWaylandShell *shell, struct wl_client *client, uint32_t id, QWaylandSurface *surface);
+ QWaylandShellSurfacePrivate();
~QWaylandShellSurfacePrivate();
static QWaylandShellSurfacePrivate *get(QWaylandShellSurface *surface) { return surface->d_func(); }