diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 197a1d27..c627fe72 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -916,7 +916,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, wlr_surface* pSurface) { if (!pWindow || !validMapped(pWindow)) { - if (!m_pLastWindow.lock() && !pWindow) + if (m_pLastWindow.expired() && !pWindow) return; const auto PLASTWINDOW = m_pLastWindow.lock(); @@ -1279,7 +1279,7 @@ bool CCompositor::doesSeatAcceptInput(wlr_surface* surface) { } bool CCompositor::isWindowActive(PHLWINDOW pWindow) { - if (!m_pLastWindow.lock() && !m_pLastFocus) + if (m_pLastWindow.expired() && !m_pLastFocus) return false; if (!pWindow->m_bIsMapped) @@ -2643,7 +2643,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor pWindow->updateDynamicRules(); pWindow->uncacheWindowDecos(); - if (pWindow->m_sGroupData.pNextWindow.lock()) { + if (!pWindow->m_sGroupData.pNextWindow.expired()) { PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock(); while (next != pWindow) { next->moveToWorkspace(pWorkspace); diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index d02d6023..7f09eb18 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -143,7 +143,7 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) { static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) { const bool isJson = format == eHyprCtlOutputFormat::FORMAT_JSON; - if (!w->m_sGroupData.pNextWindow.lock()) + if (w->m_sGroupData.pNextWindow.expired()) return isJson ? "" : "0"; std::ostringstream result; diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp index 5501e925..527c0b38 100644 --- a/src/desktop/Popup.cpp +++ b/src/desktop/Popup.cpp @@ -69,7 +69,7 @@ static void onRepositionPopup(void* owner, void* data) { void CPopup::initAllSignals() { if (!m_pWLR) { - if (m_pWindowOwner.lock()) + if (!m_pWindowOwner.expired()) hyprListener_newPopup.initCallback(&m_pWindowOwner.lock()->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head"); else if (m_pLayerOwner) hyprListener_newPopup.initCallback(&m_pLayerOwner->layerSurface->events.new_popup, ::onNewPopup, this, "CPopup Head"); @@ -146,7 +146,7 @@ void CPopup::onCommit(bool ignoreSiblings) { return; } - if (m_pWindowOwner.lock() && (!m_pWindowOwner.lock()->m_bIsMapped || !m_pWindowOwner.lock()->m_pWorkspace->m_bVisible)) { + if (!m_pWindowOwner.expired() && (!m_pWindowOwner.lock()->m_bIsMapped || !m_pWindowOwner.lock()->m_pWorkspace->m_bVisible)) { m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height}; static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); @@ -230,7 +230,7 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) { } Vector2D CPopup::t1ParentCoords() { - if (m_pWindowOwner.lock()) + if (!m_pWindowOwner.expired()) return m_pWindowOwner.lock()->m_vRealPosition.value(); if (m_pLayerOwner) return m_pLayerOwner->realPosition.value(); @@ -260,7 +260,7 @@ Vector2D CPopup::size() { } void CPopup::sendScale() { - if (m_pWindowOwner.lock()) + if (!m_pWindowOwner.expired()) g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pWindowOwner.lock()->m_pWLSurface.m_fLastScale); else if (m_pLayerOwner) g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pLayerOwner->surface.m_fLastScale); diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index b598c2b6..b2c9f8bd 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -73,7 +73,7 @@ void CSubsurface::initSignals() { hyprListener_mapSubsurface.initCallback(&m_pSubsurface->surface->events.map, &onMapSubsurface, this, "CSubsurface"); hyprListener_unmapSubsurface.initCallback(&m_pSubsurface->surface->events.unmap, &onUnmapSubsurface, this, "CSubsurface"); } else { - if (m_pWindowParent.lock()) + if (!m_pWindowParent.expired()) hyprListener_newSubsurface.initCallback(&m_pWindowParent.lock()->m_pWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head"); else if (m_pPopupParent) hyprListener_newSubsurface.initCallback(&m_pPopupParent->m_sWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head"); @@ -106,7 +106,7 @@ void CSubsurface::recheckDamageForSubsurfaces() { void CSubsurface::onCommit() { // no damaging if it's not visible - if (m_pWindowParent.lock() && (!m_pWindowParent.lock()->m_bIsMapped || !m_pWindowParent.lock()->m_pWorkspace->m_bVisible)) { + if (!m_pWindowParent.expired() && (!m_pWindowParent.lock()->m_bIsMapped || !m_pWindowParent.lock()->m_pWorkspace->m_bVisible)) { m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height}; static auto PLOGDAMAGE = CConfigValue("debug:log_damage"); @@ -121,7 +121,7 @@ void CSubsurface::onCommit() { if (m_pPopupParent) m_pPopupParent->recheckTree(); - if (m_pWindowParent.lock()) // I hate you firefox why are you doing this + if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this m_pWindowParent.lock()->m_pPopupHead->recheckTree(); // I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox) @@ -152,7 +152,7 @@ void CSubsurface::onDestroy() { void CSubsurface::onNewSubsurface(wlr_subsurface* pSubsurface) { CSubsurface* PSUBSURFACE = nullptr; - if (m_pWindowParent.lock()) + if (!m_pWindowParent.expired()) PSUBSURFACE = m_vChildren.emplace_back(std::make_unique(pSubsurface, m_pWindowParent.lock())).get(); else if (m_pPopupParent) PSUBSURFACE = m_vChildren.emplace_back(std::make_unique(pSubsurface, m_pPopupParent)).get(); @@ -169,7 +169,7 @@ void CSubsurface::onMap() { box.expand(4); g_pHyprRenderer->damageBox(&box); - if (m_pWindowParent.lock()) + if (!m_pWindowParent.expired()) m_pWindowParent.lock()->updateSurfaceScaleTransformDetails(); } @@ -206,7 +206,7 @@ Vector2D CSubsurface::coordsRelativeToParent() { Vector2D CSubsurface::coordsGlobal() { Vector2D coords = coordsRelativeToParent(); - if (m_pWindowParent.lock()) + if (!m_pWindowParent.expired()) coords += m_pWindowParent.lock()->m_vRealPosition.value(); else if (m_pPopupParent) coords += m_pPopupParent->coordsGlobal(); diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index 2d870870..55601a99 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -167,14 +167,14 @@ CSubsurface* CWLSurface::getSubsurface() { } bool CWLSurface::desktopComponent() { - return m_pLayerOwner || m_pWindowOwner.lock() || m_pSubsurfaceOwner || m_pPopupOwner; + return m_pLayerOwner || !m_pWindowOwner.expired() || m_pSubsurfaceOwner || m_pPopupOwner; } std::optional CWLSurface::getSurfaceBoxGlobal() { if (!desktopComponent()) return {}; - if (m_pWindowOwner.lock()) + if (!m_pWindowOwner.expired()) return m_pWindowOwner.lock()->getWindowMainSurfaceBox(); if (m_pLayerOwner) return m_pLayerOwner->geometry; diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 107a60c1..bf40f908 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -458,7 +458,7 @@ void CWindow::onUnmap() { m_vRealSize.setCallbackOnBegin(nullptr); - std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return !other.lock() || other.lock().get() == this; }); + std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other.expired() || other.lock().get() == this; }); hyprListener_unmapWindow.removeCallback(); @@ -827,7 +827,7 @@ void CWindow::createGroup() { return; } - if (!m_sGroupData.pNextWindow.lock()) { + if (m_sGroupData.pNextWindow.expired()) { m_sGroupData.pNextWindow = m_pSelf; m_sGroupData.head = true; m_sGroupData.locked = false; @@ -1043,7 +1043,7 @@ void CWindow::switchWithWindowInGroup(PHLWINDOW pWindow) { } void CWindow::updateGroupOutputs() { - if (!m_sGroupData.pNextWindow.lock()) + if (m_sGroupData.pNextWindow.expired()) return; PHLWINDOW curr = m_sGroupData.pNextWindow.lock(); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 59f6e716..54a5486c 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -95,7 +95,7 @@ void Events::listener_mapWindow(void* owner, void* data) { if (*PINITIALWSTRACKING == 1) // one-shot token g_pTokenManager->removeToken(TOKEN); else if (*PINITIALWSTRACKING == 2) { // persistent - if (!WS.primaryOwner.lock()) { + if (WS.primaryOwner.expired()) { WS.primaryOwner = PWINDOW; TOKEN->data = WS; } diff --git a/src/helpers/signal/Signal.cpp b/src/helpers/signal/Signal.cpp index a8adc275..204aaf00 100644 --- a/src/helpers/signal/Signal.cpp +++ b/src/helpers/signal/Signal.cpp @@ -12,7 +12,7 @@ void CSignal::emit(std::any data) { } if (dirty) - std::erase_if(m_vListeners, [](const auto& other) { return !other.lock(); }); + std::erase_if(m_vListeners, [](const auto& other) { return other.expired(); }); } CHyprSignalListener CSignal::registerListener(std::function handler) { diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index 14fac467..13834bc7 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -101,7 +101,7 @@ struct std::formatter : std::formatter { if (!node) return std::format_to(out, "[Node nullptr]"); std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->box.pos(), node->box.size()); - if (!node->isNode && node->pWindow.lock()) + if (!node->isNode && !node->pWindow.expired()) std::format_to(out, ", window: {:x}", node->pWindow.lock()); return std::format_to(out, "]"); } diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index d9c99496..053bd5be 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -29,7 +29,7 @@ void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) { if (pWindow->m_bIsFullscreen) g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); - if (pWindow->m_sGroupData.pNextWindow.lock()) { + if (!pWindow->m_sGroupData.pNextWindow.expired()) { if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow) pWindow->m_sGroupData.pNextWindow.reset(); else { diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp index 3b7caf8f..30d5b3cf 100644 --- a/src/layout/MasterLayout.hpp +++ b/src/layout/MasterLayout.hpp @@ -104,7 +104,7 @@ struct std::formatter : std::formatter { std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size); if (node->isMaster) std::format_to(out, ", master"); - if (node->pWindow.lock()) + if (!node->pWindow.expired()) std::format_to(out, ", window: {:x}", node->pWindow.lock()); return std::format_to(out, "]"); } diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index bd0e9599..996424cc 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -225,7 +225,7 @@ bool CKeybindManager::ensureMouseBindState() { if (!m_bIsMouseBindActive) return false; - if (g_pInputManager->currentlyDraggedWindow.lock()) { + if (!g_pInputManager->currentlyDraggedWindow.expired()) { PHLWINDOW lastDraggedWindow = g_pInputManager->currentlyDraggedWindow.lock(); m_bIsMouseBindActive = false; @@ -1322,7 +1322,7 @@ void CKeybindManager::toggleGroup(std::string args) { g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL); - if (!PWINDOW->m_sGroupData.pNextWindow.lock()) + if (PWINDOW->m_sGroupData.pNextWindow.expired()) PWINDOW->createGroup(); else PWINDOW->destroyGroup(); @@ -1334,7 +1334,7 @@ void CKeybindManager::changeGroupActive(std::string args) { if (!PWINDOW) return; - if (!PWINDOW->m_sGroupData.pNextWindow.lock()) + if (PWINDOW->m_sGroupData.pNextWindow.expired()) return; if (PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW) @@ -1794,7 +1794,7 @@ void CKeybindManager::resizeWindow(std::string args) { void CKeybindManager::circleNext(std::string arg) { - if (!g_pCompositor->m_pLastWindow.lock()) { + if (g_pCompositor->m_pLastWindow.expired()) { // if we have a clear focus, find the first window and get the next focusable. if (g_pCompositor->getWindowsOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID()) > 0) { const auto PWINDOW = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID()); @@ -2015,7 +2015,7 @@ void CKeybindManager::swapnext(std::string arg) { PHLWINDOW toSwap = nullptr; - if (!g_pCompositor->m_pLastWindow.lock()) + if (g_pCompositor->m_pLastWindow.expired()) return; const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock(); @@ -2103,7 +2103,7 @@ void CKeybindManager::mouse(std::string args) { if (pWindow && !pWindow->m_bIsFullscreen) pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_START, mouseCoords); - if (!g_pInputManager->currentlyDraggedWindow.lock()) + if (g_pInputManager->currentlyDraggedWindow.expired()) g_pInputManager->currentlyDraggedWindow = pWindow; g_pInputManager->dragMode = MBIND_MOVE; @@ -2111,7 +2111,7 @@ void CKeybindManager::mouse(std::string args) { } else { g_pKeybindManager->m_bIsMouseBindActive = false; - if (g_pInputManager->currentlyDraggedWindow.lock()) { + if (!g_pInputManager->currentlyDraggedWindow.expired()) { g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pInputManager->currentlyDraggedWindow.reset(); g_pInputManager->dragMode = MBIND_INVALID; @@ -2135,7 +2135,7 @@ void CKeybindManager::mouse(std::string args) { } else { g_pKeybindManager->m_bIsMouseBindActive = false; - if (g_pInputManager->currentlyDraggedWindow.lock()) { + if (!g_pInputManager->currentlyDraggedWindow.expired()) { g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pInputManager->currentlyDraggedWindow.reset(); g_pInputManager->dragMode = MBIND_INVALID; @@ -2175,7 +2175,7 @@ void CKeybindManager::alterZOrder(std::string args) { } void CKeybindManager::fakeFullscreenActive(std::string args) { - if (g_pCompositor->m_pLastWindow.lock()) { + if (!g_pCompositor->m_pLastWindow.expired()) { // will also set the flag g_pCompositor->m_pLastWindow.lock()->m_bFakeFullscreenState = !g_pCompositor->m_pLastWindow.lock()->m_bFakeFullscreenState; g_pXWaylandManager->setWindowFullscreen(g_pCompositor->m_pLastWindow.lock(), g_pCompositor->m_pLastWindow.lock()->shouldSendFullscreenState()); diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp index b577d222..6ec5fc81 100644 --- a/src/managers/input/IdleInhibitor.cpp +++ b/src/managers/input/IdleInhibitor.cpp @@ -29,7 +29,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) { void CInputManager::recheckIdleInhibitorStatus() { for (auto& ii : m_vIdleInhibitors) { - if (!ii->pWindow.lock()) { + if (ii->pWindow.expired()) { g_pCompositor->setIdleActivityInhibit(false); return; } else if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index f8b3eded..adfa5029 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -213,7 +213,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { surfacePos = foundPopup->globalBox().pos(); m_bFocusHeldByButtons = true; m_bRefocusHeldByButtons = refocus; - } else if (g_pCompositor->m_pLastWindow.lock()) { + } else if (!g_pCompositor->m_pLastWindow.expired()) { foundSurface = m_pLastMouseSurface; pFoundWindow = g_pCompositor->m_pLastWindow.lock(); @@ -226,7 +226,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); - if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && !m_pForcedFocus.lock()) + if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired()) g_pCompositor->setActiveMonitor(PMONITOR); if (g_pSessionLockManager->isSessionLocked()) { @@ -356,7 +356,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat); m_pLastMouseSurface = nullptr; - if (refocus || !g_pCompositor->m_pLastWindow.lock()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too! + if (refocus || g_pCompositor->m_pLastWindow.expired()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too! g_pCompositor->focusWindow(nullptr); return; @@ -1637,7 +1637,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) { if (w->hasPopupAt(mouseCoords)) direction = BORDERICON_NONE; - else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow.lock())) + else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_lCurrentlyHeldButtons.empty() && currentlyDraggedWindow.expired())) direction = BORDERICON_NONE; else { diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 9fc5c7c3..302d9e1d 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -64,7 +64,7 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) { Vector2D local; - if (m_sTouchData.touchFocusWindow.lock()) { + if (!m_sTouchData.touchFocusWindow.expired()) { if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11) { local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) * m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy; diff --git a/src/protocols/ForeignToplevel.cpp b/src/protocols/ForeignToplevel.cpp index 128790bd..05720455 100644 --- a/src/protocols/ForeignToplevel.cpp +++ b/src/protocols/ForeignToplevel.cpp @@ -67,7 +67,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) { } SP CForeignToplevelList::handleForWindow(PHLWINDOW pWindow) { - std::erase_if(handles, [](const auto& wp) { return !wp.lock(); }); + std::erase_if(handles, [](const auto& wp) { return wp.expired(); }); const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; }); return IT == handles.end() ? SP{} : IT->lock(); } diff --git a/src/protocols/ForeignToplevelWlr.cpp b/src/protocols/ForeignToplevelWlr.cpp index e8130b5d..3f9e64a0 100644 --- a/src/protocols/ForeignToplevelWlr.cpp +++ b/src/protocols/ForeignToplevelWlr.cpp @@ -207,7 +207,7 @@ void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) { } SP CForeignToplevelWlrManager::handleForWindow(PHLWINDOW pWindow) { - std::erase_if(handles, [](const auto& wp) { return !wp.lock(); }); + std::erase_if(handles, [](const auto& wp) { return wp.expired(); }); const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; }); return IT == handles.end() ? SP{} : IT->lock(); } diff --git a/src/protocols/TearingControl.cpp b/src/protocols/TearingControl.cpp index 97ec670a..7f0fe744 100644 --- a/src/protocols/TearingControl.cpp +++ b/src/protocols/TearingControl.cpp @@ -66,7 +66,7 @@ void CTearingControl::onHint(wpTearingControlV1PresentationHint hint_) { } void CTearingControl::updateWindow() { - if (!pWindow.lock()) + if (pWindow.expired()) return; pWindow.lock()->m_bTearingHint = hint == WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 4ea44390..78698505 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -167,7 +167,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) { if (m_RenderData.pCurrentMonData->blurFBShouldRender) return true; - if (pMonitor->solitaryClient.lock()) + if (!pMonitor->solitaryClient.expired()) return false; for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) { @@ -1333,7 +1333,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) { return; // ignore if solitary present, nothing to blur - if (pMonitor->solitaryClient.lock()) + if (!pMonitor->solitaryClient.expired()) return; // check if we need to update the blur fb diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 6e791fa1..4d1ee97d 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1060,7 +1060,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) { wlr_presentation_surface_scanned_out_on_output(PSURFACE, pMonitor->output); if (pMonitor->state.commit()) { - if (!m_pLastScanout.lock()) { + if (m_pLastScanout.expired()) { m_pLastScanout = PCANDIDATE; Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle); } @@ -1171,14 +1171,14 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { return; } - if (pMonitor->solitaryClient.lock()) + if (!pMonitor->solitaryClient.expired()) shouldTear = true; } if (!*PNODIRECTSCANOUT && !shouldTear) { if (attemptDirectScanout(pMonitor)) { return; - } else if (m_pLastScanout.lock()) { + } else if (!m_pLastScanout.expired()) { Debug::log(LOG, "Left a direct scanout."); m_pLastScanout.reset(); } @@ -1285,7 +1285,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { bool renderCursor = true; if (!finalDamage.empty()) { - if (!pMonitor->solitaryClient.lock()) { + if (pMonitor->solitaryClient.expired()) { if (pMonitor->isMirror()) { g_pHyprOpenGL->blend(false); g_pHyprOpenGL->renderMirrored(); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 5509ab3b..ee1e713a 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -58,7 +58,7 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() { // void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) { - if (!m_pWindow.lock()->m_sGroupData.pNextWindow.lock()) { + if (m_pWindow.lock()->m_sGroupData.pNextWindow.expired()) { m_pWindow.lock()->removeWindowDeco(this); return; } @@ -374,7 +374,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock(); PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; - if (pDraggedWindow->m_sGroupData.pNextWindow.lock()) { + if (!pDraggedWindow->m_sGroupData.pNextWindow.expired()) { // stores group data std::vector members; @@ -469,7 +469,7 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) { static auto PGROUPBARSCROLLING = CConfigValue("group:groupbar:scrolling"); - if (!*PGROUPBARSCROLLING || !m_pWindow.lock()->m_sGroupData.pNextWindow.lock()) + if (!*PGROUPBARSCROLLING || m_pWindow.lock()->m_sGroupData.pNextWindow.expired()) return false; if (e->delta > 0)