mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 21:13:48 -07:00
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
This commit is contained in:
@@ -14,7 +14,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
||||
parent = request->parent;
|
||||
requested = request->requested;
|
||||
|
||||
for (auto& m : requested) {
|
||||
for (auto const& m : requested) {
|
||||
if (!m->monitor || m->monitor->isBeingLeased) {
|
||||
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null"));
|
||||
resource->sendFinished();
|
||||
@@ -26,14 +26,14 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
||||
|
||||
LOGM(LOG, "Leasing outputs: {}", [this]() {
|
||||
std::string roll;
|
||||
for (auto& o : requested) {
|
||||
for (auto const& o : requested) {
|
||||
roll += std::format("{} ", o->monitor->szName);
|
||||
}
|
||||
return roll;
|
||||
}());
|
||||
|
||||
std::vector<SP<Aquamarine::IOutput>> outputs;
|
||||
for (auto& m : requested) {
|
||||
for (auto const& m : requested) {
|
||||
outputs.emplace_back(m->monitor->output);
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resourc
|
||||
resource->sendDrmFd(fd);
|
||||
close(fd);
|
||||
|
||||
for (auto& m : PROTO::lease->primaryDevice->offeredOutputs) {
|
||||
for (auto const& m : PROTO::lease->primaryDevice->offeredOutputs) {
|
||||
sendConnector(m.lock());
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
|
||||
}
|
||||
|
||||
CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
for (auto& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||
continue;
|
||||
|
||||
@@ -292,7 +292,7 @@ void CDRMLeaseProtocol::offer(SP<CMonitor> monitor) {
|
||||
|
||||
primaryDevice->offeredOutputs.emplace_back(monitor);
|
||||
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->sendConnector(monitor);
|
||||
m->resource->sendDone();
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ void CWLRDataOffer::sendData() {
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
for (auto& m : source->mimes()) {
|
||||
for (auto const& m : source->mimes()) {
|
||||
resource->sendOffer(m.c_str());
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
|
||||
RESOURCE->self = RESOURCE;
|
||||
device = RESOURCE;
|
||||
|
||||
for (auto& s : sources) {
|
||||
for (auto const& s : sources) {
|
||||
if (!s)
|
||||
continue;
|
||||
s->device = RESOURCE;
|
||||
|
@@ -103,7 +103,7 @@ void CFocusGrab::refocusKeyboard() {
|
||||
return;
|
||||
|
||||
SP<CWLSurfaceResource> surface = nullptr;
|
||||
for (auto& [surf, state] : m_mSurfaces) {
|
||||
for (auto const& [surf, state] : m_mSurfaces) {
|
||||
if (state->state == CFocusGrabSurfaceState::Comitted) {
|
||||
surface = surf.lock();
|
||||
break;
|
||||
|
@@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
|
||||
LOGM(LOG, "CForeignToplevelList: finished");
|
||||
});
|
||||
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||
continue;
|
||||
|
||||
@@ -112,19 +112,19 @@ bool CForeignToplevelList::good() {
|
||||
|
||||
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onMap(std::any_cast<PHLWINDOW>(data));
|
||||
}
|
||||
});
|
||||
|
||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onUnmap(std::any_cast<PHLWINDOW>(data));
|
||||
}
|
||||
});
|
||||
|
||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onTitle(std::any_cast<PHLWINDOW>(data));
|
||||
}
|
||||
});
|
||||
|
@@ -179,7 +179,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
|
||||
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
|
||||
});
|
||||
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||
continue;
|
||||
|
||||
@@ -313,42 +313,42 @@ bool CForeignToplevelWlrManager::good() {
|
||||
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onMap(PWINDOW);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onUnmap(PWINDOW);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onTitle(PWINDOW);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onNewFocus(PWINDOW);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onMoveMonitor(PWINDOW);
|
||||
}
|
||||
});
|
||||
|
||||
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||
for (auto& m : m_vManagers) {
|
||||
for (auto const& m : m_vManagers) {
|
||||
m->onFullscreen(PWINDOW);
|
||||
}
|
||||
});
|
||||
@@ -374,7 +374,7 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl
|
||||
}
|
||||
|
||||
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
|
||||
for (auto& h : m_vHandles) {
|
||||
for (auto const& h : m_vHandles) {
|
||||
if (h->res() != res)
|
||||
continue;
|
||||
|
||||
|
@@ -24,7 +24,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||
}
|
||||
|
||||
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) {
|
||||
for (auto& [k, v] : m_mAddons) {
|
||||
for (auto const& [k, v] : m_mAddons) {
|
||||
if (k == surface) {
|
||||
LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get());
|
||||
pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists");
|
||||
|
@@ -25,7 +25,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& g : PROTO::gamma->m_vGammaControllers) {
|
||||
for (auto const& g : PROTO::gamma->m_vGammaControllers) {
|
||||
if (g->pMonitor == pMonitor) {
|
||||
resource->sendFailed();
|
||||
return;
|
||||
@@ -180,7 +180,7 @@ void CGammaControlProtocol::onGetGammaControl(CZwlrGammaControlManagerV1* pMgr,
|
||||
}
|
||||
|
||||
void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) {
|
||||
for (auto& g : m_vGammaControllers) {
|
||||
for (auto const& g : m_vGammaControllers) {
|
||||
if (g->getMonitor() != pMonitor)
|
||||
continue;
|
||||
|
||||
|
@@ -54,8 +54,8 @@ void CGlobalShortcutsProtocol::destroyResource(CShortcutClient* client) {
|
||||
}
|
||||
|
||||
bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) {
|
||||
for (auto& c : m_vClients) {
|
||||
for (auto& sh : c->shortcuts) {
|
||||
for (auto const& c : m_vClients) {
|
||||
for (auto const& sh : c->shortcuts) {
|
||||
if (sh->appid == appid && sh->id == trigger) {
|
||||
return true;
|
||||
}
|
||||
@@ -66,8 +66,8 @@ bool CGlobalShortcutsProtocol::isTaken(std::string appid, std::string trigger) {
|
||||
}
|
||||
|
||||
void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::string trigger, bool pressed) {
|
||||
for (auto& c : m_vClients) {
|
||||
for (auto& sh : c->shortcuts) {
|
||||
for (auto const& c : m_vClients) {
|
||||
for (auto const& sh : c->shortcuts) {
|
||||
if (sh->appid == appid && sh->id == trigger) {
|
||||
timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
@@ -84,8 +84,8 @@ void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::s
|
||||
|
||||
std::vector<SShortcut> CGlobalShortcutsProtocol::getAllShortcuts() {
|
||||
std::vector<SShortcut> copy;
|
||||
for (auto& c : m_vClients) {
|
||||
for (auto& sh : c->shortcuts) {
|
||||
for (auto const& c : m_vClients) {
|
||||
for (auto const& sh : c->shortcuts) {
|
||||
copy.push_back(*sh);
|
||||
}
|
||||
}
|
||||
|
@@ -86,14 +86,14 @@ void CIdleNotifyProtocol::onGetNotification(CExtIdleNotifierV1* pMgr, uint32_t i
|
||||
}
|
||||
|
||||
void CIdleNotifyProtocol::onActivity() {
|
||||
for (auto& n : m_vNotifications) {
|
||||
for (auto const& n : m_vNotifications) {
|
||||
n->onActivity();
|
||||
}
|
||||
}
|
||||
|
||||
void CIdleNotifyProtocol::setInhibit(bool inhibited) {
|
||||
isInhibited = inhibited;
|
||||
for (auto& n : m_vNotifications) {
|
||||
for (auto const& n : m_vNotifications) {
|
||||
n->onActivity();
|
||||
}
|
||||
}
|
@@ -268,7 +268,7 @@ wl_client* CInputMethodV2::grabClient() {
|
||||
if (grabs.empty())
|
||||
return nullptr;
|
||||
|
||||
for (auto& gw : grabs) {
|
||||
for (auto const& gw : grabs) {
|
||||
auto g = gw.lock();
|
||||
|
||||
if (!g)
|
||||
@@ -282,7 +282,7 @@ wl_client* CInputMethodV2::grabClient() {
|
||||
|
||||
void CInputMethodV2::sendInputRectangle(const CBox& box) {
|
||||
inputRectangle = box;
|
||||
for (auto& wp : popups) {
|
||||
for (auto const& wp : popups) {
|
||||
auto p = wp.lock();
|
||||
|
||||
if (!p)
|
||||
@@ -293,7 +293,7 @@ void CInputMethodV2::sendInputRectangle(const CBox& box) {
|
||||
}
|
||||
|
||||
void CInputMethodV2::sendKey(uint32_t time, uint32_t key, wl_keyboard_key_state state) {
|
||||
for (auto& gw : grabs) {
|
||||
for (auto const& gw : grabs) {
|
||||
auto g = gw.lock();
|
||||
|
||||
if (!g)
|
||||
@@ -304,7 +304,7 @@ void CInputMethodV2::sendKey(uint32_t time, uint32_t key, wl_keyboard_key_state
|
||||
}
|
||||
|
||||
void CInputMethodV2::sendMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) {
|
||||
for (auto& gw : grabs) {
|
||||
for (auto const& gw : grabs) {
|
||||
auto g = gw.lock();
|
||||
|
||||
if (!g)
|
||||
@@ -315,7 +315,7 @@ void CInputMethodV2::sendMods(uint32_t depressed, uint32_t latched, uint32_t loc
|
||||
}
|
||||
|
||||
void CInputMethodV2::setKeyboard(SP<IKeyboard> keyboard) {
|
||||
for (auto& gw : grabs) {
|
||||
for (auto const& gw : grabs) {
|
||||
auto g = gw.lock();
|
||||
|
||||
if (!g)
|
||||
|
@@ -31,8 +31,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec
|
||||
size_t i = 0;
|
||||
|
||||
rendererTranche.indicies.clear();
|
||||
for (auto& fmt : rendererTranche.formats) {
|
||||
for (auto& mod : fmt.modifiers) {
|
||||
for (auto const& fmt : rendererTranche.formats) {
|
||||
for (auto const& mod : fmt.modifiers) {
|
||||
auto format = std::make_pair<>(fmt.drmFormat, mod);
|
||||
auto [_, inserted] = formats.insert(format);
|
||||
if (inserted) {
|
||||
@@ -53,8 +53,8 @@ CDMABUFFormatTable::CDMABUFFormatTable(SDMABUFTranche _rendererTranche, std::vec
|
||||
|
||||
for (auto& [monitor, tranche] : monitorTranches) {
|
||||
tranche.indicies.clear();
|
||||
for (auto& fmt : tranche.formats) {
|
||||
for (auto& mod : fmt.modifiers) {
|
||||
for (auto const& fmt : tranche.formats) {
|
||||
for (auto const& mod : fmt.modifiers) {
|
||||
// apparently these can implode on planes, so dont use them
|
||||
if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR)
|
||||
continue;
|
||||
@@ -270,7 +270,7 @@ bool CLinuxDMABBUFParamsResource::verify() {
|
||||
}
|
||||
|
||||
bool empty = false;
|
||||
for (auto& plane : attrs->fds) {
|
||||
for (auto const& plane : attrs->fds) {
|
||||
if (empty && plane != -1) {
|
||||
resource->error(ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT, "Gap in planes");
|
||||
return false;
|
||||
@@ -402,8 +402,8 @@ bool CLinuxDMABUFResource::good() {
|
||||
}
|
||||
|
||||
void CLinuxDMABUFResource::sendMods() {
|
||||
for (auto& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) {
|
||||
for (auto& mod : fmt.modifiers) {
|
||||
for (auto const& fmt : PROTO::linuxDma->formatTable->rendererTranche.formats) {
|
||||
for (auto const& mod : fmt.modifiers) {
|
||||
if (resource->version() < 3) {
|
||||
if (mod == DRM_FORMAT_MOD_INVALID || mod == DRM_FORMAT_MOD_LINEAR)
|
||||
resource->sendFormat(fmt.drmFormat);
|
||||
@@ -442,7 +442,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||
// this assumes there's only 1 device used for both scanout and rendering
|
||||
// also that each monitor never changes its primary plane
|
||||
|
||||
for (auto& mon : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& mon : g_pCompositor->m_vMonitors) {
|
||||
auto tranche = SDMABUFTranche{
|
||||
.device = mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
@@ -505,7 +505,7 @@ void CLinuxDMABufV1Protocol::resetFormatTable() {
|
||||
// this might be a big copy
|
||||
auto newFormatTable = std::make_unique<CDMABUFFormatTable>(formatTable->rendererTranche, formatTable->monitorTranches);
|
||||
|
||||
for (auto& feedback : m_vFeedbacks) {
|
||||
for (auto const& feedback : m_vFeedbacks) {
|
||||
feedback->resource->sendFormatTable(newFormatTable->tableFD, newFormatTable->tableSize);
|
||||
if (feedback->lastFeedbackWasScanout) {
|
||||
SP<CMonitor> mon;
|
||||
@@ -562,7 +562,7 @@ void CLinuxDMABufV1Protocol::destroyResource(CLinuxDMABuffer* resource) {
|
||||
|
||||
void CLinuxDMABufV1Protocol::updateScanoutTranche(SP<CWLSurfaceResource> surface, SP<CMonitor> pMonitor) {
|
||||
SP<CLinuxDMABUFFeedbackResource> feedbackResource;
|
||||
for (auto& f : m_vFeedbacks) {
|
||||
for (auto const& f : m_vFeedbacks) {
|
||||
if (f->surface != surface)
|
||||
continue;
|
||||
|
||||
|
@@ -60,11 +60,11 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
|
||||
uint64_t mod = DRM_FORMAT_MOD_INVALID;
|
||||
|
||||
auto fmts = g_pHyprOpenGL->getDRMFormats();
|
||||
for (auto& f : fmts) {
|
||||
for (auto const& f : fmts) {
|
||||
if (f.drmFormat != fmt)
|
||||
continue;
|
||||
|
||||
for (auto& m : f.modifiers) {
|
||||
for (auto const& m : f.modifiers) {
|
||||
if (m == DRM_FORMAT_MOD_LINEAR)
|
||||
continue;
|
||||
|
||||
@@ -100,7 +100,7 @@ CMesaDRMResource::CMesaDRMResource(SP<CWlDrm> resource_) : resource(resource_) {
|
||||
resource->sendCapabilities(WL_DRM_CAPABILITY_PRIME);
|
||||
|
||||
auto fmts = g_pHyprOpenGL->getDRMFormats();
|
||||
for (auto& fmt : fmts) {
|
||||
for (auto const& fmt : fmts) {
|
||||
resource->sendFormat(fmt.drmFormat);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re
|
||||
});
|
||||
|
||||
// send all heads at start
|
||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
||||
if (m.get() == g_pCompositor->m_pUnsafeOutput)
|
||||
continue;
|
||||
|
||||
@@ -67,7 +67,7 @@ void COutputManager::ensureMonitorSent(CMonitor* pMonitor) {
|
||||
if (pMonitor == g_pCompositor->m_pUnsafeOutput)
|
||||
return;
|
||||
|
||||
for (auto& hw : heads) {
|
||||
for (auto const& hw : heads) {
|
||||
auto h = hw.lock();
|
||||
|
||||
if (!h)
|
||||
@@ -96,7 +96,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) :
|
||||
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any d) {
|
||||
resource->sendFinished();
|
||||
|
||||
for (auto& mw : modes) {
|
||||
for (auto const& mw : modes) {
|
||||
auto m = mw.lock();
|
||||
|
||||
if (!m)
|
||||
@@ -106,7 +106,7 @@ COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, CMonitor* pMonitor_) :
|
||||
}
|
||||
|
||||
pMonitor = nullptr;
|
||||
for (auto& m : PROTO::outputManagement->m_vManagers) {
|
||||
for (auto const& m : PROTO::outputManagement->m_vManagers) {
|
||||
m->sendDone();
|
||||
}
|
||||
});
|
||||
@@ -147,7 +147,7 @@ void COutputHead::sendAllData() {
|
||||
|
||||
if (modes.empty()) {
|
||||
if (!pMonitor->output->modes.empty()) {
|
||||
for (auto& m : pMonitor->output->modes) {
|
||||
for (auto const& m : pMonitor->output->modes) {
|
||||
makeAndSendNewMode(m);
|
||||
}
|
||||
} else if (pMonitor->output->state->state().customMode) {
|
||||
@@ -158,7 +158,7 @@ void COutputHead::sendAllData() {
|
||||
|
||||
// send current mode
|
||||
if (pMonitor->m_bEnabled) {
|
||||
for (auto& mw : modes) {
|
||||
for (auto const& mw : modes) {
|
||||
auto m = mw.lock();
|
||||
|
||||
if (!m)
|
||||
@@ -189,7 +189,7 @@ void COutputHead::updateMode() {
|
||||
resource->sendAdaptiveSync(pMonitor->vrrActive ? ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED : ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_DISABLED);
|
||||
|
||||
if (pMonitor->m_bEnabled) {
|
||||
for (auto& mw : modes) {
|
||||
for (auto const& mw : modes) {
|
||||
auto m = mw.lock();
|
||||
|
||||
if (!m)
|
||||
@@ -346,7 +346,7 @@ bool COutputConfiguration::applyTestConfiguration(bool test) {
|
||||
|
||||
LOGM(LOG, "Applying configuration");
|
||||
|
||||
for (auto& headw : heads) {
|
||||
for (auto const& headw : heads) {
|
||||
auto head = headw.lock();
|
||||
|
||||
if (!head)
|
||||
@@ -577,15 +577,15 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour
|
||||
}
|
||||
|
||||
void COutputManagementProtocol::updateAllOutputs() {
|
||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||
for (auto& mgr : m_vManagers) {
|
||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
||||
for (auto const& mgr : m_vManagers) {
|
||||
mgr->ensureMonitorSent(m.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) {
|
||||
for (auto& h : m_vHeads) {
|
||||
for (auto const& h : m_vHeads) {
|
||||
if (h->resource->resource() == r)
|
||||
return h;
|
||||
}
|
||||
@@ -594,7 +594,7 @@ SP<COutputHead> COutputManagementProtocol::headFromResource(wl_resource* r) {
|
||||
}
|
||||
|
||||
SP<COutputMode> COutputManagementProtocol::modeFromResource(wl_resource* r) {
|
||||
for (auto& h : m_vModes) {
|
||||
for (auto const& h : m_vModes) {
|
||||
if (h->resource->resource() == r)
|
||||
return h;
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ void CPointerGesturesProtocol::swipeBegin(uint32_t timeMs, uint32_t fingers) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vSwipes) {
|
||||
for (auto const& sw : m_vSwipes) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -125,7 +125,7 @@ void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delt
|
||||
|
||||
const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
|
||||
|
||||
for (auto& sw : m_vSwipes) {
|
||||
for (auto const& sw : m_vSwipes) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -141,7 +141,7 @@ void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vSwipes) {
|
||||
for (auto const& sw : m_vSwipes) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -157,7 +157,7 @@ void CPointerGesturesProtocol::pinchBegin(uint32_t timeMs, uint32_t fingers) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vPinches) {
|
||||
for (auto const& sw : m_vPinches) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -171,7 +171,7 @@ void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delt
|
||||
|
||||
const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
|
||||
|
||||
for (auto& sw : m_vPinches) {
|
||||
for (auto const& sw : m_vPinches) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -187,7 +187,7 @@ void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vPinches) {
|
||||
for (auto const& sw : m_vPinches) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -203,7 +203,7 @@ void CPointerGesturesProtocol::holdBegin(uint32_t timeMs, uint32_t fingers) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vHolds) {
|
||||
for (auto const& sw : m_vHolds) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
@@ -219,7 +219,7 @@ void CPointerGesturesProtocol::holdEnd(uint32_t timeMs, bool cancelled) {
|
||||
|
||||
const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
|
||||
|
||||
for (auto& sw : m_vHolds) {
|
||||
for (auto const& sw : m_vHolds) {
|
||||
if (sw->resource->client() != FOCUSEDCLIENT)
|
||||
continue;
|
||||
|
||||
|
@@ -114,11 +114,11 @@ void CPresentationProtocol::onPresented(CMonitor* pMonitor, timespec* when, uint
|
||||
when = &now;
|
||||
}
|
||||
|
||||
for (auto& feedback : m_vFeedbacks) {
|
||||
for (auto const& feedback : m_vFeedbacks) {
|
||||
if (!feedback->surface)
|
||||
continue;
|
||||
|
||||
for (auto& data : m_vQueue) {
|
||||
for (auto const& data : m_vQueue) {
|
||||
if (!data->surface || data->surface != feedback->surface)
|
||||
continue;
|
||||
|
||||
|
@@ -38,7 +38,7 @@ void CPrimarySelectionOffer::sendData() {
|
||||
if (!source)
|
||||
return;
|
||||
|
||||
for (auto& m : source->mimes()) {
|
||||
for (auto const& m : source->mimes()) {
|
||||
resource->sendOffer(m.c_str());
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ CPrimarySelectionManager::CPrimarySelectionManager(SP<CZwpPrimarySelectionDevice
|
||||
RESOURCE->self = RESOURCE;
|
||||
device = RESOURCE;
|
||||
|
||||
for (auto& s : sources) {
|
||||
for (auto const& s : sources) {
|
||||
if (!s)
|
||||
continue;
|
||||
s->device = RESOURCE;
|
||||
@@ -272,7 +272,7 @@ void CPrimarySelectionProtocol::sendSelectionToDevice(SP<CPrimarySelectionDevice
|
||||
}
|
||||
|
||||
void CPrimarySelectionProtocol::setSelection(SP<IDataSource> source) {
|
||||
for (auto& o : m_vOffers) {
|
||||
for (auto const& o : m_vOffers) {
|
||||
if (o->source && o->source->hasDnd())
|
||||
continue;
|
||||
o->dead = true;
|
||||
@@ -321,7 +321,7 @@ void CPrimarySelectionProtocol::updateSelection() {
|
||||
}
|
||||
|
||||
void CPrimarySelectionProtocol::onPointerFocus() {
|
||||
for (auto& o : m_vOffers) {
|
||||
for (auto const& o : m_vOffers) {
|
||||
o->dead = true;
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ void CRelativePointerProtocol::sendRelativeMotion(uint64_t time, const Vector2D&
|
||||
|
||||
const auto FOCUSED = g_pSeatManager->state.pointerFocusResource->client();
|
||||
|
||||
for (auto& rp : m_vRelativePointers) {
|
||||
for (auto const& rp : m_vRelativePointers) {
|
||||
if (FOCUSED != rp->client())
|
||||
continue;
|
||||
|
||||
|
@@ -155,7 +155,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_
|
||||
lockedSWCursors = true;
|
||||
// TODO: make it per-monitor
|
||||
if (!PROTO::screencopy->m_bTimerArmed) {
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
g_pPointerManager->lockSoftwareForMonitor(m);
|
||||
}
|
||||
PROTO::screencopy->m_bTimerArmed = true;
|
||||
@@ -365,7 +365,7 @@ CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& v
|
||||
std::nullopt,
|
||||
[this](SP<CEventLoopTimer> self, void* data) {
|
||||
// TODO: make it per-monitor
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
g_pPointerManager->unlockSoftwareForMonitor(m);
|
||||
}
|
||||
m_bTimerArmed = false;
|
||||
@@ -411,7 +411,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) {
|
||||
std::vector<WP<CScreencopyFrame>> framesToRemove;
|
||||
|
||||
// share frame if correct output
|
||||
for (auto& f : m_vFramesAwaitingWrite) {
|
||||
for (auto const& f : m_vFramesAwaitingWrite) {
|
||||
if (!f->pMonitor || !f->buffer) {
|
||||
framesToRemove.push_back(f);
|
||||
continue;
|
||||
@@ -428,7 +428,7 @@ void CScreencopyProtocol::onOutputCommit(CMonitor* pMonitor) {
|
||||
framesToRemove.push_back(f);
|
||||
}
|
||||
|
||||
for (auto& f : framesToRemove) {
|
||||
for (auto const& f : framesToRemove) {
|
||||
destroyResource(f.get());
|
||||
}
|
||||
}
|
||||
|
@@ -187,7 +187,7 @@ void CSessionLockProtocol::onGetLockSurface(CExtSessionLockV1* lock, uint32_t id
|
||||
auto PMONITOR = CWLOutputResource::fromResource(output)->monitor.get();
|
||||
|
||||
SP<CSessionLock> sessionLock;
|
||||
for (auto& l : m_vLocks) {
|
||||
for (auto const& l : m_vLocks) {
|
||||
if (l->resource.get() == lock) {
|
||||
sessionLock = l;
|
||||
break;
|
||||
|
@@ -48,7 +48,7 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
|
||||
SP<CWLSurfaceResource> surf = CWLSurfaceResource::fromResource(surface);
|
||||
const auto CLIENT = pMgr->client();
|
||||
|
||||
for (auto& in : m_vInhibitors) {
|
||||
for (auto const& in : m_vInhibitors) {
|
||||
if (in->surface() != surf)
|
||||
continue;
|
||||
|
||||
@@ -74,7 +74,7 @@ bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
|
||||
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
|
||||
return false;
|
||||
|
||||
for (auto& in : m_vInhibitors) {
|
||||
for (auto const& in : m_vInhibitors) {
|
||||
if (in->surface() != g_pCompositor->m_pLastFocus)
|
||||
continue;
|
||||
|
||||
|
@@ -96,7 +96,7 @@ bool CTabletPadV2Resource::good() {
|
||||
|
||||
void CTabletPadV2Resource::sendData() {
|
||||
// this is dodgy as fuck. I hate wl_array. it's expanded wl_array_for_each because C++ would complain about the implicit casts
|
||||
for (auto& p : pad->aq()->paths) {
|
||||
for (auto const& p : pad->aq()->paths) {
|
||||
resource->sendPath(p.c_str());
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void CTabletV2Resource::sendData() {
|
||||
resource->sendName(tablet->deviceName.c_str());
|
||||
resource->sendId(tablet->aq()->usbVendorID, tablet->aq()->usbProductID);
|
||||
|
||||
for (auto& p : tablet->aq()->paths) {
|
||||
for (auto const& p : tablet->aq()->paths) {
|
||||
resource->sendPath(p.c_str());
|
||||
}
|
||||
|
||||
@@ -287,21 +287,21 @@ void CTabletSeat::sendTablet(SP<CTablet> tablet) {
|
||||
}
|
||||
|
||||
void CTabletSeat::sendData() {
|
||||
for (auto& tw : PROTO::tablet->tablets) {
|
||||
for (auto const& tw : PROTO::tablet->tablets) {
|
||||
if (tw.expired())
|
||||
continue;
|
||||
|
||||
sendTablet(tw.lock());
|
||||
}
|
||||
|
||||
for (auto& tw : PROTO::tablet->tools) {
|
||||
for (auto const& tw : PROTO::tablet->tools) {
|
||||
if (tw.expired())
|
||||
continue;
|
||||
|
||||
sendTool(tw.lock());
|
||||
}
|
||||
|
||||
for (auto& tw : PROTO::tablet->pads) {
|
||||
for (auto const& tw : PROTO::tablet->pads) {
|
||||
if (tw.expired())
|
||||
continue;
|
||||
|
||||
@@ -367,7 +367,7 @@ void CTabletV2Protocol::onGetSeat(CZwpTabletManagerV2* pMgr, uint32_t id, wl_res
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) {
|
||||
for (auto& s : m_vSeats) {
|
||||
for (auto const& s : m_vSeats) {
|
||||
s->sendTablet(tablet);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ void CTabletV2Protocol::registerDevice(SP<CTablet> tablet) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
|
||||
for (auto& s : m_vSeats) {
|
||||
for (auto const& s : m_vSeats) {
|
||||
s->sendTool(tool);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletTool> tool) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
|
||||
for (auto& s : m_vSeats) {
|
||||
for (auto const& s : m_vSeats) {
|
||||
s->sendPad(pad);
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void CTabletV2Protocol::registerDevice(SP<CTabletPad> pad) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) {
|
||||
for (auto& t : m_vTablets) {
|
||||
for (auto const& t : m_vTablets) {
|
||||
if (t->tablet == tablet) {
|
||||
t->resource->sendRemoved();
|
||||
t->inert = true;
|
||||
@@ -401,7 +401,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTablet> tablet) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool == tool) {
|
||||
t->resource->sendRemoved();
|
||||
t->inert = true;
|
||||
@@ -411,7 +411,7 @@ void CTabletV2Protocol::unregisterDevice(SP<CTabletTool> tool) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::unregisterDevice(SP<CTabletPad> pad) {
|
||||
for (auto& t : m_vPads) {
|
||||
for (auto const& t : m_vPads) {
|
||||
if (t->pad == pad) {
|
||||
t->resource->sendRemoved();
|
||||
t->inert = true;
|
||||
@@ -426,7 +426,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
|
||||
std::erase_if(pads, [](const auto& e) { return e.expired(); });
|
||||
|
||||
// now we need to send removed events
|
||||
for (auto& t : m_vTablets) {
|
||||
for (auto const& t : m_vTablets) {
|
||||
if (!t->tablet.expired() || t->inert)
|
||||
continue;
|
||||
|
||||
@@ -434,7 +434,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
|
||||
t->inert = true;
|
||||
}
|
||||
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (!t->tool.expired() || t->inert)
|
||||
continue;
|
||||
|
||||
@@ -448,7 +448,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
|
||||
t->inert = true;
|
||||
}
|
||||
|
||||
for (auto& t : m_vPads) {
|
||||
for (auto const& t : m_vPads) {
|
||||
if (!t->pad.expired() || t->inert)
|
||||
continue;
|
||||
|
||||
@@ -458,7 +458,7 @@ void CTabletV2Protocol::recheckRegisteredDevices() {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -468,7 +468,7 @@ void CTabletV2Protocol::pressure(SP<CTabletTool> tool, double value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::distance(SP<CTabletTool> tool, double value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -478,7 +478,7 @@ void CTabletV2Protocol::distance(SP<CTabletTool> tool, double value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::rotation(SP<CTabletTool> tool, double value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -488,7 +488,7 @@ void CTabletV2Protocol::rotation(SP<CTabletTool> tool, double value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::slider(SP<CTabletTool> tool, double value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -498,7 +498,7 @@ void CTabletV2Protocol::slider(SP<CTabletTool> tool, double value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::wheel(SP<CTabletTool> tool, double value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -508,7 +508,7 @@ void CTabletV2Protocol::wheel(SP<CTabletTool> tool, double value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -518,7 +518,7 @@ void CTabletV2Protocol::tilt(SP<CTabletTool> tool, const Vector2D& value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::up(SP<CTabletTool> tool) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -528,7 +528,7 @@ void CTabletV2Protocol::up(SP<CTabletTool> tool) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::down(SP<CTabletTool> tool) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -545,7 +545,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
|
||||
SP<CTabletToolV2Resource> toolResource;
|
||||
SP<CTabletV2Resource> tabletResource;
|
||||
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || t->resource->client() != CLIENT)
|
||||
continue;
|
||||
|
||||
@@ -559,7 +559,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
|
||||
|
||||
toolResource = t;
|
||||
|
||||
for (auto& tab : m_vTablets) {
|
||||
for (auto const& tab : m_vTablets) {
|
||||
if (tab->tablet != tablet)
|
||||
continue;
|
||||
|
||||
@@ -587,7 +587,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -599,7 +599,7 @@ void CTabletV2Protocol::proximityOut(SP<CTabletTool> tool) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32_t state) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -610,7 +610,7 @@ void CTabletV2Protocol::buttonTool(SP<CTabletTool> tool, uint32_t button, uint32
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::motion(SP<CTabletTool> tool, const Vector2D& value) {
|
||||
for (auto& t : m_vTools) {
|
||||
for (auto const& t : m_vTools) {
|
||||
if (t->tool != tool || !t->current)
|
||||
continue;
|
||||
|
||||
@@ -620,7 +620,7 @@ void CTabletV2Protocol::motion(SP<CTabletTool> tool, const Vector2D& value) {
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode, uint32_t timeMs) {
|
||||
for (auto& t : m_vPads) {
|
||||
for (auto const& t : m_vPads) {
|
||||
if (t->pad != pad)
|
||||
continue;
|
||||
if (t->groups.size() <= group) {
|
||||
@@ -633,7 +633,7 @@ void CTabletV2Protocol::mode(SP<CTabletPad> pad, uint32_t group, uint32_t mode,
|
||||
}
|
||||
|
||||
void CTabletV2Protocol::buttonPad(SP<CTabletPad> pad, uint32_t button, uint32_t timeMs, uint32_t state) {
|
||||
for (auto& t : m_vPads) {
|
||||
for (auto const& t : m_vPads) {
|
||||
if (t->pad != pad)
|
||||
continue;
|
||||
t->resource->sendButton(timeMs, button, zwpTabletToolV2ButtonState{state});
|
||||
|
@@ -38,7 +38,7 @@ void CTearingControlProtocol::onControllerDestroy(CTearingControl* control) {
|
||||
}
|
||||
|
||||
void CTearingControlProtocol::onWindowDestroy(PHLWINDOW pWindow) {
|
||||
for (auto& c : m_vTearingControllers) {
|
||||
for (auto const& c : m_vTearingControllers) {
|
||||
if (c->pWindow.lock() == pWindow)
|
||||
c->pWindow.reset();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
|
||||
resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); });
|
||||
resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
|
||||
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
if (w->m_pWLSurface->resource() == surf_) {
|
||||
pWindow = w;
|
||||
break;
|
||||
|
@@ -369,7 +369,7 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) {
|
||||
std::vector<WP<CToplevelExportFrame>> framesToRemove;
|
||||
|
||||
// share frame if correct output
|
||||
for (auto& f : m_vFramesAwaitingWrite) {
|
||||
for (auto const& f : m_vFramesAwaitingWrite) {
|
||||
if (!f->pWindow || !validMapped(f->pWindow)) {
|
||||
framesToRemove.push_back(f);
|
||||
continue;
|
||||
@@ -393,13 +393,13 @@ void CToplevelExportProtocol::onOutputCommit(CMonitor* pMonitor) {
|
||||
framesToRemove.push_back(f);
|
||||
}
|
||||
|
||||
for (auto& f : framesToRemove) {
|
||||
for (auto const& f : framesToRemove) {
|
||||
destroyResource(f.get());
|
||||
}
|
||||
}
|
||||
|
||||
void CToplevelExportProtocol::onWindowUnmap(PHLWINDOW pWindow) {
|
||||
for (auto& f : m_vFrames) {
|
||||
for (auto const& f : m_vFrames) {
|
||||
if (f->pWindow == pWindow)
|
||||
f->pWindow.reset();
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ void CVirtualKeyboardV1Resource::releasePressed() {
|
||||
timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
for (auto& p : pressed) {
|
||||
for (auto const& p : pressed) {
|
||||
events.key.emit(IKeyboard::SKeyEvent{
|
||||
.timeMs = now.tv_sec * 1000 + now.tv_nsec / 1000000,
|
||||
.keycode = p,
|
||||
|
@@ -39,7 +39,7 @@ CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver
|
||||
static auto P2 = g_pHookSystem->hookDynamic("configReloaded", [this](void* self, SCallbackInfo& info, std::any param) { this->updateAllOutputs(); });
|
||||
static auto P3 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||
const auto PMONITOR = std::any_cast<CMonitor*>(param);
|
||||
for (auto& o : m_vXDGOutputs) {
|
||||
for (auto const& o : m_vXDGOutputs) {
|
||||
if (o->monitor == PMONITOR)
|
||||
o->monitor = nullptr;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(CZxdgOutputManagerV1* mgr, uint32
|
||||
}
|
||||
|
||||
void CXDGOutputProtocol::updateAllOutputs() {
|
||||
for (auto& o : m_vXDGOutputs) {
|
||||
for (auto const& o : m_vXDGOutputs) {
|
||||
|
||||
if (!o->monitor)
|
||||
continue;
|
||||
|
@@ -388,7 +388,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
|
||||
|
||||
g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock()));
|
||||
|
||||
for (auto& p : popups) {
|
||||
for (auto const& p : popups) {
|
||||
if (!p)
|
||||
continue;
|
||||
events.newPopup.emit(p);
|
||||
@@ -714,7 +714,7 @@ CXDGShellProtocol::CXDGShellProtocol(const wl_interface* iface, const int& ver,
|
||||
grab->keyboard = true;
|
||||
grab->pointer = true;
|
||||
grab->setCallback([this]() {
|
||||
for (auto& g : grabbed) {
|
||||
for (auto const& g : grabbed) {
|
||||
g->done();
|
||||
}
|
||||
grabbed.clear();
|
||||
@@ -779,7 +779,7 @@ void CXDGShellProtocol::addOrStartGrab(SP<CXDGPopupResource> popup) {
|
||||
void CXDGShellProtocol::onPopupDestroy(WP<CXDGPopupResource> popup) {
|
||||
if (popup == grabOwner) {
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
for (auto& g : grabbed) {
|
||||
for (auto const& g : grabbed) {
|
||||
g->done();
|
||||
}
|
||||
grabbed.clear();
|
||||
|
@@ -241,7 +241,7 @@ void CWLSurfaceResource::frame(timespec* now) {
|
||||
if (callbacks.empty())
|
||||
return;
|
||||
|
||||
for (auto& c : callbacks) {
|
||||
for (auto const& c : callbacks) {
|
||||
c->send(now);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void CWLSurfaceResource::bfHelper(std::vector<SP<CWLSurfaceResource>> nodes, std
|
||||
std::vector<SP<CWLSurfaceResource>> nodes2;
|
||||
|
||||
// first, gather all nodes below
|
||||
for (auto& n : nodes) {
|
||||
for (auto const& n : nodes) {
|
||||
std::erase_if(n->subsurfaces, [](const auto& e) { return e.expired(); });
|
||||
// subsurfaces is sorted lowest -> highest
|
||||
for (auto const& c : n->subsurfaces) {
|
||||
@@ -310,7 +310,7 @@ std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2
|
||||
void* data) { ((std::vector<std::pair<SP<CWLSurfaceResource>, Vector2D>>*)data)->emplace_back(std::make_pair<>(surf, offset)); },
|
||||
&surfs);
|
||||
|
||||
for (auto& [surf, pos] : surfs | std::views::reverse) {
|
||||
for (auto const& [surf, pos] : surfs | std::views::reverse) {
|
||||
if (!allowsInput) {
|
||||
const auto BOX = CBox{pos, surf->current.size};
|
||||
if (BOX.containsPoint(localCoords))
|
||||
|
@@ -80,7 +80,7 @@ void CWLDataOfferResource::sendData() {
|
||||
resource->sendAction(WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
|
||||
}
|
||||
|
||||
for (auto& m : source->mimes()) {
|
||||
for (auto const& m : source->mimes()) {
|
||||
LOGM(LOG, " | offer {:x} supports mime {}", (uintptr_t)this, m);
|
||||
resource->sendOffer(m.c_str());
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ CWLOutputProtocol::CWLOutputProtocol(const wl_interface* iface, const int& ver,
|
||||
IWaylandProtocol(iface, ver, name), monitor(pMonitor), szName(pMonitor->szName) {
|
||||
|
||||
listeners.modeChanged = monitor->events.modeChanged.registerListener([this](std::any d) {
|
||||
for (auto& o : m_vOutputs) {
|
||||
for (auto const& o : m_vOutputs) {
|
||||
o->updateState();
|
||||
}
|
||||
});
|
||||
@@ -95,7 +95,7 @@ void CWLOutputProtocol::destroyResource(CWLOutputResource* resource) {
|
||||
}
|
||||
|
||||
SP<CWLOutputResource> CWLOutputProtocol::outputResourceFrom(wl_client* client) {
|
||||
for (auto& r : m_vOutputs) {
|
||||
for (auto const& r : m_vOutputs) {
|
||||
if (r->client() != client)
|
||||
continue;
|
||||
|
||||
|
@@ -525,7 +525,7 @@ void CWLSeatProtocol::updateCapabilities(uint32_t caps) {
|
||||
|
||||
currentCaps = caps;
|
||||
|
||||
for (auto& s : m_vSeatResources) {
|
||||
for (auto const& s : m_vSeatResources) {
|
||||
s->sendCapabilities(caps);
|
||||
}
|
||||
}
|
||||
@@ -534,7 +534,7 @@ void CWLSeatProtocol::updateKeymap() {
|
||||
if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
|
||||
return;
|
||||
|
||||
for (auto& k : m_vKeyboards) {
|
||||
for (auto const& k : m_vKeyboards) {
|
||||
k->sendKeymap(g_pSeatManager->keyboard.lock());
|
||||
}
|
||||
}
|
||||
@@ -543,13 +543,13 @@ void CWLSeatProtocol::updateRepeatInfo(uint32_t rate, uint32_t delayMs) {
|
||||
if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD))
|
||||
return;
|
||||
|
||||
for (auto& k : m_vKeyboards) {
|
||||
for (auto const& k : m_vKeyboards) {
|
||||
k->repeatInfo(rate, delayMs);
|
||||
}
|
||||
}
|
||||
|
||||
SP<CWLSeatResource> CWLSeatProtocol::seatResourceForClient(wl_client* client) {
|
||||
for (auto& r : m_vSeatResources) {
|
||||
for (auto const& r : m_vSeatResources) {
|
||||
if (r->client() == client)
|
||||
return r;
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ CWLSHMResource::CWLSHMResource(SP<CWlShm> resource_) : resource(resource_) {
|
||||
});
|
||||
|
||||
// send a few supported formats. No need for any other I think?
|
||||
for (auto& s : PROTO::shm->shmFormats) {
|
||||
for (auto const& s : PROTO::shm->shmFormats) {
|
||||
resource->sendFormat((wl_shm_format)s);
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void CWLSHMProtocol::bindManager(wl_client* client, void* data, uint32_t ver, ui
|
||||
DRM_FORMAT_XBGR8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_ARGB2101010, DRM_FORMAT_XBGR2101010, DRM_FORMAT_ABGR2101010,
|
||||
};
|
||||
|
||||
for (auto& fmt : g_pHyprOpenGL->getDRMFormats()) {
|
||||
for (auto const& fmt : g_pHyprOpenGL->getDRMFormats()) {
|
||||
if (std::find(supportedShmFourccFormats.begin(), supportedShmFourccFormats.end(), fmt.drmFormat) == supportedShmFourccFormats.end())
|
||||
continue;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL
|
||||
return;
|
||||
|
||||
auto pushAboveIndex = [this](int idx) -> void {
|
||||
for (auto& c : parent->subsurfaces) {
|
||||
for (auto const& c : parent->subsurfaces) {
|
||||
if (c->zIndex >= idx)
|
||||
c->zIndex++;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWL
|
||||
return;
|
||||
|
||||
auto pushBelowIndex = [this](int idx) -> void {
|
||||
for (auto& c : parent->subsurfaces) {
|
||||
for (auto const& c : parent->subsurfaces) {
|
||||
if (c->zIndex <= idx)
|
||||
c->zIndex--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user