Skip to content

Commit

Permalink
Add shell to shell surfaces
Browse files Browse the repository at this point in the history
Each and every shell surface now expose the shell it belongs to, so we
can find it without casting to the actual implementation.

Issue: #22
  • Loading branch information
plfiorini committed Sep 24, 2022
1 parent 729b665 commit 80a5d39
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/compositor/extensions/aurorawaylandiviapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace Compositor {
* Constructs a WaylandIviApplication object.
*/
WaylandIviApplication::WaylandIviApplication()
: WaylandCompositorExtensionTemplate<WaylandIviApplication>()
: WaylandShellTemplate<WaylandIviApplication>()
, d_ptr(new WaylandIviApplicationPrivate(this))
{
}
Expand All @@ -97,7 +97,7 @@ WaylandIviApplication::WaylandIviApplication()
* Constructs a WaylandIviApplication object for the provided \a compositor.
*/
WaylandIviApplication::WaylandIviApplication(WaylandCompositor *compositor)
: WaylandCompositorExtensionTemplate<WaylandIviApplication>(compositor)
: WaylandShellTemplate<WaylandIviApplication>(compositor)
, d_ptr(new WaylandIviApplicationPrivate(this))
{
}
Expand All @@ -112,7 +112,7 @@ WaylandIviApplication::~WaylandIviApplication()
void WaylandIviApplication::initialize()
{
Q_D(WaylandIviApplication);
WaylandCompositorExtensionTemplate::initialize();
WaylandShellTemplate::initialize();

WaylandCompositor *compositor = static_cast<WaylandCompositor *>(extensionContainer());
if (!compositor) {
Expand Down Expand Up @@ -172,7 +172,7 @@ QByteArray WaylandIviApplication::interfaceName()
*/

WaylandIviApplicationPrivate::WaylandIviApplicationPrivate(WaylandIviApplication *self)
: WaylandCompositorExtensionPrivate(self)
: WaylandShellPrivate(self)
{
}

Expand Down
3 changes: 2 additions & 1 deletion src/compositor/extensions/aurorawaylandiviapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <LiriAuroraCompositor/WaylandCompositorExtension>
#include <LiriAuroraCompositor/WaylandSurface>
#include <LiriAuroraCompositor/WaylandShell>
#include <LiriAuroraCompositor/WaylandResource>
#include <LiriAuroraCompositor/WaylandIviSurface>
#include <QtCore/QSize>
Expand All @@ -42,7 +43,7 @@ namespace Compositor {

class WaylandIviApplicationPrivate;

class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplication : public WaylandCompositorExtensionTemplate<WaylandIviApplication>
class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplication : public WaylandShellTemplate<WaylandIviApplication>
{
Q_OBJECT
Q_DECLARE_PRIVATE(WaylandIviApplication)
Expand Down
4 changes: 2 additions & 2 deletions src/compositor/extensions/aurorawaylandiviapplication_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#ifndef AURORA_COMPOSITOR_WAYLANDIVIAPPLICATION_P_H
#define AURORA_COMPOSITOR_WAYLANDIVIAPPLICATION_P_H

#include <LiriAuroraCompositor/private/aurorawaylandcompositorextension_p.h>
#include <LiriAuroraCompositor/private/aurorawaylandshell_p.h>
#include <LiriAuroraCompositor/private/aurora-server-ivi-application.h>

#include <LiriAuroraCompositor/WaylandIviApplication>
Expand All @@ -53,7 +53,7 @@ namespace Aurora {
namespace Compositor {

class LIRIAURORACOMPOSITOR_EXPORT WaylandIviApplicationPrivate
: public WaylandCompositorExtensionPrivate
: public WaylandShellPrivate
, public PrivateServer::ivi_application
{
Q_DECLARE_PUBLIC(WaylandIviApplication)
Expand Down
9 changes: 9 additions & 0 deletions src/compositor/extensions/aurorawaylandivisurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ void WaylandIviSurface::initialize(WaylandIviApplication *iviApplication, Waylan
WaylandCompositorExtension::initialize();
}

/*!
* \internal
*/
WaylandShell *WaylandIviSurface::shell() const
{
Q_D(const WaylandIviSurface);
return d->m_iviApplication;
}

/*!
* \qmlproperty WaylandSurface AuroraCompositor::IviSurface::surface
*
Expand Down
1 change: 1 addition & 0 deletions src/compositor/extensions/aurorawaylandivisurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandIviSurface : public WaylandShellSurface
Aurora::Compositor::WaylandSurface *surface,
uint iviId, const Aurora::Compositor::WaylandResource &resource);

WaylandShell *shell() const override;
WaylandSurface *surface() const;
uint iviId() const;

Expand Down
6 changes: 6 additions & 0 deletions src/compositor/extensions/aurorawaylandshellsurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ namespace Compositor {

class WaylandQuickShellIntegration;
class WaylandQuickShellSurfaceItem;
class WaylandShell;

class LIRIAURORACOMPOSITOR_EXPORT WaylandShellSurface : public WaylandCompositorExtension
{
Q_OBJECT
Q_PROPERTY(Qt::WindowType windowType READ windowType NOTIFY windowTypeChanged)
Q_PROPERTY(Aurora::Compositor::WaylandShell *shell READ shell NOTIFY shellChanged)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QML_NAMED_ELEMENT(ShellSurface)
QML_UNCREATABLE("")
Expand All @@ -54,9 +56,13 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandShellSurface : public WaylandCompositor
virtual WaylandQuickShellIntegration *createIntegration(WaylandQuickShellSurfaceItem *item) = 0;
#endif
WaylandShellSurface(WaylandObject *waylandObject) : WaylandCompositorExtension(waylandObject) {}

virtual WaylandShell *shell() const = 0;

virtual Qt::WindowType windowType() const { return Qt::WindowType::Window; }

Q_SIGNALS:
void shellChanged();
void windowTypeChanged();
};

Expand Down
3 changes: 1 addition & 2 deletions src/compositor/extensions/aurorawaylandwlrlayershellv1.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlrLayerSurfaceV1
const QString &nameSpace,
const Aurora::Compositor::WaylandResource &resource);

WaylandWlrLayerShellV1 *shell() const;
WaylandWlrLayerShellV1 *shell() const override;
WaylandSurface *surface() const;
WaylandOutput *output() const;
WaylandWlrLayerShellV1::Layer layer() const;
Expand Down Expand Up @@ -152,7 +152,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlrLayerSurfaceV1
static WaylandSurfaceRole *role();

Q_SIGNALS:
void shellChanged();
void surfaceChanged();
void layerChanged();
void sizeChanged();
Expand Down
3 changes: 1 addition & 2 deletions src/compositor/extensions/aurorawaylandwlshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandWlShellSurface : public WaylandShellSur
QString className() const;

WaylandSurface *surface() const;
WaylandWlShell *shell() const;
WaylandWlShell *shell() const override;

Qt::WindowType windowType() const override;

Expand All @@ -147,7 +147,6 @@ public Q_SLOTS:

Q_SIGNALS:
void surfaceChanged();
void shellChanged();
void titleChanged();
void classNameChanged();
void pong();
Expand Down
3 changes: 1 addition & 2 deletions src/compositor/extensions/aurorawaylandxdgshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurface : public WaylandShellSurface

Qt::WindowType windowType() const override;

WaylandXdgShell *shell() const;
WaylandXdgShell *shell() const override;
WaylandSurface *surface() const;
WaylandXdgToplevel *toplevel() const;
WaylandXdgPopup *popup() const;
Expand All @@ -126,7 +126,6 @@ class LIRIAURORACOMPOSITOR_EXPORT WaylandXdgSurface : public WaylandShellSurface
#endif

Q_SIGNALS:
void shellChanged();
void surfaceChanged();
void toplevelCreated();
void popupCreated();
Expand Down

0 comments on commit 80a5d39

Please sign in to comment.