Skip to content

Commit

Permalink
Rename LayerSurface::role to LayerSurface::scope
Browse files Browse the repository at this point in the history
This makes the API much clear.
  • Loading branch information
plfiorini committed Jan 17, 2024
1 parent 87bf450 commit 6900f0f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/interfaces/layersurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,26 @@ void LayerSurface::setLayer(LayerSurface::Layer layer)
Q_EMIT layerChanged(d->layer);
}

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

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

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

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

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

LayerSurface::Anchors LayerSurface::anchors() const
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/layersurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LIRIQTSHELLINTEGRATION_EXPORT LayerSurface : public QObject
Q_DECLARE_PRIVATE(LayerSurface)
Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
Q_PROPERTY(Liri::QtShellIntegration::LayerSurface::Layer layer READ layer WRITE setLayer NOTIFY layerChanged)
Q_PROPERTY(QString role READ role WRITE setRole NOTIFY roleChanged)
Q_PROPERTY(QString scope READ scope WRITE setScope NOTIFY scopeChanged)
Q_PROPERTY(Liri::QtShellIntegration::LayerSurface::Anchors anchors READ anchors WRITE setAnchors NOTIFY anchorsChanged)
Q_PROPERTY(qint32 exclusiveZone READ exclusiveZone WRITE setExclusiveZone NOTIFY exclusiveZoneChanged)
Q_PROPERTY(QMargins margins READ margins NOTIFY marginsChanged)
Expand Down Expand Up @@ -66,8 +66,8 @@ class LIRIQTSHELLINTEGRATION_EXPORT LayerSurface : public QObject
LayerSurface::Layer layer() const;
void setLayer(LayerSurface::Layer layer);

QString role() const;
void setRole(const QString &role);
QString scope() const;
void setScope(const QString &scope);

LayerSurface::Anchors anchors() const;
void setAnchors(LayerSurface::Anchors anchors);
Expand Down Expand Up @@ -103,7 +103,7 @@ class LIRIQTSHELLINTEGRATION_EXPORT LayerSurface : public QObject
Q_SIGNALS:
void windowChanged(QWindow *window);
void layerChanged(LayerSurface::Layer layer);
void roleChanged(const QString &role);
void scopeChanged(const QString &scope);
void anchorsChanged(LayerSurface::Anchors anchors);
void exclusiveZoneChanged(qint32 exclusiveZone);
void marginsChanged(const QMargins &margins);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/layersurface_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LayerSurfacePrivate
bool setLayerEnabled = false;
QWindow *window = nullptr;
LayerSurface::Layer layer = LayerSurface::TopLayer;
QString role = QStringLiteral("unknown");
QString scope = QStringLiteral("unknown");
LayerSurface::Anchors anchors;
qint32 exclusiveZone = 0;
QMargins margins;
Expand Down
4 changes: 2 additions & 2 deletions src/shell-integrations/layer-shell/qwaylandlayersurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
qCWarning(lcQpaWayland) << "Cannot find LayerSurface interface on window" << window->window();
return;
}
qCDebug(lcQpaWayland) << "Creating layer surface with namespace" << interface->role();
qCDebug(lcQpaWayland) << "Creating layer surface with scope" << interface->scope();

// Initialize layer surface
auto *wlSurface = window->waylandSurface()->object();
auto *wlOutput = !window->waylandScreen() || window->waylandScreen()->isPlaceholder()
? nullptr : window->waylandScreen()->output();
auto layer = static_cast<uint32_t>(interface->layer());
init(shell->get_layer_surface(wlSurface, wlOutput, layer, interface->role()));
init(shell->get_layer_surface(wlSurface, wlOutput, layer, interface->scope()));

// Enable changing the layer after initialization
interface->setLayerEnabled(zwlr_layer_surface_v1_get_version(object()) >= ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION);
Expand Down

0 comments on commit 6900f0f

Please sign in to comment.