Skip to content

Commit

Permalink
Rename interfaces
Browse files Browse the repository at this point in the history
Remove Ext and Wlr prefix from the API to make it look nicer.
  • Loading branch information
plfiorini committed Jan 17, 2024
1 parent 39cd9e7 commit 87bf450
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 145 deletions.
4 changes: 2 additions & 2 deletions src/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ liri_add_module(QtShellIntegration
DESCRIPTION
"Integration between Wayland shells and Qt applications"
SOURCES
extsessionlocksurface.cpp extsessionlocksurface.h
wlrlayersurface.cpp wlrlayersurface.h wlrlayersurface_p.h
sessionlocksurface.cpp sessionlocksurface.h
layersurface.cpp layersurface.h layersurface_p.h
PUBLIC_LIBRARIES
Qt6::Core
Qt6::Gui
Expand Down
10 changes: 5 additions & 5 deletions src/interfaces/declarative/qtshellintegrationplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <QQmlExtensionPlugin>
#include <QtQml>

#include "../extsessionlocksurface.h"
#include "../wlrlayersurface.h"
#include "../sessionlocksurface.h"
#include "../layersurface.h"

QML_DECLARE_TYPEINFO(Liri::QtShellIntegration::WlrLayerSurface, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPEINFO(Liri::QtShellIntegration::LayerSurface, QML_HAS_ATTACHED_PROPERTIES)

class Plugin : public QQmlExtensionPlugin
{
Expand All @@ -17,8 +17,8 @@ class Plugin : public QQmlExtensionPlugin
void registerTypes(const char *uri) override {
Q_ASSERT(QLatin1String(uri) == QLatin1String("Liri.QtShellIntegration"));

qmlRegisterType<Liri::QtShellIntegration::ExtSessionLockSurface>(uri, 1, 0, "ExtSessionLockSurface");
qmlRegisterType<Liri::QtShellIntegration::WlrLayerSurface>(uri, 1, 0, "WlrLayerSurface");
qmlRegisterType<Liri::QtShellIntegration::SessionLockSurface>(uri, 1, 0, "SessionLockSurface");
qmlRegisterType<Liri::QtShellIntegration::LayerSurface>(uri, 1, 0, "LayerSurface");
}
};

Expand Down
124 changes: 62 additions & 62 deletions src/interfaces/wlrlayersurface.cpp → src/interfaces/layersurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@

#include <QHash>

#include "wlrlayersurface_p.h"
#include "layersurface_p.h"
#include "qtshellintegrationlogging.h"
#include "wlrlayersurface.h"
#include "layersurface.h"

namespace Liri {

namespace QtShellIntegration {

// Both shell integration and QML plugins will share this global
// since the interface is in a dynamic library
typedef QHash<QWindow *, WlrLayerSurface *> WlrLayerSurfaceMap;
Q_GLOBAL_STATIC(WlrLayerSurfaceMap, globalLayerSurfaces)
typedef QHash<QWindow *, LayerSurface *> LayerSurfaceMap;
Q_GLOBAL_STATIC(LayerSurfaceMap, globalLayerSurfaces)

WlrLayerSurface::WlrLayerSurface(QObject *parent)
LayerSurface::LayerSurface(QObject *parent)
: QObject(parent)
, d_ptr(new WlrLayerSurfacePrivate())
, d_ptr(new LayerSurfacePrivate())
{
}

WlrLayerSurface::~WlrLayerSurface()
LayerSurface::~LayerSurface()
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);
globalLayerSurfaces->remove(d->window);
}

bool WlrLayerSurface::isInitialized() const
bool LayerSurface::isInitialized() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->initialized;
}

QWindow *WlrLayerSurface::window() const
QWindow *LayerSurface::window() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->window;
}

void WlrLayerSurface::setWindow(QWindow *window)
void LayerSurface::setWindow(QWindow *window)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->window == window)
return;

if (d->initialized) {
qCWarning(lcQtShellIntegration, "Unable to change WlrLayerSurface::window after initialization");
qCWarning(lcQtShellIntegration, "Unable to change LayerSurface::window after initialization");
return;
}

Expand All @@ -59,59 +59,59 @@ void WlrLayerSurface::setWindow(QWindow *window)
globalLayerSurfaces->insert(d->window, this);
}

WlrLayerSurface::Layer WlrLayerSurface::layer() const
LayerSurface::Layer LayerSurface::layer() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->layer;
}

void WlrLayerSurface::setLayer(WlrLayerSurface::Layer layer)
void LayerSurface::setLayer(LayerSurface::Layer layer)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->layer == layer)
return;

if (d->initialized && !d->setLayerEnabled) {
qCWarning(lcQtShellIntegration, "Unable to change WlrLayerSurface::layer after initialization");
qCWarning(lcQtShellIntegration, "Unable to change LayerSurface::layer after initialization");
return;
}

d->layer = layer;
Q_EMIT layerChanged(d->layer);
}

QString WlrLayerSurface::role() const
QString LayerSurface::role() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->role;
}

void WlrLayerSurface::setRole(const QString &role)
void LayerSurface::setRole(const QString &role)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->role == role)
return;

if (d->initialized) {
qCWarning(lcQtShellIntegration, "Unable to change WlrLayerSurface::role after initialization");
qCWarning(lcQtShellIntegration, "Unable to change LayerSurface::role after initialization");
return;
}

d->role = role;
Q_EMIT roleChanged(d->role);
}

WlrLayerSurface::Anchors WlrLayerSurface::anchors() const
LayerSurface::Anchors LayerSurface::anchors() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->anchors;
}

void WlrLayerSurface::setAnchors(WlrLayerSurface::Anchors anchors)
void LayerSurface::setAnchors(LayerSurface::Anchors anchors)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->anchors == anchors)
return;
Expand All @@ -120,15 +120,15 @@ void WlrLayerSurface::setAnchors(WlrLayerSurface::Anchors anchors)
Q_EMIT anchorsChanged(d->anchors);
}

qint32 WlrLayerSurface::exclusiveZone() const
qint32 LayerSurface::exclusiveZone() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->exclusiveZone;
}

void WlrLayerSurface::setExclusiveZone(qint32 zone)
void LayerSurface::setExclusiveZone(qint32 zone)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->exclusiveZone == zone)
return;
Expand All @@ -137,21 +137,21 @@ void WlrLayerSurface::setExclusiveZone(qint32 zone)
Q_EMIT exclusiveZoneChanged(d->exclusiveZone);
}

QMargins WlrLayerSurface::margins() const
QMargins LayerSurface::margins() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->margins;
}

qint32 WlrLayerSurface::leftMargin() const
qint32 LayerSurface::leftMargin() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->margins.left();
}

void WlrLayerSurface::setLeftMargin(qint32 margin)
void LayerSurface::setLeftMargin(qint32 margin)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->margins.left() == margin)
return;
Expand All @@ -161,15 +161,15 @@ void WlrLayerSurface::setLeftMargin(qint32 margin)
Q_EMIT marginsChanged(d->margins);
}

qint32 WlrLayerSurface::rightMargin() const
qint32 LayerSurface::rightMargin() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->margins.right();
}

void WlrLayerSurface::setRightMargin(qint32 margin)
void LayerSurface::setRightMargin(qint32 margin)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->margins.right() == margin)
return;
Expand All @@ -179,15 +179,15 @@ void WlrLayerSurface::setRightMargin(qint32 margin)
Q_EMIT marginsChanged(d->margins);
}

qint32 WlrLayerSurface::topMargin() const
qint32 LayerSurface::topMargin() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->margins.top();
}

void WlrLayerSurface::setTopMargin(qint32 margin)
void LayerSurface::setTopMargin(qint32 margin)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->margins.top() == margin)
return;
Expand All @@ -197,15 +197,15 @@ void WlrLayerSurface::setTopMargin(qint32 margin)
Q_EMIT marginsChanged(d->margins);
}

qint32 WlrLayerSurface::bottomMargin() const
qint32 LayerSurface::bottomMargin() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->margins.bottom();
}

void WlrLayerSurface::setBottomMargin(qint32 margin)
void LayerSurface::setBottomMargin(qint32 margin)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->margins.bottom() == margin)
return;
Expand All @@ -215,15 +215,15 @@ void WlrLayerSurface::setBottomMargin(qint32 margin)
Q_EMIT marginsChanged(d->margins);
}

WlrLayerSurface::KeyboardInteractivity WlrLayerSurface::keyboardInteractivity() const
LayerSurface::KeyboardInteractivity LayerSurface::keyboardInteractivity() const
{
Q_D(const WlrLayerSurface);
Q_D(const LayerSurface);
return d->keyboardInteractivity;
}

void WlrLayerSurface::setKeyboardInteractivity(WlrLayerSurface::KeyboardInteractivity keyboardInteractivity)
void LayerSurface::setKeyboardInteractivity(LayerSurface::KeyboardInteractivity keyboardInteractivity)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->keyboardInteractivity == keyboardInteractivity)
return;
Expand All @@ -232,33 +232,33 @@ void WlrLayerSurface::setKeyboardInteractivity(WlrLayerSurface::KeyboardInteract
Q_EMIT keyboardInteractivityChanged(d->keyboardInteractivity);
}

void WlrLayerSurface::initialize()
void LayerSurface::initialize()
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);

if (d->initialized)
return;

if (!d->window) {
qCWarning(lcQtShellIntegration, "Window not assigned to WlrLayerSurface, failed to initialize");
qCWarning(lcQtShellIntegration, "Window not assigned to LayerSurface, failed to initialize");
return;
}

d->initialized = true;
}

void WlrLayerSurface::setLayerEnabled(bool enabled)
void LayerSurface::setLayerEnabled(bool enabled)
{
Q_D(WlrLayerSurface);
Q_D(LayerSurface);
d->setLayerEnabled = enabled;
}

WlrLayerSurface *WlrLayerSurface::get(QWindow *window)
LayerSurface *LayerSurface::get(QWindow *window)
{
return globalLayerSurfaces->value(window, nullptr);
}

WlrLayerSurface *WlrLayerSurface::qmlAttachedProperties(QObject *object)
LayerSurface *LayerSurface::qmlAttachedProperties(QObject *object)
{
return get(qobject_cast<QWindow *>(object));
}
Expand Down
Loading

0 comments on commit 87bf450

Please sign in to comment.