Skip to content

Commit

Permalink
fix(server): constify functions
Browse files Browse the repository at this point in the history
Some functions in xdg-foreign implementation can be made const. This fixes some
clang-tidy warnings that have been slient for unknown reason in the past but
with later changes suddenly trigger.
  • Loading branch information
romangg committed Mar 20, 2023
1 parent ea40d25 commit 952fb8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions server/xdg_foreign_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const struct zxdg_exporter_v2_interface XdgExporterV2::Private::s_interface = {
cb<exportToplevelCallback>,
};

XdgExportedV2* XdgExporterV2::exportedSurface(QString const& handle)
XdgExportedV2* XdgExporterV2::exportedSurface(QString const& handle) const
{
auto it = d_ptr->exportedSurfaces.constFind(handle);
if (it != d_ptr->exportedSurfaces.constEnd()) {
Expand Down Expand Up @@ -205,12 +205,12 @@ XdgImporterV2::~XdgImporterV2()
delete d_ptr;
}

void XdgImporterV2::setExporter(XdgExporterV2* exporter)
void XdgImporterV2::setExporter(XdgExporterV2* exporter) const
{
d_ptr->exporter = exporter;
}

Surface* XdgImporterV2::parentOf(Surface* surface)
Surface* XdgImporterV2::parentOf(Surface* surface) const
{
if (!d_ptr->parents.contains(surface)) {
return nullptr;
Expand Down
6 changes: 3 additions & 3 deletions server/xdg_foreign_v2_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Q_DECL_HIDDEN XdgExporterV2 : public QObject
explicit XdgExporterV2(Display* display);
~XdgExporterV2() override;

XdgExportedV2* exportedSurface(QString const& handle);
XdgExportedV2* exportedSurface(QString const& handle) const;

private:
class Private;
Expand All @@ -60,9 +60,9 @@ class Q_DECL_HIDDEN XdgImporterV2 : public QObject
public:
explicit XdgImporterV2(Display* display);
~XdgImporterV2() override;
void setExporter(XdgExporterV2* exporter);
void setExporter(XdgExporterV2* exporter) const;

Surface* parentOf(Surface* surface);
Surface* parentOf(Surface* surface) const;

Q_SIGNALS:
void parentChanged(Wrapland::Server::Surface* parent, Wrapland::Server::Surface* child);
Expand Down

0 comments on commit 952fb8c

Please sign in to comment.