diff options
| author | davc0n <dconti.dev@gmail.com> | 2025-04-30 23:45:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-30 23:45:20 +0200 |
| commit | 50e1bec85f8febdd78f50d94f140d07f9b34148d (patch) | |
| tree | ac8f53553ef3ca5dedb956a09442a23f762e0428 /src/managers | |
| parent | b8a204c21d6b36a5b3ccf4c125553c61a9fd6b90 (diff) | |
helpers: refactor class member vars (#10218)
Diffstat (limited to 'src/managers')
| -rw-r--r-- | src/managers/AnimationManager.cpp | 28 | ||||
| -rw-r--r-- | src/managers/CursorManager.cpp | 6 | ||||
| -rw-r--r-- | src/managers/KeybindManager.cpp | 84 | ||||
| -rw-r--r-- | src/managers/PointerManager.cpp | 119 | ||||
| -rw-r--r-- | src/managers/ProtocolManager.cpp | 28 | ||||
| -rw-r--r-- | src/managers/SessionLockManager.cpp | 6 | ||||
| -rw-r--r-- | src/managers/XWaylandManager.cpp | 20 | ||||
| -rw-r--r-- | src/managers/input/InputManager.cpp | 33 | ||||
| -rw-r--r-- | src/managers/input/InputMethodPopup.cpp | 14 | ||||
| -rw-r--r-- | src/managers/input/Swipe.cpp | 18 | ||||
| -rw-r--r-- | src/managers/input/Touch.cpp | 20 |
11 files changed, 188 insertions, 188 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index c9b270e2..0d3aa9c7 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -21,7 +21,7 @@ static int wlTick(SP<CEventLoopTimer> self, void* data) { g_pAnimationManager->onTicked(); if (g_pCompositor->m_sessionActive && g_pAnimationManager && g_pHookSystem && !g_pCompositor->m_unsafeState && - std::ranges::any_of(g_pCompositor->m_monitors, [](const auto& mon) { return mon->m_bEnabled && mon->output; })) { + std::ranges::any_of(g_pCompositor->m_monitors, [](const auto& mon) { return mon->m_enabled && mon->m_output; })) { g_pAnimationManager->tick(); EMIT_HOOK_EVENT("tick", nullptr); } @@ -64,7 +64,7 @@ static void updateColorVariable(CAnimatedVariable<CHyprColor>& av, const float P const auto& L1 = av.begun().asOkLab(); const auto& L2 = av.goal().asOkLab(); - static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + (two - one) * progress; }; + static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + ((two - one) * progress); }; const Hyprgraphics::CColor lerped = Hyprgraphics::CColor::SOkLab{ .l = lerp(L1.l, L2.l, POINTY), @@ -117,7 +117,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) { // still doing the full damage hack for floating because sometimes when the window // goes through multiple monitors the last rendered frame is missing damage somehow?? const CBox windowBoxNoOffset = w->getFullWindowBoundingBox(); - const CBox monitorBox = {PMONITOR->vecPosition, PMONITOR->vecSize}; + const CBox monitorBox = {PMONITOR->m_position, PMONITOR->m_size}; if (windowBoxNoOffset.intersection(monitorBox) != windowBoxNoOffset) // on edges between multiple monitors g_pHyprRenderer->damageWindow(w, true); } @@ -262,9 +262,9 @@ void CHyprAnimationManager::scheduleTick() { return; } - float refreshDelayMs = std::floor(1000.f / PMOSTHZ->refreshRate); + float refreshDelayMs = std::floor(1000.f / PMOSTHZ->m_refreshRate); - const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(Time::steadyNow() - PMOSTHZ->lastPresentationTimer.chrono()).count() / 1000.F; + const float SINCEPRES = std::chrono::duration_cast<std::chrono::microseconds>(Time::steadyNow() - PMOSTHZ->m_lastPresentationTimer.chrono()).count() / 1000.F; const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it @@ -308,13 +308,13 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, if (force != "") { if (force == "bottom") - posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y); + posOffset = Vector2D(GOALPOS.x, PMONITOR->m_position.y + PMONITOR->m_size.y); else if (force == "left") posOffset = GOALPOS - Vector2D(GOALSIZE.x, 0.0); else if (force == "right") posOffset = GOALPOS + Vector2D(GOALSIZE.x, 0.0); else - posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y); + posOffset = Vector2D(GOALPOS.x, PMONITOR->m_position.y - GOALSIZE.y); if (!close) pWindow->m_realPosition->setValue(posOffset); @@ -327,10 +327,10 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, const auto MIDPOINT = GOALPOS + GOALSIZE / 2.f; // check sides it touches - const bool DISPLAYLEFT = STICKS(pWindow->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x); - const bool DISPLAYRIGHT = STICKS(pWindow->m_position.x + pWindow->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x); - const bool DISPLAYTOP = STICKS(pWindow->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y); - const bool DISPLAYBOTTOM = STICKS(pWindow->m_position.y + pWindow->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); + const bool DISPLAYLEFT = STICKS(pWindow->m_position.x, PMONITOR->m_position.x + PMONITOR->m_reservedTopLeft.x); + const bool DISPLAYRIGHT = STICKS(pWindow->m_position.x + pWindow->m_size.x, PMONITOR->m_position.x + PMONITOR->m_size.x - PMONITOR->m_reservedBottomRight.x); + const bool DISPLAYTOP = STICKS(pWindow->m_position.y, PMONITOR->m_position.y + PMONITOR->m_reservedTopLeft.y); + const bool DISPLAYBOTTOM = STICKS(pWindow->m_position.y + pWindow->m_size.y, PMONITOR->m_position.y + PMONITOR->m_size.y - PMONITOR->m_reservedBottomRight.y); if (DISPLAYBOTTOM && DISPLAYTOP) { if (DISPLAYLEFT && DISPLAYRIGHT) { @@ -345,10 +345,10 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, } else if (DISPLAYBOTTOM) { posOffset = GOALPOS + Vector2D(0.0, GOALSIZE.y); } else { - if (MIDPOINT.y > PMONITOR->vecPosition.y + PMONITOR->vecSize.y / 2.f) - posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y + PMONITOR->vecSize.y); + if (MIDPOINT.y > PMONITOR->m_position.y + PMONITOR->m_size.y / 2.f) + posOffset = Vector2D(GOALPOS.x, PMONITOR->m_position.y + PMONITOR->m_size.y); else - posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y); + posOffset = Vector2D(GOALPOS.x, PMONITOR->m_position.y - GOALSIZE.y); } if (!close) diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp index 9a949283..b7c2e4e2 100644 --- a/src/managers/CursorManager.cpp +++ b/src/managers/CursorManager.cpp @@ -291,8 +291,8 @@ void CCursorManager::updateTheme() { float highestScale = 1.0; for (auto const& m : g_pCompositor->m_monitors) { - if (m->scale > highestScale) - highestScale = m->scale; + if (m->m_scale > highestScale) + highestScale = m->m_scale; } m_fCursorScale = highestScale; @@ -308,7 +308,7 @@ void CCursorManager::updateTheme() { } for (auto const& m : g_pCompositor->m_monitors) { - m->forceFullFrames = 5; + m->m_forceFullFrames = 5; g_pCompositor->scheduleFrameForMonitor(m, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); } } diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 7d07a717..1bd7e1a2 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -49,16 +49,16 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL return {}; const auto PMONITOR = g_pCompositor->m_lastMonitor; - if (!PMONITOR || !PMONITOR->activeWorkspace) + if (!PMONITOR || !PMONITOR->m_activeWorkspace) return {}; std::vector<std::pair<std::string, std::string>> result; if (!pInitialWorkspace) { - if (PMONITOR->activeSpecialWorkspace) - pInitialWorkspace = PMONITOR->activeSpecialWorkspace; + if (PMONITOR->m_activeSpecialWorkspace) + pInitialWorkspace = PMONITOR->m_activeSpecialWorkspace; else - pInitialWorkspace = PMONITOR->activeWorkspace; + pInitialWorkspace = PMONITOR->m_activeWorkspace; } result.push_back(std::make_pair<>("HL_INITIAL_WORKSPACE_TOKEN", @@ -349,13 +349,13 @@ bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) { static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse"); static auto PNOWARPS = CConfigValue<Hyprlang::INT>("cursor:no_warps"); - const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace; - const auto PNEWMAINWORKSPACE = monitor->activeWorkspace; + const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace; + const auto PNEWMAINWORKSPACE = monitor->m_activeWorkspace; g_pInputManager->unconstrainMouse(); PNEWMAINWORKSPACE->rememberPrevWorkspace(PWORKSPACE); - const auto PNEWWORKSPACE = monitor->activeSpecialWorkspace ? monitor->activeSpecialWorkspace : PNEWMAINWORKSPACE; + const auto PNEWWORKSPACE = monitor->m_activeSpecialWorkspace ? monitor->m_activeSpecialWorkspace : PNEWMAINWORKSPACE; const auto PNEWWINDOW = PNEWWORKSPACE->getLastFocusedWindow(); if (PNEWWINDOW) { @@ -1196,7 +1196,7 @@ SDispatchResult CKeybindManager::centerWindow(std::string args) { auto RESERVEDOFFSET = Vector2D(); if (args == "1") - RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f; + RESERVEDOFFSET = (PMONITOR->m_reservedTopLeft - PMONITOR->m_reservedBottomRight) / 2.f; *PWINDOW->m_realPosition = PMONITOR->middle() - PWINDOW->m_realSize->goal() / 2.f + RESERVEDOFFSET; PWINDOW->m_position = PWINDOW->m_realPosition->goal(); @@ -1256,7 +1256,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) { if (!PMONITOR) return {.success = false, .error = "Last monitor not found"}; - const auto PCURRENTWORKSPACE = PMONITOR->activeWorkspace; + const auto PCURRENTWORKSPACE = PMONITOR->m_activeWorkspace; const bool EXPLICITPREVIOUS = args.contains("previous"); const auto& [workspaceToChangeTo, workspaceName] = getWorkspaceToChangeFromArgs(args, PCURRENTWORKSPACE, PMONITOR); @@ -1284,7 +1284,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) { auto pWorkspaceToChangeTo = g_pCompositor->getWorkspaceByID(BISWORKSPACECURRENT ? PPREVWS.id : workspaceToChangeTo); if (!pWorkspaceToChangeTo) pWorkspaceToChangeTo = - g_pCompositor->createNewWorkspace(BISWORKSPACECURRENT ? PPREVWS.id : workspaceToChangeTo, PMONITOR->ID, BISWORKSPACECURRENT ? PPREVWS.name : workspaceName); + g_pCompositor->createNewWorkspace(BISWORKSPACECURRENT ? PPREVWS.id : workspaceToChangeTo, PMONITOR->m_id, BISWORKSPACECURRENT ? PPREVWS.name : workspaceName); if (!BISWORKSPACECURRENT && pWorkspaceToChangeTo->m_isSpecialWorkspace) { PMONITOR->setSpecialWorkspace(pWorkspaceToChangeTo); @@ -1561,9 +1561,9 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { return {.success = false, .error = "last window has no monitor?"}; if (arg == 'l' || arg == 'r') { - if (STICKS(PLASTWINDOW->m_position.x, PMONITOR->vecPosition.x) && STICKS(PLASTWINDOW->m_size.x, PMONITOR->vecSize.x)) + if (STICKS(PLASTWINDOW->m_position.x, PMONITOR->m_position.x) && STICKS(PLASTWINDOW->m_size.x, PMONITOR->m_size.x)) return {.success = false, .error = "move does not make sense, would return back"}; - } else if (STICKS(PLASTWINDOW->m_position.y, PMONITOR->vecPosition.y) && STICKS(PLASTWINDOW->m_size.y, PMONITOR->vecSize.y)) + } else if (STICKS(PLASTWINDOW->m_position.y, PMONITOR->m_position.y) && STICKS(PLASTWINDOW->m_size.y, PMONITOR->m_size.y)) return {.success = false, .error = "move does not make sense, would return back"}; CBox box = PMONITOR->logicalBox(); @@ -1588,8 +1588,8 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) { break; } - const auto PWINDOWCANDIDATE = g_pCompositor->getWindowInDirection(box, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace, arg, - PLASTWINDOW, PLASTWINDOW->m_isFloating); + const auto PWINDOWCANDIDATE = g_pCompositor->getWindowInDirection(box, PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace, + arg, PLASTWINDOW, PLASTWINDOW->m_isFloating); if (PWINDOWCANDIDATE) switchToWindow(PWINDOWCANDIDATE); @@ -1661,9 +1661,9 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) { return {.success = false, .error = std::format("Monitor {} not found", args.substr(4))}; if (silent) - moveActiveToWorkspaceSilent(PNEWMONITOR->activeWorkspace->getConfigName()); + moveActiveToWorkspaceSilent(PNEWMONITOR->m_activeWorkspace->getConfigName()); else - moveActiveToWorkspace(PNEWMONITOR->activeWorkspace->getConfigName()); + moveActiveToWorkspace(PNEWMONITOR->m_activeWorkspace->getConfigName()); return {}; } @@ -1687,12 +1687,12 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) { const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize(); switch (arg) { - case 'l': vPosx = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break; - case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_realSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break; + case 'l': vPosx = PMONITOR->m_reservedTopLeft.x + BORDERSIZE + PMONITOR->m_position.x; break; + case 'r': vPosx = PMONITOR->m_size.x - PMONITOR->m_reservedBottomRight.x - PLASTWINDOW->m_realSize->goal().x - BORDERSIZE + PMONITOR->m_position.x; break; case 't': - case 'u': vPosy = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break; + case 'u': vPosy = PMONITOR->m_reservedTopLeft.y + BORDERSIZE + PMONITOR->m_position.y; break; case 'b': - case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_realSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break; + case 'd': vPosy = PMONITOR->m_size.y - PMONITOR->m_reservedBottomRight.y - PLASTWINDOW->m_realSize->goal().y - BORDERSIZE + PMONITOR->m_position.y; break; } *PLASTWINDOW->m_realPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_realPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_realPosition->goal().y)); @@ -1720,7 +1720,7 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) { if (!PMONITORTOCHANGETO) return {.success = false, .error = "Nowhere to move active window to"}; - const auto PWORKSPACE = PMONITORTOCHANGETO->activeWorkspace; + const auto PWORKSPACE = PMONITORTOCHANGETO->m_activeWorkspace; if (silent) moveActiveToWorkspaceSilent(PWORKSPACE->getConfigName()); else @@ -1919,7 +1919,7 @@ SDispatchResult CKeybindManager::moveCursor(std::string args) { SDispatchResult CKeybindManager::workspaceOpt(std::string args) { // current workspace - const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace; + const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace; if (!PWORKSPACE) return {.success = false, .error = "Workspace not found"}; // ???? @@ -1966,7 +1966,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { } // recalc mon - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_lastMonitor->ID); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(g_pCompositor->m_lastMonitor->m_id); return {}; } @@ -2012,7 +2012,7 @@ SDispatchResult CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) } // get the current workspace - const auto PCURRENTWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace; + const auto PCURRENTWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace; if (!PCURRENTWORKSPACE) { Debug::log(ERR, "moveCurrentWorkspaceToMonitor invalid workspace!"); return {.success = false, .error = "moveCurrentWorkspaceToMonitor invalid workspace!"}; @@ -2073,7 +2073,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args auto pWorkspace = g_pCompositor->getWorkspaceByID(workspaceID); if (!pWorkspace) { - pWorkspace = g_pCompositor->createNewWorkspace(workspaceID, PCURRMONITOR->ID, workspaceName); + pWorkspace = g_pCompositor->createNewWorkspace(workspaceID, PCURRMONITOR->m_id, workspaceName); // we can skip the moving, since it's already on the current monitor changeworkspace(pWorkspace->getConfigName()); return {}; @@ -2086,7 +2086,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args // Workspace to focus is previous workspace pWorkspace = g_pCompositor->getWorkspaceByID(PREVWS.id); if (!pWorkspace) - pWorkspace = g_pCompositor->createNewWorkspace(PREVWS.id, PCURRMONITOR->ID, PREVWS.name); + pWorkspace = g_pCompositor->createNewWorkspace(PREVWS.id, PCURRMONITOR->m_id, PREVWS.name); workspaceID = pWorkspace->m_id; } @@ -2137,13 +2137,13 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) { Debug::log(LOG, "Toggling special workspace {} to closed", workspaceID); PMONITOR->setSpecialWorkspace(nullptr); - focusedWorkspace = PMONITOR->activeWorkspace; + focusedWorkspace = PMONITOR->m_activeWorkspace; } else { Debug::log(LOG, "Toggling special workspace {} to open", workspaceID); auto PSPECIALWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceID); if (!PSPECIALWORKSPACE) - PSPECIALWORKSPACE = g_pCompositor->createNewWorkspace(workspaceID, PMONITOR->ID, workspaceName); + PSPECIALWORKSPACE = g_pCompositor->createNewWorkspace(workspaceID, PMONITOR->m_id, workspaceName); PMONITOR->setSpecialWorkspace(PSPECIALWORKSPACE); @@ -2167,7 +2167,7 @@ SDispatchResult CKeybindManager::forceRendererReload(std::string args) { bool overAgain = false; for (auto const& m : g_pCompositor->m_monitors) { - if (!m->output) + if (!m->m_output) continue; auto rule = g_pConfigManager->getMonitorRuleFor(m); @@ -2274,7 +2274,7 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) { SDispatchResult CKeybindManager::circleNext(std::string arg) { if (g_pCompositor->m_lastWindow.expired()) { // if we have a clear focus, find the first window and get the next focusable. - const auto PWS = g_pCompositor->m_lastMonitor->activeWorkspace; + const auto PWS = g_pCompositor->m_lastMonitor->m_activeWorkspace; if (PWS && PWS->getWindows() > 0) { const auto PWINDOW = PWS->getFirstWindow(); switchToWindow(PWINDOW); @@ -2319,8 +2319,8 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) { updateRelativeCursorCoords(); - if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_workspace && - g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_workspace) { + if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->m_activeWorkspace != PWINDOW->m_workspace && + g_pCompositor->m_lastMonitor->m_activeSpecialWorkspace != PWINDOW->m_workspace) { Debug::log(LOG, "Fake executing workspace to move focus"); changeworkspace(PWORKSPACE->getConfigName()); } @@ -2670,19 +2670,19 @@ SDispatchResult CKeybindManager::dpms(std::string arg) { for (auto const& m : g_pCompositor->m_monitors) { - if (!port.empty() && m->szName != port) + if (!port.empty() && m->m_name != port) continue; if (isToggle) - enable = !m->dpmsStatus; + enable = !m->m_dpmsStatus; - m->output->state->resetExplicitFences(); - m->output->state->setEnabled(enable); + m->m_output->state->resetExplicitFences(); + m->m_output->state->setEnabled(enable); - m->dpmsStatus = enable; + m->m_dpmsStatus = enable; - if (!m->state.commit()) { - Debug::log(ERR, "Couldn't commit output {}", m->szName); + if (!m->m_state.commit()) { + Debug::log(ERR, "Couldn't commit output {}", m->m_name); res.success = false; res.error = "Couldn't commit output {}"; } @@ -2690,7 +2690,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) { if (enable) g_pHyprRenderer->damageMonitor(m); - m->events.dpmsChanged.emit(); + m->m_events.dpmsChanged.emit(); } g_pCompositor->m_dpmsStateOn = enable; @@ -2774,7 +2774,7 @@ SDispatchResult CKeybindManager::pinActive(std::string args) { return {.success = false, .error = "pin: window not found"}; } - PWINDOW->m_workspace = PMONITOR->activeWorkspace; + PWINDOW->m_workspace = PMONITOR->m_activeWorkspace; PWINDOW->updateDynamicRules(); g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW); @@ -3274,7 +3274,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) { } for (auto const& m : g_pCompositor->m_monitors) - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->m_id); return {}; } diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 1c9036bf..1dcc0107 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -29,9 +29,9 @@ CPointerManager::CPointerManager() { onMonitorLayoutChange(); - PMONITOR->events.modeChanged.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr); - PMONITOR->events.disconnect.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr); - PMONITOR->events.destroy.registerStaticListener( + PMONITOR->m_events.modeChanged.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr); + PMONITOR->m_events.disconnect.registerStaticListener([this](void* owner, std::any data) { g_pEventLoopManager->doLater([this]() { onMonitorLayoutChange(); }); }, nullptr); + PMONITOR->m_events.destroy.registerStaticListener( [this](void* owner, std::any data) { if (g_pCompositor && !g_pCompositor->m_isShuttingDown) std::erase_if(monitorStates, [](const auto& other) { return other->monitor.expired(); }); @@ -179,7 +179,7 @@ void CPointerManager::recheckEnteredOutputs() { auto box = getCursorBoxGlobal(); for (auto const& s : monitorStates) { - if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled) + if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_enabled) continue; const bool overlaps = box.overlaps(s->monitor->logicalBox()); @@ -191,14 +191,15 @@ void CPointerManager::recheckEnteredOutputs() { continue; currentCursorImage.surface->resource()->enter(s->monitor.lock()); - PROTO::fractional->sendScale(currentCursorImage.surface->resource(), s->monitor->scale); - g_pCompositor->setPreferredScaleForSurface(currentCursorImage.surface->resource(), s->monitor->scale); + PROTO::fractional->sendScale(currentCursorImage.surface->resource(), s->monitor->m_scale); + g_pCompositor->setPreferredScaleForSurface(currentCursorImage.surface->resource(), s->monitor->m_scale); } else if (s->entered && !overlaps) { s->entered = false; // if we are using hw cursors, prevent // the cursor from being stuck at the last point. - if (!s->hardwareFailed && (s->monitor->output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER)) + if (!s->hardwareFailed && + (s->monitor->m_output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER)) setHWCursorBuffer(s, nullptr); if (!currentCursorImage.surface) @@ -232,7 +233,7 @@ void CPointerManager::resetCursorImage(bool apply) { currentCursorImage.hotspot = {0, 0}; for (auto const& s : monitorStates) { - if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled) + if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_enabled) continue; s->entered = false; @@ -242,14 +243,14 @@ void CPointerManager::resetCursorImage(bool apply) { return; for (auto const& ms : monitorStates) { - if (!ms->monitor || !ms->monitor->m_bEnabled || !ms->monitor->dpmsStatus) { + if (!ms->monitor || !ms->monitor->m_enabled || !ms->monitor->m_dpmsStatus) { Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display"); continue; } if (ms->cursorFrontBuffer) { - if (ms->monitor->output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER) - ms->monitor->output->setCursor(nullptr, {}); + if (ms->monitor->m_output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER) + ms->monitor->m_output->setCursor(nullptr, {}); ms->cursorFrontBuffer = nullptr; } } @@ -259,7 +260,7 @@ void CPointerManager::updateCursorBackend() { const auto CURSORBOX = getCursorBoxGlobal(); for (auto const& m : g_pCompositor->m_monitors) { - if (!m->m_bEnabled || !m->dpmsStatus) { + if (!m->m_enabled || !m->m_dpmsStatus) { Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display"); continue; } @@ -275,7 +276,7 @@ void CPointerManager::updateCursorBackend() { } if (state->softwareLocks > 0 || g_pConfigManager->shouldUseSoftwareCursors(m) || !attemptHardwareCursor(state)) { - Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName); + Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->m_name); state->box = getCursorBoxLogicalForMonitor(state->monitor.lock()); state->hardwareFailed = true; @@ -305,11 +306,11 @@ void CPointerManager::onCursorMoved() { auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty(); if (!CROSSES && state->cursorFrontBuffer) { - Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->szName); + Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->m_name); setHWCursorBuffer(state, nullptr); continue; } else if (CROSSES && !state->cursorFrontBuffer) { - Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->szName); + Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->m_name); recalc = true; } @@ -322,9 +323,9 @@ void CPointerManager::onCursorMoved() { continue; const auto CURSORPOS = getCursorPosForMonitor(m); - m->output->moveCursor(CURSORPOS, m->shouldSkipScheduleFrameOnMouseEvent()); + m->m_output->moveCursor(CURSORPOS, m->shouldSkipScheduleFrameOnMouseEvent()); - state->monitor->scanoutNeedsCursorUpdate = true; + state->monitor->m_scanoutNeedsCursorUpdate = true; } if (recalc) @@ -332,13 +333,13 @@ void CPointerManager::onCursorMoved() { } bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerState> state) { - auto output = state->monitor->output; + auto output = state->monitor->m_output; if (!(output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER)) return false; const auto CURSORPOS = getCursorPosForMonitor(state->monitor.lock()); - state->monitor->output->moveCursor(CURSORPOS, state->monitor->shouldSkipScheduleFrameOnMouseEvent()); + state->monitor->m_output->moveCursor(CURSORPOS, state->monitor->shouldSkipScheduleFrameOnMouseEvent()); auto texture = getCurrentCursorTexture(); @@ -369,14 +370,14 @@ bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerS } bool CPointerManager::setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquamarine::IBuffer> buf) { - if (!(state->monitor->output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER)) + if (!(state->monitor->m_output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER)) return false; const auto HOTSPOT = transformedHotspot(state->monitor.lock()); - Debug::log(TRACE, "[pointer] hw transformed hotspot for {}: {}", state->monitor->szName, HOTSPOT); + Debug::log(TRACE, "[pointer] hw transformed hotspot for {}: {}", state->monitor->m_name, HOTSPOT); - if (!state->monitor->output->setCursor(buf, HOTSPOT)) + if (!state->monitor->m_output->setCursor(buf, HOTSPOT)) return false; state->cursorFrontBuffer = buf; @@ -384,13 +385,13 @@ bool CPointerManager::setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquam if (!state->monitor->shouldSkipScheduleFrameOnMouseEvent()) g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); - state->monitor->scanoutNeedsCursorUpdate = true; + state->monitor->m_scanoutNeedsCursorUpdate = true; return true; } SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager::SMonitorPointerState> state, SP<CTexture> texture) { - auto maxSize = state->monitor->output->cursorPlaneSize(); + auto maxSize = state->monitor->m_output->cursorPlaneSize(); auto const& cursorSize = currentCursorImage.size; static auto PCPUBUFFER = CConfigValue<Hyprlang::INT>("cursor:use_cpu_buffer"); @@ -408,14 +409,14 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager } else maxSize = cursorSize; - if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || - shouldUseCpuBuffer != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { + if (!state->monitor->m_cursorSwapchain || maxSize != state->monitor->m_cursorSwapchain->currentOptions().size || + shouldUseCpuBuffer != (state->monitor->m_cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { - if (!state->monitor->cursorSwapchain || shouldUseCpuBuffer != (state->monitor->cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { + if (!state->monitor->m_cursorSwapchain || shouldUseCpuBuffer != (state->monitor->m_cursorSwapchain->getAllocator()->type() != Aquamarine::AQ_ALLOCATOR_TYPE_GBM)) { - auto allocator = state->monitor->output->getBackend()->preferredAllocator(); + auto allocator = state->monitor->m_output->getBackend()->preferredAllocator(); if (shouldUseCpuBuffer) { - for (const auto& a : state->monitor->output->getBackend()->getAllocators()) { + for (const auto& a : state->monitor->m_output->getBackend()->getAllocators()) { if (a->type() == Aquamarine::AQ_ALLOCATOR_TYPE_DRM_DUMB) { allocator = a; break; @@ -423,23 +424,23 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager } } - auto backend = state->monitor->output->getBackend(); - auto primary = backend->getPrimary(); - state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(allocator, primary ? primary.lock() : backend); + auto backend = state->monitor->m_output->getBackend(); + auto primary = backend->getPrimary(); + state->monitor->m_cursorSwapchain = Aquamarine::CSwapchain::create(allocator, primary ? primary.lock() : backend); } - auto options = state->monitor->cursorSwapchain->currentOptions(); + auto options = state->monitor->m_cursorSwapchain->currentOptions(); options.size = maxSize; options.length = 2; options.scanout = true; options.cursor = true; - options.multigpu = state->monitor->output->getBackend()->preferredAllocator()->drmFD() != g_pCompositor->m_drmFD; + options.multigpu = state->monitor->m_output->getBackend()->preferredAllocator()->drmFD() != g_pCompositor->m_drmFD; // We do not set the format (unless shm). If it's unset (DRM_FORMAT_INVALID) then the swapchain will pick for us, // but if it's set, we don't wanna change it. if (shouldUseCpuBuffer) options.format = DRM_FORMAT_ARGB8888; - if (!state->monitor->cursorSwapchain->reconfigure(options)) { + if (!state->monitor->m_cursorSwapchain->reconfigure(options)) { Debug::log(TRACE, "Failed to reconfigure cursor swapchain"); return nullptr; } @@ -449,11 +450,11 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager // the current front buffer // this flag will be reset in the preRender hook, so when we commit this buffer to KMS if (state->cursorRendered) - state->monitor->cursorSwapchain->rollback(); + state->monitor->m_cursorSwapchain->rollback(); state->cursorRendered = true; - auto buf = state->monitor->cursorSwapchain->next(nullptr); + auto buf = state->monitor->m_cursorSwapchain->next(nullptr); if (!buf) { Debug::log(TRACE, "Failed to acquire a buffer from the cursor swapchain"); return nullptr; @@ -519,10 +520,10 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager cairo_matrix_t matrixPre; cairo_matrix_init_identity(&matrixPre); - const auto TR = state->monitor->transform; + const auto TR = state->monitor->m_transform; // we need to scale the cursor to the right size, because it might not be (esp with XCursor) - const auto SCALE = texture->m_vSize / (currentCursorImage.size / currentCursorImage.scale * state->monitor->scale); + const auto SCALE = texture->m_vSize / (currentCursorImage.size / currentCursorImage.scale * state->monitor->m_scale); cairo_matrix_scale(&matrixPre, SCALE.x, SCALE.y); if (TR) { @@ -565,7 +566,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager g_pHyprRenderer->makeEGLCurrent(); g_pHyprOpenGL->m_RenderData.pMonitor = state->monitor; - auto RBO = g_pHyprRenderer->getOrCreateRenderbuffer(buf, state->monitor->cursorSwapchain->currentOptions().format); + auto RBO = g_pHyprRenderer->getOrCreateRenderbuffer(buf, state->monitor->m_cursorSwapchain->currentOptions().format); if (!RBO) { Debug::log(TRACE, "Failed to create cursor RB with format {}, mod {}", buf->dmabuf().format, buf->dmabuf().modifier); return nullptr; @@ -576,9 +577,9 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager g_pHyprOpenGL->beginSimple(state->monitor.lock(), {0, 0, INT16_MAX, INT16_MAX}, RBO); g_pHyprOpenGL->clear(CHyprColor{0.F, 0.F, 0.F, 0.F}); - CBox xbox = {{}, Vector2D{currentCursorImage.size / currentCursorImage.scale * state->monitor->scale}.round()}; - Debug::log(TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->szName, currentCursorImage.size, cursorSize, - currentCursorImage.scale, state->monitor->scale, xbox.size()); + CBox xbox = {{}, Vector2D{currentCursorImage.size / currentCursorImage.scale * state->monitor->m_scale}.round()}; + Debug::log(TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->m_name, currentCursorImage.size, cursorSize, + currentCursorImage.scale, state->monitor->m_scale, xbox.size()); g_pHyprOpenGL->renderTexture(texture, xbox, 1.F); @@ -609,14 +610,14 @@ void CPointerManager::renderSoftwareCursorsFor(PHLMONITOR pMonitor, const Time:: box.y = overridePos->y; } - if (box.intersection(CBox{{}, {pMonitor->vecSize}}).empty()) + if (box.intersection(CBox{{}, {pMonitor->m_size}}).empty()) return; auto texture = getCurrentCursorTexture(); if (!texture) return; - box.scale(pMonitor->scale); + box.scale(pMonitor->m_scale); box.x = std::round(box.x); box.y = std::round(box.y); @@ -631,25 +632,25 @@ void CPointerManager::renderSoftwareCursorsFor(PHLMONITOR pMonitor, const Time:: } Vector2D CPointerManager::getCursorPosForMonitor(PHLMONITOR pMonitor) { - return CBox{pointerPos - pMonitor->vecPosition, {0, 0}} - .transform(wlTransformToHyprutils(invertTransform(pMonitor->transform)), pMonitor->vecTransformedSize.x / pMonitor->scale, - pMonitor->vecTransformedSize.y / pMonitor->scale) + return CBox{pointerPos - pMonitor->m_position, {0, 0}} + .transform(wlTransformToHyprutils(invertTransform(pMonitor->m_transform)), pMonitor->m_transformedSize.x / pMonitor->m_scale, + pMonitor->m_transformedSize.y / pMonitor->m_scale) .pos() * - pMonitor->scale; + pMonitor->m_scale; } Vector2D CPointerManager::transformedHotspot(PHLMONITOR pMonitor) { - if (!pMonitor->cursorSwapchain) + if (!pMonitor->m_cursorSwapchain) return {}; // doesn't matter, we have no hw cursor, and this is only for hw cursors - return CBox{currentCursorImage.hotspot * pMonitor->scale, {0, 0}} - .transform(wlTransformToHyprutils(invertTransform(pMonitor->transform)), pMonitor->cursorSwapchain->currentOptions().size.x, - pMonitor->cursorSwapchain->currentOptions().size.y) + return CBox{currentCursorImage.hotspot * pMonitor->m_scale, {0, 0}} + .transform(wlTransformToHyprutils(invertTransform(pMonitor->m_transform)), pMonitor->m_cursorSwapchain->currentOptions().size.x, + pMonitor->m_cursorSwapchain->currentOptions().size.y) .pos(); } CBox CPointerManager::getCursorBoxLogicalForMonitor(PHLMONITOR pMonitor) { - return getCursorBoxGlobal().translate(-pMonitor->vecPosition); + return getCursorBoxGlobal().translate(-pMonitor->m_position); } CBox CPointerManager::getCursorBoxGlobal() { @@ -736,11 +737,11 @@ void CPointerManager::damageIfSoftware() { auto b = getCursorBoxGlobal().expand(4); for (auto const& mw : monitorStates) { - if (mw->monitor.expired() || !mw->monitor->output) + if (mw->monitor.expired() || !mw->monitor->m_output) continue; if ((mw->softwareLocks > 0 || mw->hardwareFailed || g_pConfigManager->shouldUseSoftwareCursors(mw->monitor.lock())) && - b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) { + b.overlaps({mw->monitor->m_position, mw->monitor->m_size})) { g_pHyprRenderer->damageBox(b, mw->monitor->shouldSkipScheduleFrameOnMouseEvent()); break; } @@ -778,7 +779,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) { // find x and y size of the entire space const auto& MONITORS = g_pCompositor->m_monitors; - Vector2D topLeft = MONITORS.at(0)->vecPosition, bottomRight = MONITORS.at(0)->vecPosition + MONITORS.at(0)->vecSize; + Vector2D topLeft = MONITORS.at(0)->m_position, bottomRight = MONITORS.at(0)->m_position + MONITORS.at(0)->m_size; for (size_t i = 1; i < MONITORS.size(); ++i) { const auto EXTENT = MONITORS[i]->logicalBox().extent(); const auto POS = MONITORS[i]->logicalBox().pos(); @@ -852,10 +853,10 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) { void CPointerManager::onMonitorLayoutChange() { currentMonitorLayout.monitorBoxes.clear(); for (auto const& m : g_pCompositor->m_monitors) { - if (m->isMirror() || !m->m_bEnabled || !m->output) + if (m->isMirror() || !m->m_enabled || !m->m_output) continue; - currentMonitorLayout.monitorBoxes.emplace_back(m->vecPosition, m->vecSize); + currentMonitorLayout.monitorBoxes.emplace_back(m->m_position, m->m_size); } damageIfSoftware(); diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp index 7f51d09f..2de13da0 100644 --- a/src/managers/ProtocolManager.cpp +++ b/src/managers/ProtocolManager.cpp @@ -84,12 +84,12 @@ void CProtocolManager::onMonitorModeChange(PHLMONITOR pMonitor) { // mirrored outputs should have their global removed, as they are not physical parts of the // layout. - if (ISMIRROR && PROTO::outputs.contains(pMonitor->szName)) - PROTO::outputs.at(pMonitor->szName)->remove(); - else if (!ISMIRROR && (!PROTO::outputs.contains(pMonitor->szName) || PROTO::outputs.at(pMonitor->szName)->isDefunct())) { - if (PROTO::outputs.contains(pMonitor->szName)) - PROTO::outputs.erase(pMonitor->szName); - PROTO::outputs.emplace(pMonitor->szName, makeShared<CWLOutputProtocol>(&wl_output_interface, 4, std::format("WLOutput ({})", pMonitor->szName), pMonitor->self.lock())); + if (ISMIRROR && PROTO::outputs.contains(pMonitor->m_name)) + PROTO::outputs.at(pMonitor->m_name)->remove(); + else if (!ISMIRROR && (!PROTO::outputs.contains(pMonitor->m_name) || PROTO::outputs.at(pMonitor->m_name)->isDefunct())) { + if (PROTO::outputs.contains(pMonitor->m_name)) + PROTO::outputs.erase(pMonitor->m_name); + PROTO::outputs.emplace(pMonitor->m_name, makeShared<CWLOutputProtocol>(&wl_output_interface, 4, std::format("WLOutput ({})", pMonitor->m_name), pMonitor->m_self.lock())); } if (PROTO::colorManagement && g_pCompositor->shouldChangePreferredImageDescription()) { @@ -115,22 +115,22 @@ CProtocolManager::CProtocolManager() { if (M->isMirror() || M == g_pCompositor->m_unsafeOutput) return; - if (PROTO::outputs.contains(M->szName)) - PROTO::outputs.erase(M->szName); + if (PROTO::outputs.contains(M->m_name)) + PROTO::outputs.erase(M->m_name); - auto ref = makeShared<CWLOutputProtocol>(&wl_output_interface, 4, std::format("WLOutput ({})", M->szName), M->self.lock()); - PROTO::outputs.emplace(M->szName, ref); + auto ref = makeShared<CWLOutputProtocol>(&wl_output_interface, 4, std::format("WLOutput ({})", M->m_name), M->m_self.lock()); + PROTO::outputs.emplace(M->m_name, ref); ref->self = ref; - m_mModeChangeListeners[M->szName] = M->events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); }); + m_mModeChangeListeners[M->m_name] = M->m_events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); }); }); static auto P2 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) { auto M = std::any_cast<PHLMONITOR>(param); - if (!PROTO::outputs.contains(M->szName)) + if (!PROTO::outputs.contains(M->m_name)) return; - PROTO::outputs.at(M->szName)->remove(); - m_mModeChangeListeners.erase(M->szName); + PROTO::outputs.at(M->m_name)->remove(); + m_mModeChangeListeners.erase(M->m_name); }); // Core diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index ecca3c96..83a238a6 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -67,8 +67,8 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { const auto PMONITOR = SURFACE->monitor(); const auto NEWSURFACE = m_pSessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(SURFACE)).get(); - NEWSURFACE->iMonitorID = PMONITOR->ID; - PROTO::fractional->sendScale(SURFACE->surface(), PMONITOR->scale); + NEWSURFACE->iMonitorID = PMONITOR->m_id; + PROTO::fractional->sendScale(SURFACE->surface(), PMONITOR->m_scale); }); m_pSessionLock->listeners.unlock = pLock->events.unlockAndDestroy.registerListener([this](std::any data) { @@ -138,7 +138,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) { if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked) return; m_pSessionLock->m_lockedMonitors.emplace(id); - const bool LOCKED = std::ranges::all_of(g_pCompositor->m_monitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); }); + const bool LOCKED = std::ranges::all_of(g_pCompositor->m_monitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->m_id); }); if (LOCKED && m_pSessionLock->lock->good()) { m_pSessionLock->lock->sendLocked(); m_pSessionLock->m_hasSentLocked = true; diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index c5cf77f5..62852c2f 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -170,9 +170,9 @@ Vector2D CHyprXWaylandManager::waylandToXWaylandCoords(const Vector2D& coord) { PHLMONITOR pMonitor = nullptr; double bestDistance = __FLT_MAX__; for (const auto& m : g_pCompositor->m_monitors) { - const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize; + const auto SIZ = *PXWLFORCESCALEZERO ? m->m_transformedSize : m->m_size; - double distance = vecToRectDistanceSquared(coord, {m->vecPosition.x, m->vecPosition.y}, {m->vecPosition.x + SIZ.x - 1, m->vecPosition.y + SIZ.y - 1}); + double distance = vecToRectDistanceSquared(coord, {m->m_position.x, m->m_position.y}, {m->m_position.x + SIZ.x - 1, m->m_position.y + SIZ.y - 1}); if (distance < bestDistance) { bestDistance = distance; @@ -184,12 +184,12 @@ Vector2D CHyprXWaylandManager::waylandToXWaylandCoords(const Vector2D& coord) { return Vector2D{}; // get local coords - Vector2D result = coord - pMonitor->vecPosition; + Vector2D result = coord - pMonitor->m_position; // if scaled, scale if (*PXWLFORCESCALEZERO) - result *= pMonitor->scale; + result *= pMonitor->m_scale; // add pos - result += pMonitor->vecXWaylandPosition; + result += pMonitor->m_xwaylandPosition; return result; } @@ -201,10 +201,10 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) { PHLMONITOR pMonitor = nullptr; double bestDistance = __FLT_MAX__; for (const auto& m : g_pCompositor->m_monitors) { - const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize; + const auto SIZ = *PXWLFORCESCALEZERO ? m->m_transformedSize : m->m_size; double distance = - vecToRectDistanceSquared(coord, {m->vecXWaylandPosition.x, m->vecXWaylandPosition.y}, {m->vecXWaylandPosition.x + SIZ.x - 1, m->vecXWaylandPosition.y + SIZ.y - 1}); + vecToRectDistanceSquared(coord, {m->m_xwaylandPosition.x, m->m_xwaylandPosition.y}, {m->m_xwaylandPosition.x + SIZ.x - 1, m->m_xwaylandPosition.y + SIZ.y - 1}); if (distance < bestDistance) { bestDistance = distance; @@ -216,12 +216,12 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) { return Vector2D{}; // get local coords - Vector2D result = coord - pMonitor->vecXWaylandPosition; + Vector2D result = coord - pMonitor->m_xwaylandPosition; // if scaled, unscale if (*PXWLFORCESCALEZERO) - result /= pMonitor->scale; + result /= pMonitor->m_scale; // add pos - result += pMonitor->vecPosition; + result += pMonitor->m_position; return result; } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index ab5e59a0..e1856f1d 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -217,7 +217,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { bool skipFrameSchedule = PMONITOR->shouldSkipScheduleFrameOnMouseEvent(); - if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) && !skipFrameSchedule) + if (!PMONITOR->m_solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) && !skipFrameSchedule) g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); // constraints @@ -252,13 +252,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (g_pSessionLockManager->isSessionLocked()) { // set keyboard focus on session lock surface regardless of layers - const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID); + const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id); const auto foundLockSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr; g_pCompositor->focusSurface(foundLockSurface); // search for interactable abovelock surfaces for pointer focus, or use session lock surface if not found - for (auto& lsl : PMONITOR->m_aLayerSurfaceLayers | std::views::reverse) { + for (auto& lsl : PMONITOR->m_layerSurfaceLayers | std::views::reverse) { foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &lsl, &surfaceCoords, &pFoundLayerSurface, true); if (foundSurface) @@ -266,7 +266,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { } if (!foundSurface) { - surfaceCoords = mouseCoords - PMONITOR->vecPosition; + surfaceCoords = mouseCoords - PMONITOR->m_position; foundSurface = foundLockSurface; } @@ -336,7 +336,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { // overlays are above fullscreen if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); // also IME popups if (!foundSurface) { @@ -349,10 +349,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { // also top layers if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); // then, we check if the workspace doesnt have a fullscreen window - const auto PWORKSPACE = PMONITOR->activeWorkspace; + const auto PWORKSPACE = PMONITOR->m_activeWorkspace; const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) { pFoundWindow = PWORKSPACE->getFullscreenWindow(); @@ -365,7 +365,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (PWINDOWIDEAL && ((PWINDOWIDEAL->m_isFloating && PWINDOWIDEAL->m_createdOverFullscreen) /* floating over fullscreen */ - || (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */)) + || (PMONITOR->m_activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */)) pFoundWindow = PWINDOWIDEAL; if (!pFoundWindow->m_isX11) { @@ -381,7 +381,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { if (!foundSurface) { if (PWORKSPACE->m_hasFullscreenWindow && PWORKSPACE->m_fullscreenMode == FSMODE_MAXIMIZED) { if (!foundSurface) { - if (PMONITOR->activeSpecialWorkspace) { + if (PMONITOR->m_activeSpecialWorkspace) { if (pFoundWindow != PWINDOWIDEAL) pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); @@ -391,7 +391,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { } else { // if we have a maximized window, allow focusing on a bar or something if in reserved area. if (g_pCompositor->isPointOnReservedArea(mouseCoords, PMONITOR)) { - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); } @@ -426,13 +426,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { // then surfaces below if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) - foundSurface = - g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); - if (g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) > 0 && !skipFrameSchedule) + if (g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) > 0 && !skipFrameSchedule) g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_lastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE); // FIXME: This will be disabled during DnD operations because we do not exactly follow the spec @@ -1471,14 +1470,14 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { // then any surfaces above windows on the same monitor if (!foundSurface) { - foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], + foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) foundSurface = nullptr; } if (!foundSurface) { - foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], + foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); if (pFoundLayerSurface && pFoundLayerSurface->m_interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND) foundSurface = nullptr; @@ -1636,7 +1635,7 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) { PTOUCHDEV->m_boundOutput = bound ? output : ""; const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr; if (PMONITOR) { - Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->szName); + Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->m_name); // wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, &PTOUCHDEV->wlr()->base, PMONITOR->output); } else if (bound) Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output); diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp index db08c026..d0706bad 100644 --- a/src/managers/input/InputMethodPopup.cpp +++ b/src/managers/input/InputMethodPopup.cpp @@ -40,7 +40,7 @@ void CInputPopup::onMap() { if (!PMONITOR) return; - PROTO::fractional->sendScale(surface->resource(), PMONITOR->scale); + PROTO::fractional->sendScale(surface->resource(), PMONITOR->m_scale); } void CInputPopup::onUnmap() { @@ -108,12 +108,12 @@ void CInputPopup::updateBox() { Vector2D popupOffset(0, 0); - if (parentBox.y + cursorBoxParent.y + cursorBoxParent.height + currentPopupSize.y > pMonitor->vecPosition.y + pMonitor->vecSize.y) + if (parentBox.y + cursorBoxParent.y + cursorBoxParent.height + currentPopupSize.y > pMonitor->m_position.y + pMonitor->m_size.y) popupOffset.y -= currentPopupSize.y; else popupOffset.y = cursorBoxParent.height; - double popupOverflow = parentBox.x + cursorBoxParent.x + currentPopupSize.x - (pMonitor->vecPosition.x + pMonitor->vecSize.x); + double popupOverflow = parentBox.x + cursorBoxParent.x + currentPopupSize.x - (pMonitor->m_position.x + pMonitor->m_size.x); if (popupOverflow > 0) popupOffset.x -= popupOverflow; @@ -127,15 +127,15 @@ void CInputPopup::updateBox() { } damageSurface(); - if (const auto PM = g_pCompositor->getMonitorFromCursor(); PM && PM->ID != lastMonitor) { + if (const auto PM = g_pCompositor->getMonitorFromCursor(); PM && PM->m_id != lastMonitor) { const auto PML = g_pCompositor->getMonitorFromID(lastMonitor); if (PML) - surface->resource()->leave(PML->self.lock()); + surface->resource()->leave(PML->m_self.lock()); - surface->resource()->enter(PM->self.lock()); + surface->resource()->enter(PM->m_self.lock()); - lastMonitor = PM->ID; + lastMonitor = PM->m_id; } } diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index c6916ee0..62c0332a 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -29,7 +29,7 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) { } void CInputManager::beginWorkspaceSwipe() { - const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace; + const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace; Debug::log(LOG, "Starting a swipe from {}", PWORKSPACE->m_name); @@ -40,7 +40,7 @@ void CInputManager::beginWorkspaceSwipe() { m_sActiveSwipe.speedPoints = 0; if (PWORKSPACE->m_hasFullscreenWindow) { - for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { + for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) { *ls->m_alpha = 1.f; } } @@ -79,8 +79,8 @@ void CInputManager::endWorkspaceSwipe() { auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->value(); - const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; - const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; + const auto XDISTANCE = m_sActiveSwipe.pMonitor->m_size.x + *PWORKSPACEGAP; + const auto YDISTANCE = m_sActiveSwipe.pMonitor->m_size.y + *PWORKSPACEGAP; PHLWORKSPACE pSwitchedTo = nullptr; @@ -122,7 +122,7 @@ void CInputManager::endWorkspaceSwipe() { if (PWORKSPACEL) m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDLeft); else { - m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDLeft, m_sActiveSwipe.pMonitor->ID)); + m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDLeft, m_sActiveSwipe.pMonitor->m_id)); PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); PWORKSPACEL->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin); } @@ -149,7 +149,7 @@ void CInputManager::endWorkspaceSwipe() { if (PWORKSPACER) m_sActiveSwipe.pMonitor->changeWorkspace(workspaceIDRight); else { - m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDRight, m_sActiveSwipe.pMonitor->ID)); + m_sActiveSwipe.pMonitor->changeWorkspace(g_pCompositor->createNewWorkspace(workspaceIDRight, m_sActiveSwipe.pMonitor->m_id)); PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight); PWORKSPACER->rememberPrevWorkspace(m_sActiveSwipe.pWorkspaceBegin); } @@ -186,7 +186,7 @@ void CInputManager::endWorkspaceSwipe() { g_pInputManager->refocus(); // apply alpha - for (auto const& ls : g_pCompositor->m_lastMonitor->m_aLayerSurfaceLayers[2]) { + for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) { *ls->m_alpha = pSwitchedTo->m_hasFullscreenWindow && pSwitchedTo->m_fullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f; } } @@ -214,8 +214,8 @@ void CInputManager::updateWorkspaceSwipe(double delta) { static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces"); const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX); - const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; - const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; + const auto XDISTANCE = m_sActiveSwipe.pMonitor->m_size.x + *PWORKSPACEGAP; + const auto YDISTANCE = m_sActiveSwipe.pMonitor->m_size.y + *PWORKSPACEGAP; const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle(); const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert"); const double d = m_sActiveSwipe.delta - delta; diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index eab01528..f8964521 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -27,7 +27,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock(); - g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); + g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); refocus(); @@ -43,11 +43,11 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { return; // TODO: Don't swipe if you touched a floating window. } else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->m_layer <= 1) && !g_pSessionLockManager->isSessionLocked()) { - const auto PWORKSPACE = PMONITOR->activeWorkspace; + const auto PWORKSPACE = PMONITOR->m_activeWorkspace; const auto STYLE = PWORKSPACE->m_renderOffset->getStyle(); const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert"); - const double TARGETLEFT = ((VERTANIMS ? gapsOut.m_top : gapsOut.m_left) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x); - const double TARGETRIGHT = 1 - (((VERTANIMS ? gapsOut.m_bottom : gapsOut.m_right) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->vecSize.y : PMONITOR->vecSize.x)); + const double TARGETLEFT = ((VERTANIMS ? gapsOut.m_top : gapsOut.m_left) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->m_size.y : PMONITOR->m_size.x); + const double TARGETRIGHT = 1 - (((VERTANIMS ? gapsOut.m_bottom : gapsOut.m_right) + *PBORDERSIZE) / (VERTANIMS ? PMONITOR->m_size.y : PMONITOR->m_size.x)); const double POSITION = (VERTANIMS ? e.pos.y : e.pos.x); if (POSITION < TARGETLEFT || POSITION > TARGETRIGHT) { beginWorkspaceSwipe(); @@ -62,7 +62,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { } if (g_pSessionLockManager->isSessionLocked()) { - m_sTouchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID); + m_sTouchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id); if (!m_sTouchData.touchFocusLockSurface) Debug::log(WARN, "The session is locked but can't find a lock surface"); else @@ -77,7 +77,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { Vector2D local; if (m_sTouchData.touchFocusLockSurface) { - local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition; + local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position; m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } else if (!m_sTouchData.touchFocusWindow.expired()) { if (m_sTouchData.touchFocusWindow->m_isX11) { @@ -144,13 +144,13 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { } if (m_sTouchData.touchFocusLockSurface) { const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLockSurface->iMonitorID); - g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); - auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition; + g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); + auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); } else if (validMapped(m_sTouchData.touchFocusWindow)) { const auto PMONITOR = m_sTouchData.touchFocusWindow->m_monitor.lock(); - g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); + g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; if (m_sTouchData.touchFocusWindow->m_isX11) @@ -160,7 +160,7 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { } else if (!m_sTouchData.touchFocusLS.expired()) { const auto PMONITOR = m_sTouchData.touchFocusLS->m_monitor.lock(); - g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true); + g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; |
