mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 21:58:04 +02:00
Fix hyprctl keyword causing scrolling view move.
rename INPUT_MODE_KB to INPUT_MODE_HARD since it seems to have little to do with keybinds
This commit is contained in:
parent
8ccf0f53d4
commit
a2c2a93f79
6 changed files with 17 additions and 8 deletions
|
|
@ -1096,7 +1096,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
|||
// invalidate layouts if they changed
|
||||
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
|
||||
for (auto const& m : g_pCompositor->m_monitors) {
|
||||
g_layoutManager->recalculateMonitor(m);
|
||||
g_layoutManager->recalculateMonitor(m, Layout::CLayoutManager::RECALCULATE_MONITOR_REASON_HYPRCTL_KEYWORD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,10 +332,13 @@ void CLayoutManager::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, SP<I
|
|||
sourceSize = {sourceX.end - sourceX.start, sourceY.end - sourceY.start};
|
||||
}
|
||||
|
||||
// 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) {
|
||||
if (reason == RECALCULATE_MONITOR_REASON_TOGGLE_SPECIAL_WORKSPACE)
|
||||
m->m_activeSpecialWorkspace->m_space->recalculate(RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE);
|
||||
else if (reason == RECALCULATE_MONITOR_REASON_HYPRCTL_KEYWORD)
|
||||
m->m_activeSpecialWorkspace->m_space->recalculate(RECALCULATE_REASON_HYPRCTL_KEYWORD);
|
||||
else
|
||||
m->m_activeSpecialWorkspace->m_space->recalculate();
|
||||
return;
|
||||
|
|
@ -344,6 +347,8 @@ void CLayoutManager::recalculateMonitor(PHLMONITOR m, std::optional<eRecalculate
|
|||
if (m->m_activeWorkspace) {
|
||||
if (reason == RECALCULATE_MONITOR_REASON_WORKSPACE_CHANGE)
|
||||
m->m_activeWorkspace->m_space->recalculate(RECALCULATE_REASON_WORKSPACE_CHANGE);
|
||||
else if (reason == RECALCULATE_MONITOR_REASON_HYPRCTL_KEYWORD)
|
||||
m->m_activeWorkspace->m_space->recalculate(RECALCULATE_REASON_HYPRCTL_KEYWORD);
|
||||
else
|
||||
m->m_activeWorkspace->m_space->recalculate();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ namespace Layout {
|
|||
|
||||
enum eRecalculateMonitorReason : uint8_t {
|
||||
RECALCULATE_MONITOR_REASON_WORKSPACE_CHANGE,
|
||||
RECALCULATE_MONITOR_REASON_TOGGLE_SPECIAL_WORKSPACE
|
||||
RECALCULATE_MONITOR_REASON_TOGGLE_SPECIAL_WORKSPACE,
|
||||
RECALCULATE_MONITOR_REASON_HYPRCTL_KEYWORD,
|
||||
};
|
||||
|
||||
void newTarget(SP<ITarget> target, SP<CSpace> space);
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ CScrollingAlgorithm::CScrollingAlgorithm() {
|
|||
if (!TARGET || TARGET->floating())
|
||||
return;
|
||||
|
||||
focusOnInput(TARGET, reason == Desktop::FOCUS_REASON_CLICK ? INPUT_MODE_CLICK : (Desktop::isHardInputFocusReason(reason) ? INPUT_MODE_KB : INPUT_MODE_SOFT));
|
||||
focusOnInput(TARGET, reason == Desktop::FOCUS_REASON_CLICK ? INPUT_MODE_CLICK : (Desktop::isHardInputFocusReason(reason) ? INPUT_MODE_HARD : INPUT_MODE_SOFT));
|
||||
});
|
||||
|
||||
// Initialize default widths and direction
|
||||
|
|
@ -576,7 +576,7 @@ void CScrollingAlgorithm::focusOnInput(SP<ITarget> target, eInputMode input) {
|
|||
}
|
||||
|
||||
// if we moved via non-kb, and it's fully visible, ignore
|
||||
if (m_scrollingData->visible(TARGETDATA->column.lock(), true) && input != INPUT_MODE_KB)
|
||||
if (m_scrollingData->visible(TARGETDATA->column.lock(), true) && input != INPUT_MODE_HARD)
|
||||
return;
|
||||
|
||||
static const auto PFITMETHOD = CConfigValue<Config::INTEGER>("scrolling:focus_fit_method");
|
||||
|
|
@ -808,9 +808,11 @@ void CScrollingAlgorithm::recalculate(std::optional<eRecalculateReason> reason)
|
|||
const auto TARGETDATA = dataFor(TARGET);
|
||||
|
||||
if (TARGETDATA && !m_scrollingData->visible(TARGETDATA->column.lock(), true)) {
|
||||
// guard against scrolling tape move when switching workspaces when target is scrolling (special or not)
|
||||
if (reason != RECALCULATE_REASON_WORKSPACE_CHANGE && reason != RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE)
|
||||
focusOnInput(Desktop::focusState()->window()->layoutTarget(), INPUT_MODE_KB);
|
||||
// TODO: erstarr Maybe do smt about this mess
|
||||
// RECALCULATE_REASON_WORKSPACE_CHANGE, RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE => guard against scrolling view move when switching workspaces when target is scrolling (special or not)
|
||||
// RECALCULATE_REASON_HYPRCTL_KEYWORD => guard against `hyprctl keyword` commands moving scrolling view
|
||||
if (reason != RECALCULATE_REASON_WORKSPACE_CHANGE && reason != RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE && reason != RECALCULATE_REASON_HYPRCTL_KEYWORD)
|
||||
focusOnInput(Desktop::focusState()->window()->layoutTarget(), INPUT_MODE_HARD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace Layout::Tiled {
|
|||
enum eInputMode : uint8_t {
|
||||
INPUT_MODE_SOFT = 0,
|
||||
INPUT_MODE_CLICK,
|
||||
INPUT_MODE_KB
|
||||
INPUT_MODE_HARD
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Layout {
|
|||
enum eRecalculateReason : uint8_t {
|
||||
RECALCULATE_REASON_WORKSPACE_CHANGE,
|
||||
RECALCULATE_REASON_SPECIAL_WORKSPACE_TOGGLE,
|
||||
RECALCULATE_REASON_HYPRCTL_KEYWORD,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue