diff options
| author | Kamikadze <40305144+Kam1k4dze@users.noreply.github.com> | 2025-08-14 19:44:56 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-14 15:44:56 +0100 |
| commit | beee22a95ed9044950e5486f22edd813e00ffa2c (patch) | |
| tree | 4612fa3d9b17275d417a059c19f998c64e871997 /src/helpers/Monitor.cpp | |
| parent | aa6a78f0a4e17c49ed4aff8b58c3f7ec7ef0408f (diff) | |
refactor: Use new hyprutils casts (#11377)
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 561eab8c..37f650a1 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -213,7 +213,7 @@ void CMonitor::onConnect(bool noRule) { m_damage.setSize(m_transformedSize); - Debug::log(LOG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, (uintptr_t)m_output.get()); + Debug::log(LOG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, rc<uintptr_t>(m_output.get())); setupDefaultWS(monitorRule); @@ -577,7 +577,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { addBest3Modes([](auto const& a, auto const& b) { if (std::round(a->refreshRate) > std::round(b->refreshRate)) return true; - else if (DELTALESSTHAN((float)a->refreshRate, (float)b->refreshRate, 1.F) && a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y) + else if (DELTALESSTHAN(sc<float>(a->refreshRate), sc<float>(b->refreshRate), 1.F) && a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y) return true; return false; }); @@ -770,7 +770,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { bool set10bit = false; - for (auto const& fmt : formats[(int)!RULE->enable10bit]) { + for (auto const& fmt : formats[sc<int>(!RULE->enable10bit)]) { m_output->state->setFormat(fmt.second); m_prevDrmFormat = m_drmFormat; m_drmFormat = fmt.second; @@ -902,8 +902,8 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) { // reload to fix mirrors g_pConfigManager->m_wantsMonitorReload = true; - Debug::log(LOG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale, (int)m_transform, - m_position, (int)m_enabled10bit); + Debug::log(LOG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale, sc<int>(m_transform), + m_position, sc<int>(m_enabled10bit)); EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr); @@ -1003,7 +1003,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) { auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(wsID); - Debug::log(LOG, "New monitor: WORKSPACEID {}, exists: {}", wsID, (int)(PNEWWORKSPACE != nullptr)); + Debug::log(LOG, "New monitor: WORKSPACEID {}, exists: {}", wsID, sc<int>(PNEWWORKSPACE != nullptr)); if (PNEWWORKSPACE) { // workspace exists, move it to the newly connected monitor @@ -1078,7 +1078,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) { setupDefaultWS(RULE); - applyMonitorRule((SMonitorRule*)&RULE, true); // will apply the offset and stuff + applyMonitorRule(const_cast<SMonitorRule*>(&RULE), true); // will apply the offset and stuff } else { PHLMONITOR BACKUPMON = nullptr; for (auto const& m : g_pCompositor->m_monitors) { @@ -1469,7 +1469,8 @@ bool CMonitor::attemptDirectScanout() { if (!params.success || !PSURFACE->m_current.texture->m_eglImage /* dmabuf */) return false; - Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {}", (uintptr_t)PSURFACE.get(), (uintptr_t)PSURFACE->m_current.buffer.m_buffer.get()); + Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {}", rc<uintptr_t>(PSURFACE.get()), + rc<uintptr_t>(PSURFACE->m_current.buffer.m_buffer.get())); auto PBUFFER = PSURFACE->m_current.buffer.m_buffer; @@ -1532,7 +1533,7 @@ bool CMonitor::attemptDirectScanout() { if (m_lastScanout.expired()) { m_lastScanout = PCANDIDATE; - Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_title); + Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", rc<uintptr_t>(PCANDIDATE.get()), PCANDIDATE->m_title); } m_scanoutNeedsCursorUpdate = false; |
