From 2f102e7544ef54e6a45a1c0b12bf7970d8cc2f2b Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 22 Mar 2021 18:00:10 +0200 Subject: [PATCH] Fix various minor coding style issues This fixes various coding style issues, e.g. wrong variable name capitalization, wrong brace placement, etc. --- src/wayland/xdgforeign_v2_interface.cpp | 113 ++++++++++++------------ 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/src/wayland/xdgforeign_v2_interface.cpp b/src/wayland/xdgforeign_v2_interface.cpp index 330b4735d8..a7fb299f73 100644 --- a/src/wayland/xdgforeign_v2_interface.cpp +++ b/src/wayland/xdgforeign_v2_interface.cpp @@ -7,7 +7,6 @@ #include "xdgforeign_v2_interface_p.h" #include "display.h" - #include namespace KWaylandServer @@ -65,32 +64,33 @@ void XdgExporterV2Interface::zxdg_exporter_v2_destroy(Resource *resource) wl_resource_destroy(resource->handle); } -void XdgExporterV2Interface::zxdg_exporter_v2_export_toplevel(Resource *resource, uint32_t id, wl_resource *surface) +void XdgExporterV2Interface::zxdg_exporter_v2_export_toplevel(Resource *resource, uint32_t id, + wl_resource *surface_resource) { - SurfaceInterface *s = SurfaceInterface::get(surface); - if (!s) { + SurfaceInterface *surface = SurfaceInterface::get(surface_resource); + if (!surface) { wl_resource_post_error(resource->handle, 0, "Invalid surface"); return; } - wl_resource *XdgExported_resource = wl_resource_create(resource->client(), &zxdg_exported_v2_interface, resource->version(), id); - if (!XdgExported_resource) { + wl_resource *exportedResource = wl_resource_create(resource->client(), + &zxdg_exported_v2_interface, + resource->version(), id); + if (!exportedResource) { wl_client_post_no_memory(resource->client()); return; } - - XdgExportedV2Interface * xdgExported = new XdgExportedV2Interface(s, XdgExported_resource); + XdgExportedV2Interface *exported = new XdgExportedV2Interface(surface, exportedResource); const QString handle = QUuid::createUuid().toString(); - //a surface not exported anymore - QObject::connect(xdgExported, &XdgExportedV2Interface::destroyed, - this, [this, handle]() { - m_exportedSurfaces.remove(handle); - }); + // a surface not exported anymore + connect(exported, &XdgExportedV2Interface::destroyed, this, [this, handle]() { + m_exportedSurfaces.remove(handle); + }); - m_exportedSurfaces[handle] = xdgExported; - zxdg_exported_v2_send_handle(XdgExported_resource, handle.toUtf8().constData()); + m_exportedSurfaces[handle] = exported; + zxdg_exported_v2_send_handle(exportedResource, handle.toUtf8().constData()); } XdgImporterV2Interface::XdgImporterV2Interface(Display *display, XdgForeignV2Interface *foreign) @@ -125,62 +125,61 @@ void XdgImporterV2Interface::zxdg_importer_v2_destroy(Resource *resource) void XdgImporterV2Interface::zxdg_importer_v2_import_toplevel(Resource *resource, uint32_t id, const QString &handle) { - XdgExportedV2Interface *exp = m_foreign->d->exporter->exportedSurface(handle); - if (!exp) { + XdgExportedV2Interface *exported = m_foreign->d->exporter->exportedSurface(handle); + if (!exported) { zxdg_imported_v2_send_destroyed(resource->handle); return; } - wl_resource *XdgImported_resource = wl_resource_create(resource->client(), &zxdg_imported_v2_interface, resource->version(), id); - if (!XdgImported_resource) { + wl_resource *importedResource = wl_resource_create(resource->client(), + &zxdg_imported_v2_interface, + resource->version(), id); + if (!importedResource) { wl_client_post_no_memory(resource->client()); return; } - XdgImportedV2Interface * XdgImported = new XdgImportedV2Interface(exp, XdgImported_resource); + XdgImportedV2Interface *imported = new XdgImportedV2Interface(exported, importedResource); - QObject::connect(XdgImported, &XdgImportedV2Interface::childChanged, - this, [this, XdgImported](SurfaceInterface *child) { - //remove any previous association - auto it = m_children.find(XdgImported); - if (it != m_children.end()) { - m_parents.remove(*it); - m_children.erase(it); - } + connect(imported, &XdgImportedV2Interface::childChanged, this, [this, imported](SurfaceInterface *child) { + // remove any previous association + auto it = m_children.find(imported); + if (it != m_children.end()) { + m_parents.remove(*it); + m_children.erase(it); + } - m_parents[child] = XdgImported; - m_children[XdgImported] = child; - SurfaceInterface *parent = XdgImported->surface(); - emit transientChanged(child, parent); + m_parents[child] = imported; + m_children[imported] = child; + SurfaceInterface *parent = imported->surface(); + emit transientChanged(child, parent); - //child surface destroyed - QObject::connect(child, &QObject::destroyed, - this, [this, child]() { - auto it = m_parents.find(child); - if (it != m_parents.end()) { - KWaylandServer::XdgImportedV2Interface* parent = *it; - m_children.remove(*it); - m_parents.erase(it); - emit transientChanged(nullptr, parent->surface()); - } - }); - }); + // child surface destroyed + connect(child, &QObject::destroyed, this, [this, child]() { + auto it = m_parents.find(child); + if (it != m_parents.end()) { + XdgImportedV2Interface *parent = *it; + m_children.remove(*it); + m_parents.erase(it); + emit transientChanged(nullptr, parent->surface()); + } + }); + }); - //surface no longer imported - QObject::connect(XdgImported, &XdgImportedV2Interface::destroyed, - this, [this, handle, XdgImported]() { - m_importedSurfaces.remove(handle); + // surface no longer imported + connect(imported, &XdgImportedV2Interface::destroyed, this, [this, handle, imported]() { + m_importedSurfaces.remove(handle); - auto it = m_children.find(XdgImported); - if (it != m_children.end()) { - KWaylandServer::SurfaceInterface* child = *it; - m_parents.remove(*it); - m_children.erase(it); - emit transientChanged(child, nullptr); - } - }); + auto it = m_children.find(imported); + if (it != m_children.end()) { + SurfaceInterface *child = *it; + m_parents.remove(*it); + m_children.erase(it); + emit transientChanged(child, nullptr); + } + }); - m_importedSurfaces[handle] = XdgImported; + m_importedSurfaces[handle] = imported; } XdgExportedV2Interface::XdgExportedV2Interface(SurfaceInterface *surface, wl_resource *resource )