mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-08-17 01:00:27 +03:00
prefer .expired() for bool checks
This commit is contained in:
parent
4b2a69c571
commit
caf198bedd
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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<Hyprlang::INT>("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);
|
||||
|
@ -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<Hyprlang::INT>("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<CSubsurface>(pSubsurface, m_pWindowParent.lock())).get();
|
||||
else if (m_pPopupParent)
|
||||
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(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();
|
||||
|
@ -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<CBox> 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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<void(std::any)> handler) {
|
||||
|
@ -101,7 +101,7 @@ struct std::formatter<SDwindleNodeData*, CharT> : std::formatter<CharT> {
|
||||
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, "]");
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -104,7 +104,7 @@ struct std::formatter<SMasterNodeData*, CharT> : std::formatter<CharT> {
|
||||
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, "]");
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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())) {
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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;
|
||||
|
@ -67,7 +67,7 @@ void CForeignToplevelList::onMap(PHLWINDOW pWindow) {
|
||||
}
|
||||
|
||||
SP<CForeignToplevelHandle> 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<CForeignToplevelHandle>{} : IT->lock();
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {
|
||||
}
|
||||
|
||||
SP<CForeignToplevelHandleWlr> 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<CForeignToplevelHandleWlr>{} : IT->lock();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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<PHLWINDOW> 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<Hyprlang::INT>("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)
|
||||
|
Loading…
Reference in New Issue
Block a user