fix bad decisions

This commit is contained in:
erstarr 2026-04-04 07:55:03 +02:00
parent 61a1ec4d22
commit f70c7ac039
4 changed files with 7 additions and 9 deletions

View file

@ -335,10 +335,10 @@ void CLayoutManager::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, SP<I
// TODO: erstarr - don't leave this like this. a function for mathcing recalculate_monitor reasons into recalculate reasons should be good. maybe an operator overload?
void CLayoutManager::recalculateMonitor(PHLMONITOR m, std::optional<eRecalculateMonitorReason> reason) {
if (m->m_activeSpecialWorkspace)
m->m_activeSpecialWorkspace->m_space->recalculate(recalcMonitorReasontoRecalcReason(reason));
m->m_activeSpecialWorkspace->m_space->recalculate(reason.has_value() ? recalcMonitorReasontoRecalcReason(reason.value()) : std::nullopt);
if (m->m_activeWorkspace)
m->m_activeWorkspace->m_space->recalculate(recalcMonitorReasontoRecalcReason(reason));
m->m_activeWorkspace->m_space->recalculate(reason.has_value() ? recalcMonitorReasontoRecalcReason(reason.value()) : std::nullopt);
}
void CLayoutManager::invalidateMonitorGeometries(PHLMONITOR m) {

View file

@ -811,7 +811,7 @@ void CScrollingAlgorithm::recalculate(std::optional<eRecalculateReason> reason)
// guard against unwanted scrolling viewport moves
// (e.g. changing workspace to a scrolling layout workspace fits the focused window in that workspace into view)
if (Layout::isHardRecalculateReason(reason.value()))
if ( !reason.has_value() || Layout::isHardRecalculateReason(reason.value()))
focusOnInput(Desktop::focusState()->window()->layoutTarget(), INPUT_MODE_HARD);
}
}

View file

@ -211,11 +211,9 @@ const std::vector<WP<ITarget>>& CSpace::targets() const {
return m_targets;
}
std::optional<eRecalculateReason> Layout::recalcMonitorReasontoRecalcReason(std::optional<CLayoutManager::eRecalculateMonitorReason> reason) {
if (!reason)
return std::nullopt;
switch (reason.value()) {
std::optional<eRecalculateReason> Layout::recalcMonitorReasontoRecalcReason(CLayoutManager::eRecalculateMonitorReason reason) {
// If eRecalculateMonitorReason doesn't have a eRecalculateReason pair, it'll return nullopt
switch (reason) {
case CLayoutManager::RECALCULATE_MONITOR_REASON_TOGGLE_SPECIAL_WORKSPACE: return RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE;
case CLayoutManager::RECALCULATE_MONITOR_REASON_WORKSPACE_CHANGE: return RECALCULATE_REASON_WORKSPACE_CHANGE;
case CLayoutManager::RECALCULATE_MONITOR_REASON_HYPRCTL_KEYWORD: return RECALCULATE_REASON_HYPRCTL_KEYWORD;

View file

@ -22,7 +22,7 @@ namespace Layout {
RECALCULATE_REASON_RENDER_MOINTOR,
};
std::optional<eRecalculateReason> recalcMonitorReasontoRecalcReason(std::optional<CLayoutManager::eRecalculateMonitorReason> reason);
std::optional<eRecalculateReason> recalcMonitorReasontoRecalcReason(CLayoutManager::eRecalculateMonitorReason reason);
class ITarget;
class CAlgorithm;