diff --git a/src/allocator/GBM.cpp b/src/allocator/GBM.cpp index 0f7fb88..adc05c4 100644 --- a/src/allocator/GBM.cpp +++ b/src/allocator/GBM.cpp @@ -35,7 +35,7 @@ static SDRMFormat guessFormatFrom(std::vector formats, bool cursor) if (auto it = std::find_if(formats.begin(), formats.end(), [](const auto& f) { return f.drmFormat == DRM_FORMAT_XRGB8888; }); it != formats.end()) return *it; - for (auto& f : formats) { + for (auto const& f : formats) { auto name = fourccToName(f.drmFormat); /* 10 bpp RGB */ @@ -43,7 +43,7 @@ static SDRMFormat guessFormatFrom(std::vector formats, bool cursor) return f; } - for (auto& f : formats) { + for (auto const& f : formats) { auto name = fourccToName(f.drmFormat); /* 8 bpp RGB */ @@ -93,11 +93,11 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti if (!RENDERABLE.empty()) { TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Renderable has {} formats, clipping", RENDERABLE.size()))); - for (auto& f : FORMATS) { + for (auto const& f : FORMATS) { if (f.drmFormat != attrs.format) continue; - for (auto& m : f.modifiers) { + for (auto const& m : f.modifiers) { if (m == DRM_FORMAT_MOD_INVALID) continue; @@ -141,7 +141,7 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti bo = gbm_bo_create(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, flags); } else { TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Using modifier-based allocation, modifiers: {}", explicitModifiers.size()))); - for (auto& mod : explicitModifiers) { + for (auto const& mod : explicitModifiers) { TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: | mod 0x{:x}", mod))); } bo = gbm_bo_create_with_modifiers2(allocator->gbmDevice, attrs.size.x, attrs.size.y, attrs.format, explicitModifiers.data(), explicitModifiers.size(), flags); diff --git a/src/backend/Backend.cpp b/src/backend/Backend.cpp index a16657a..b78226c 100644 --- a/src/backend/Backend.cpp +++ b/src/backend/Backend.cpp @@ -67,7 +67,7 @@ Hyprutils::Memory::CSharedPointer Aquamarine::CBackend::create(const s backend->log(AQ_LOG_DEBUG, "Creating an Aquamarine backend!"); - for (auto& b : backends) { + for (auto const& b : backends) { if (b.backendType == AQ_BACKEND_WAYLAND) { auto ref = SP(new CWaylandBackend(backend)); backend->implementations.emplace_back(ref); @@ -79,7 +79,7 @@ Hyprutils::Memory::CSharedPointer Aquamarine::CBackend::create(const s continue; } - for (auto& r : ref) { + for (auto const& r : ref) { backend->implementations.emplace_back(r); } } else if (b.backendType == AQ_BACKEND_HEADLESS) { @@ -109,7 +109,7 @@ bool Aquamarine::CBackend::start() { int started = 0; auto optionsForType = [this](eBackendType type) -> SBackendImplementationOptions { - for (auto& o : implementationOptions) { + for (auto const& o : implementationOptions) { if (o.backendType == type) return o; } @@ -145,7 +145,7 @@ bool Aquamarine::CBackend::start() { }); // TODO: obviously change this when (if) we add different allocators. - for (auto& b : implementations) { + for (auto const& b : implementations) { if (b->drmFD() >= 0) { auto fd = reopenDRMNode(b->drmFD()); if (fd < 0) { @@ -162,7 +162,7 @@ bool Aquamarine::CBackend::start() { return false; ready = true; - for (auto& b : implementations) { + for (auto const& b : implementations) { b->onReady(); } @@ -180,15 +180,15 @@ void Aquamarine::CBackend::log(eBackendLogLevel level, const std::string& msg) { std::vector> Aquamarine::CBackend::getPollFDs() { std::vector> result; - for (auto& i : implementations) { + for (auto const& i : implementations) { auto pollfds = i->pollFDs(); - for (auto& p : pollfds) { + for (auto const& p : pollfds) { log(AQ_LOG_DEBUG, std::format("backend: poll fd {} for implementation {}", p->fd, backendTypeToName(i->type()))); result.emplace_back(p); } } - for (auto& sfd : sessionFDs) { + for (auto const& sfd : sessionFDs) { log(AQ_LOG_DEBUG, std::format("backend: poll fd {} for session", sfd->fd)); result.emplace_back(sfd); } @@ -200,7 +200,7 @@ std::vector> Aquamarine::CBackend::ge } int Aquamarine::CBackend::drmFD() { - for (auto& i : implementations) { + for (auto const& i : implementations) { int fd = i->drmFD(); if (fd < 0) continue; @@ -215,14 +215,14 @@ bool Aquamarine::CBackend::hasSession() { } std::vector Aquamarine::CBackend::getPrimaryRenderFormats() { - for (auto& b : implementations) { + for (auto const& b : implementations) { if (b->type() != AQ_BACKEND_DRM && b->type() != AQ_BACKEND_WAYLAND) continue; return b->getRenderFormats(); } - for (auto& b : implementations) { + for (auto const& b : implementations) { return b->getRenderFormats(); } @@ -260,7 +260,7 @@ void Aquamarine::CBackend::dispatchIdle() { auto cpy = idle.pending; idle.pending.clear(); - for (auto& i : cpy) { + for (auto const& i : cpy) { if (i && *i) (*i)(); } diff --git a/src/backend/Headless.cpp b/src/backend/Headless.cpp index 55a8617..1d6124b 100644 --- a/src/backend/Headless.cpp +++ b/src/backend/Headless.cpp @@ -149,7 +149,7 @@ void Aquamarine::CHeadlessBackend::dispatchTimers() { } } - for (auto& copy : toFire) { + for (auto const& copy : toFire) { if (copy.what) copy.what(); } @@ -162,7 +162,7 @@ void Aquamarine::CHeadlessBackend::updateTimerFD() { const auto clocknow = std::chrono::steady_clock::now(); bool any = false; - for (auto& t : timers.timers) { + for (auto const& t : timers.timers) { auto delta = std::chrono::duration_cast(t.when - clocknow).count() * 1000 /* µs -> ns */; if (delta < lowestNs) diff --git a/src/backend/Session.cpp b/src/backend/Session.cpp index be8f4bb..6465e5d 100644 --- a/src/backend/Session.cpp +++ b/src/backend/Session.cpp @@ -264,7 +264,7 @@ static bool isDRMCard(const char* sysname) { } void Aquamarine::CSession::onReady() { - for (auto& d : libinputDevices) { + for (auto const& d : libinputDevices) { if (d->keyboard) backend->events.newKeyboard.emit(SP(d->keyboard)); if (d->mouse) @@ -278,7 +278,7 @@ void Aquamarine::CSession::onReady() { if (d->tabletPad) backend->events.newTabletPad.emit(SP(d->tabletPad)); - for (auto& t : d->tabletTools) { + for (auto const& t : d->tabletTools) { backend->events.newTabletTool.emit(SP(t)); } } @@ -306,7 +306,7 @@ void Aquamarine::CSession::dispatchUdevEvents() { dev_t deviceNum = udev_device_get_devnum(device); SP sessionDevice; - for (auto& sDev : sessionDevices) { + for (auto const& sDev : sessionDevices) { if (sDev->dev == deviceNum) { sessionDevice = sDev; break; @@ -498,7 +498,7 @@ void Aquamarine::CSession::handleLibinputEvent(libinput_event* e) { LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, }; - for (auto& axis : LAXES) { + for (auto const& axis : LAXES) { if (!libinput_event_pointer_has_axis(pe, axis)) continue; @@ -860,7 +860,7 @@ Aquamarine::CLibinputDevice::~CLibinputDevice() { } SP Aquamarine::CLibinputDevice::toolFrom(libinput_tablet_tool* tool) { - for (auto& t : tabletTools) { + for (auto const& t : tabletTools) { if (t->libinputTool == tool) return t; } diff --git a/src/backend/Wayland.cpp b/src/backend/Wayland.cpp index 9910bf3..fe2a11b 100644 --- a/src/backend/Wayland.cpp +++ b/src/backend/Wayland.cpp @@ -168,7 +168,7 @@ bool Aquamarine::CWaylandBackend::dispatchEvents() { // dispatch frames if (backend->ready) { - for (auto& f : idleCallbacks) { + for (auto const& f : idleCallbacks) { f(); } idleCallbacks.clear(); @@ -187,7 +187,7 @@ bool Aquamarine::CWaylandBackend::setCursor(Hyprutils::Memory::CSharedPointerswapchain = CSwapchain::create(backend->primaryAllocator, self.lock()); if (!o->swapchain) { backend->log(AQ_LOG_ERROR, std::format("Output {} failed: swapchain creation failed", o->name)); @@ -257,7 +257,7 @@ Aquamarine::CWaylandPointer::CWaylandPointer(SP pointer_, Hyprutils pointer->setEnter([this](CCWlPointer* r, uint32_t serial, wl_proxy* surface, wl_fixed_t x, wl_fixed_t y) { backend->lastEnterSerial = serial; - for (auto& o : backend->outputs) { + for (auto const& o : backend->outputs) { if (o->waylandState.surface->resource() != surface) continue; @@ -269,7 +269,7 @@ Aquamarine::CWaylandPointer::CWaylandPointer(SP pointer_, Hyprutils }); pointer->setLeave([this](CCWlPointer* r, uint32_t serial, wl_proxy* surface) { - for (auto& o : backend->outputs) { + for (auto const& o : backend->outputs) { if (o->waylandState.surface->resource() != surface) continue; @@ -599,7 +599,7 @@ SP Aquamarine::CWaylandOutput::getBackend() { SP Aquamarine::CWaylandOutput::wlBufferFromBuffer(SP buffer) { std::erase_if(backendState.buffers, [this](const auto& el) { return el.first.expired() || !swapchain->contains(el.first.lock()); }); - for (auto& [k, v] : backendState.buffers) { + for (auto const& [k, v] : backendState.buffers) { if (k != buffer) continue; diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 899bbec..e2d72a8 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -153,9 +153,9 @@ static std::vector> scanGPUs(SP backend) { d = canonicalFilePath.string(); } - for (auto& d : explicitDevices) { + for (auto const& d : explicitDevices) { bool found = false; - for (auto& vd : devices) { + for (auto const& vd : devices) { if (vd->path == d) { vecDevices.emplace_back(vd); found = true; @@ -169,7 +169,7 @@ static std::vector> scanGPUs(SP backend) { backend->log(AQ_LOG_ERROR, std::format("drm: Explicit device {} not found", d)); } } else { - for (auto& d : devices) { + for (auto const& d : devices) { vecDevices.push_back(d); } } @@ -219,7 +219,7 @@ std::vector> Aquamarine::CDRMBackend::attempt(SP backe std::vector> backends; SP newPrimary; - for (auto& gpu : gpus) { + for (auto const& gpu : gpus) { auto drmBackend = SP(new CDRMBackend(backend)); drmBackend->self = drmBackend; @@ -289,7 +289,7 @@ void Aquamarine::CDRMBackend::restoreAfterVT() { std::vector> noMode; - for (auto& c : connectors) { + for (auto const& c : connectors) { if (!c->crtc || !c->output) continue; @@ -342,7 +342,7 @@ void Aquamarine::CDRMBackend::restoreAfterVT() { backend->log(AQ_LOG_ERROR, std::format("drm: crtc {} failed restore", c->crtc->id)); } - for (auto& c : noMode) { + for (auto const& c : noMode) { if (!c->output) continue; @@ -525,7 +525,7 @@ bool Aquamarine::CDRMBackend::initMgpu() { void Aquamarine::CDRMBackend::buildGlFormats(const std::vector& fmts) { std::vector result; - for (auto& fmt : fmts) { + for (auto const& fmt : fmts) { if (fmt.external) continue; @@ -550,7 +550,7 @@ void Aquamarine::CDRMBackend::recheckCRTCs() { backend->log(AQ_LOG_DEBUG, "drm: Rechecking CRTCs"); std::vector> recheck, changed; - for (auto& c : connectors) { + for (auto const& c : connectors) { if (c->crtc && c->status == DRM_MODE_CONNECTED) { backend->log(AQ_LOG_DEBUG, std::format("drm: Skipping connector {}, has crtc {} and is connected", c->szName, c->crtc->id)); continue; @@ -562,7 +562,7 @@ void Aquamarine::CDRMBackend::recheckCRTCs() { for (size_t i = 0; i < crtcs.size(); ++i) { bool taken = false; - for (auto& c : connectors) { + for (auto const& c : connectors) { if (c->crtc != crtcs.at(i)) continue; @@ -580,7 +580,7 @@ void Aquamarine::CDRMBackend::recheckCRTCs() { bool assigned = false; // try to use a connected connector - for (auto& c : recheck) { + for (auto const& c : recheck) { if (!(c->possibleCrtcs & (1 << i))) continue; @@ -606,7 +606,7 @@ void Aquamarine::CDRMBackend::recheckCRTCs() { backend->log(AQ_LOG_DEBUG, std::format("drm: slot {} crtc {} unassigned", i, crtcs.at(i)->id)); } - for (auto& c : connectors) { + for (auto const& c : connectors) { if (c->status == DRM_MODE_CONNECTED) continue; @@ -615,7 +615,7 @@ void Aquamarine::CDRMBackend::recheckCRTCs() { // if any connectors get a crtc and are connected, we need to rescan to assign them outputs. bool rescan = false; - for (auto& c : changed) { + for (auto const& c : changed) { if (!c->output && c->status == DRM_MODE_CONNECTED) { rescan = true; continue; @@ -745,7 +745,7 @@ void Aquamarine::CDRMBackend::scanLeases() { return; } - for (auto& c : connectors) { + for (auto const& c : connectors) { if (!c->output || !c->output->lease) continue; @@ -767,7 +767,7 @@ void Aquamarine::CDRMBackend::scanLeases() { auto l = c->output->lease; - for (auto& c2 : connectors) { + for (auto const& c2 : connectors) { if (!c2->output || c2->output->lease != c->output->lease) continue; @@ -872,7 +872,7 @@ void Aquamarine::CDRMBackend::onReady() { } } - for (auto& c : connectors) { + for (auto const& c : connectors) { backend->log(AQ_LOG_DEBUG, std::format("drm: onReady: connector {}", c->id)); if (!c->output) continue; @@ -894,7 +894,7 @@ void Aquamarine::CDRMBackend::onReady() { } std::vector Aquamarine::CDRMBackend::getRenderFormats() { - for (auto& p : planes) { + for (auto const& p : planes) { if (p->type != DRM_PLANE_TYPE_PRIMARY) continue; @@ -909,7 +909,7 @@ std::vector Aquamarine::CDRMBackend::getRenderableFormats() { } std::vector Aquamarine::CDRMBackend::getCursorFormats() { - for (auto& p : planes) { + for (auto const& p : planes) { if (p->type != DRM_PLANE_TYPE_CURSOR) continue; @@ -1408,7 +1408,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { if (COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_FORMAT) { // verify the format is valid for the primary plane bool ok = false; - for (auto& f : getRenderFormats()) { + for (auto const& f : getRenderFormats()) { if (f.drmFormat == STATE.drmFormat) { ok = true; break; @@ -2001,7 +2001,7 @@ SP Aquamarine::CDRMLease::create(std::vector> outputs) { auto backend = ((CDRMBackend*)outputs.at(0)->getBackend().get())->self.lock(); - for (auto& o : outputs) { + for (auto const& o : outputs) { if (o->getBackend() != backend) { backend->log(AQ_LOG_ERROR, "drm lease: Mismatched backends"); return nullptr; @@ -2012,7 +2012,7 @@ SP Aquamarine::CDRMLease::create(std::vector> outputs) { auto lease = SP(new CDRMLease); - for (auto& o : outputs) { + for (auto const& o : outputs) { auto drmo = ((CDRMOutput*)o.get())->self.lock(); backend->log(AQ_LOG_DEBUG, std::format("drm lease: output {}, connector {}", drmo->name, drmo->connector->id)); @@ -2041,7 +2041,7 @@ SP Aquamarine::CDRMLease::create(std::vector> outputs) { return nullptr; } - for (auto& o : lease->outputs) { + for (auto const& o : lease->outputs) { o->lease = lease; } diff --git a/src/backend/drm/Renderer.cpp b/src/backend/drm/Renderer.cpp index 901ab8c..896f593 100644 --- a/src/backend/drm/Renderer.cpp +++ b/src/backend/drm/Renderer.cpp @@ -156,7 +156,7 @@ bool CDRMRenderer::initDRMFormats() { std::vector dmaFormats; - for (auto& fmt : formats) { + for (auto const& fmt : formats) { std::vector> mods; auto ret = getModsForFormat(fmt); @@ -170,7 +170,7 @@ bool CDRMRenderer::initDRMFormats() { // EGL can always do implicit modifiers. mods.push_back({DRM_FORMAT_MOD_INVALID, true}); - for (auto& [mod, external] : mods) { + for (auto const& [mod, external] : mods) { dmaFormats.push_back(SGLFormat{ .drmFormat = (uint32_t)fmt, .modifier = mod, @@ -179,7 +179,7 @@ bool CDRMRenderer::initDRMFormats() { } TRACE(backend->log(AQ_LOG_TRACE, std::format("EGL: GPU Supports Format {} (0x{:x})", fourccToName((uint32_t)fmt), fmt))); - for (auto& [mod, external] : mods) { + for (auto const& [mod, external] : mods) { auto modName = drmGetFormatModifierName(mod); TRACE(backend->log(AQ_LOG_TRACE, std::format("EGL: | {}with modifier 0x{:x}: {}", (external ? "external only " : ""), mod, modName ? modName : "?unknown?"))); free(modName); @@ -455,7 +455,7 @@ SGLTex CDRMRenderer::glTex(Hyprutils::Memory::CSharedPointer buffa) { } bool external = false; - for (auto& fmt : formats) { + for (auto const& fmt : formats) { if (fmt.drmFormat != dma.format || fmt.modifier != dma.modifier) continue; @@ -802,7 +802,7 @@ void CDRMRenderer::onBufferAttachmentDrop(CDRMRendererBufferAttachment* attachme } bool CDRMRenderer::verifyDestinationDMABUF(const SDMABUFAttrs& attrs) { - for (auto& fmt : formats) { + for (auto const& fmt : formats) { if (fmt.drmFormat != attrs.format) continue; diff --git a/src/backend/drm/impl/Atomic.cpp b/src/backend/drm/impl/Atomic.cpp index aa8d2e1..9803f21 100644 --- a/src/backend/drm/impl/Atomic.cpp +++ b/src/backend/drm/impl/Atomic.cpp @@ -310,16 +310,16 @@ bool Aquamarine::CDRMAtomicImpl::commit(Hyprutils::Memory::CSharedPointercrtcs) { + for (auto const& crtc : backend->crtcs) { request.add(crtc->id, crtc->props.mode_id, 0); request.add(crtc->id, crtc->props.active, 0); } - for (auto& conn : backend->connectors) { + for (auto const& conn : backend->connectors) { request.add(conn->id, conn->props.crtc_id, 0); } - for (auto& plane : backend->planes) { + for (auto const& plane : backend->planes) { request.planeProps(plane, nullptr, 0, {}); } diff --git a/src/backend/drm/impl/Legacy.cpp b/src/backend/drm/impl/Legacy.cpp index 8b887b6..87c11f6 100644 --- a/src/backend/drm/impl/Legacy.cpp +++ b/src/backend/drm/impl/Legacy.cpp @@ -153,7 +153,7 @@ bool Aquamarine::CDRMLegacyImpl::commit(Hyprutils::Memory::CSharedPointerconnectors) { + for (auto const& connector : backend->connectors) { if (!connector->crtc) continue; diff --git a/src/misc/Attachment.cpp b/src/misc/Attachment.cpp index 8a05446..a3ec392 100644 --- a/src/misc/Attachment.cpp +++ b/src/misc/Attachment.cpp @@ -5,7 +5,7 @@ using namespace Hyprutils::Memory; #define SP CSharedPointer bool Aquamarine::CAttachmentManager::has(eAttachmentType type) { - for (auto& a : attachments) { + for (auto const& a : attachments) { if (a->type() == type) return true; } @@ -13,7 +13,7 @@ bool Aquamarine::CAttachmentManager::has(eAttachmentType type) { } SP Aquamarine::CAttachmentManager::get(eAttachmentType type) { - for (auto& a : attachments) { + for (auto const& a : attachments) { if (a->type() == type) return a; } diff --git a/src/output/Output.cpp b/src/output/Output.cpp index 377dc01..e9cf176 100644 --- a/src/output/Output.cpp +++ b/src/output/Output.cpp @@ -3,7 +3,7 @@ using namespace Aquamarine; Hyprutils::Memory::CSharedPointer Aquamarine::IOutput::preferredMode() { - for (auto& m : modes) { + for (auto const& m : modes) { if (m->preferred) return m; }