aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/managers
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/AnimationManager.cpp6
-rw-r--r--src/managers/KeybindManager.cpp34
-rw-r--r--src/managers/XWaylandManager.cpp2
-rw-r--r--src/managers/input/Swipe.cpp3
-rw-r--r--src/managers/input/Touch.cpp4
5 files changed, 24 insertions, 25 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 9ff7497d..0bdf5a7a 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -99,12 +99,12 @@ void CAnimationManager::tick() {
PDECO->damageEntire();
}
- PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
+ PMONITOR = PWINDOW->m_pMonitor.lock();
if (!PMONITOR)
continue;
animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled);
} else if (PWORKSPACE) {
- PMONITOR = g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID);
+ PMONITOR = PWORKSPACE->m_pMonitor.lock();
if (!PMONITOR)
continue;
@@ -325,7 +325,7 @@ void CAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, boo
const auto GOALPOS = pWindow->m_vRealPosition.goal();
const auto GOALSIZE = pWindow->m_vRealSize.goal();
- const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
+ const auto PMONITOR = pWindow->m_pMonitor.lock();
if (!PMONITOR)
return; // unsafe state most likely
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 9c22fb93..b54b71ed 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -349,9 +349,9 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO) {
g_pInputManager->m_pForcedFocus.reset();
}
- if (PLASTWINDOW && PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
+ if (PLASTWINDOW && PLASTWINDOW->m_pMonitor != PWINDOWTOCHANGETO->m_pMonitor) {
// event
- const auto PNEWMON = g_pCompositor->getMonitorFromID(PWINDOWTOCHANGETO->m_iMonitorID);
+ const auto PNEWMON = PWINDOWTOCHANGETO->m_pMonitor.lock();
g_pCompositor->setActiveMonitor(PNEWMON);
}
@@ -1011,7 +1011,7 @@ static SDispatchResult toggleActiveFloatingCore(std::string args, std::optional<
}
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
g_pCompositor->updateWorkspaceWindowData(PWINDOW->workspaceID());
- g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->m_iMonitorID);
+ g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->monitorID());
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
return {};
@@ -1035,7 +1035,7 @@ SDispatchResult CKeybindManager::centerWindow(std::string args) {
if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->isFullscreen())
return {.success = false, .error = "No floating window found"};
- const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
+ const auto PMONITOR = PWINDOW->m_pMonitor.lock();
auto RESERVEDOFFSET = Vector2D();
if (args == "1")
@@ -1081,7 +1081,7 @@ SWorkspaceIDName getWorkspaceToChangeFromArgs(std::string args, PHLWORKSPACE PCU
const auto ID = PCURRENTWORKSPACE->m_iID;
if (const auto PWORKSPACETOCHANGETO = g_pCompositor->getWorkspaceByID(PPREVWS.id); PWORKSPACETOCHANGETO) {
- if (PER_MON && PCURRENTWORKSPACE->m_iMonitorID != PWORKSPACETOCHANGETO->m_iMonitorID)
+ if (PER_MON && PCURRENTWORKSPACE->m_pMonitor != PWORKSPACETOCHANGETO->m_pMonitor)
return {WORKSPACE_NOT_CHANGED, ""};
return {ID, PWORKSPACETOCHANGETO->m_szName};
}
@@ -1135,7 +1135,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
g_pInputManager->releaseAllMouseButtons();
- const auto PMONITORWORKSPACEOWNER = PMONITOR->ID == pWorkspaceToChangeTo->m_iMonitorID ? PMONITOR : g_pCompositor->getMonitorFromID(pWorkspaceToChangeTo->m_iMonitorID);
+ const auto PMONITORWORKSPACEOWNER = PMONITOR == pWorkspaceToChangeTo->m_pMonitor ? PMONITOR : pWorkspaceToChangeTo->m_pMonitor.lock();
if (!PMONITORWORKSPACEOWNER)
return {.success = false, .error = "Workspace to switch to has no monitor"};
@@ -1270,11 +1270,11 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
if (pWorkspace) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
- pMonitor = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
+ pMonitor = pWorkspace->m_pMonitor.lock();
g_pCompositor->setActiveMonitor(pMonitor);
} else {
- pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->m_iMonitorID, workspaceName, false);
- pMonitor = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
+ pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->monitorID(), workspaceName, false);
+ pMonitor = pWorkspace->m_pMonitor.lock();
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
}
@@ -1283,7 +1283,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
if (pWorkspace->m_bIsSpecialWorkspace)
pMonitor->setSpecialWorkspace(pWorkspace);
else if (POLDWS->m_bIsSpecialWorkspace)
- g_pCompositor->getMonitorFromID(POLDWS->m_iMonitorID)->setSpecialWorkspace(nullptr);
+ POLDWS->m_pMonitor.lock()->setSpecialWorkspace(nullptr);
if (*PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS);
@@ -1328,7 +1328,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
if (pWorkspace) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
} else {
- pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->m_iMonitorID, workspaceName, false);
+ pWorkspace = g_pCompositor->createNewWorkspace(WORKSPACEID, PWINDOW->monitorID(), workspaceName, false);
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
}
@@ -1475,7 +1475,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
if (PLASTWINDOW->m_bIsFloating) {
std::optional<float> vPosx, vPosy;
- const auto PMONITOR = g_pCompositor->getMonitorFromID(PLASTWINDOW->m_iMonitorID);
+ const auto PMONITOR = PLASTWINDOW->m_pMonitor.lock();
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
switch (arg) {
@@ -1882,8 +1882,8 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
workspaceID = pWorkspace->m_iID;
}
- if (pWorkspace->m_iMonitorID != PCURRMONITOR->ID) {
- const auto POLDMONITOR = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
+ if (pWorkspace->m_pMonitor != PCURRMONITOR) {
+ const auto POLDMONITOR = pWorkspace->m_pMonitor.lock();
if (!POLDMONITOR) { // wat
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!");
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor old monitor doesn't exist!"};
@@ -2509,7 +2509,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
PWINDOW->m_bPinned = !PWINDOW->m_bPinned;
- const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
+ const auto PMONITOR = PWINDOW->m_pMonitor.lock();
if (!PMONITOR) {
Debug::log(ERR, "pin: monitor not found");
@@ -2658,9 +2658,9 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property!
- if (pWindow->m_iMonitorID != pWindowInDirection->m_iMonitorID) {
+ if (pWindow->m_pMonitor != pWindowInDirection->m_pMonitor) {
pWindow->moveToWorkspace(pWindowInDirection->m_pWorkspace);
- pWindow->m_iMonitorID = pWindowInDirection->m_iMonitorID;
+ pWindow->m_pMonitor = pWindowInDirection->m_pMonitor;
}
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index 7b3081a2..d0dda8e6 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -117,7 +117,7 @@ void CHyprXWaylandManager::setWindowSize(PHLWINDOW pWindow, Vector2D size, bool
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
- const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
+ const auto PMONITOR = pWindow->m_pMonitor.lock();
size = size.clamp(Vector2D{0, 0}, Vector2D{std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()});
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index 8f95c6c6..ba0783fa 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -15,9 +15,8 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
int onMonitor = 0;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
- if (w->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID && !g_pCompositor->isWorkspaceSpecial(w->m_iID)) {
+ if (w->m_pMonitor == g_pCompositor->m_pLastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_iID))
onMonitor++;
- }
}
if (onMonitor < 2 && !*PSWIPENEW)
diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp
index 454391af..4e3980aa 100644
--- a/src/managers/input/Touch.cpp
+++ b/src/managers/input/Touch.cpp
@@ -123,7 +123,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
return;
}
if (validMapped(m_sTouchData.touchFocusWindow)) {
- const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID);
+ const auto PMONITOR = m_sTouchData.touchFocusWindow->m_pMonitor.lock();
g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);
@@ -133,7 +133,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local);
} else if (!m_sTouchData.touchFocusLS.expired()) {
- const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLS->monitorID);
+ const auto PMONITOR = m_sTouchData.touchFocusLS->monitor.lock();
g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);