3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2026-08-18 02:51:23 +00:00

algo/floating: do not alter pinned windows' state on ws move (#14513)

fixes #14457
This commit is contained in:
Vaxry
2026-05-13 15:50:49 +01:00
committed by Vaxry
parent 452ef12c51
commit 8000241949
2 changed files with 50 additions and 0 deletions

View File

@ -1202,3 +1202,39 @@ TEST_CASE(execRulesTagMutation) {
Tests::killAllWindows();
}
TEST_CASE(pinnedRetainsPositionOnWorkspaceChange) {
ASSERT(!!Tests::spawnKitty("a"), true);
OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"));
OK(getFromSocket("/dispatch hl.dsp.window.float({ action = 'enable' })"));
OK(getFromSocket("/dispatch hl.dsp.window.pin()"));
{
auto str = getFromSocket("/clients");
ASSERT_CONTAINS(str, "pinned: 1");
}
OK(getFromSocket("/dispatch hl.dsp.window.move({ x = 1900, y = 1000 })"));
OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '2' })"));
{
auto str = getFromSocket("/workspaces");
ASSERT_CONTAINS(str, "workspace ID 2");
}
OK(getFromSocket("/dispatch hl.dsp.focus({ workspace = '1' })"));
{
auto str = getFromSocket("/workspaces");
ASSERT_CONTAINS(str, "workspace ID 1");
}
{
auto str = getFromSocket("/clients");
ASSERT_CONTAINS(str, "pinned: 1");
ASSERT_CONTAINS(str, "at: 1900,1000");
}
}

View File

@ -121,6 +121,20 @@ void CDefaultFloatingAlgorithm::newTarget(SP<ITarget> target) {
}
void CDefaultFloatingAlgorithm::movedTarget(SP<ITarget> target, std::optional<Vector2D> focalPoint) {
if (target->window() && target->window()->m_pinned) {
// check if we intersect at all.
const auto BOX = target->position();
if (!m_parent->space() || !m_parent->space()->workspace() || !m_parent->space()->workspace()->m_monitor)
return;
const auto THIS_BOX = m_parent->space()->workspace()->m_monitor->logicalBox();
if (!THIS_BOX.intersection(BOX).empty())
return;
}
auto LAST_SIZE = target->lastFloatingSize();
const auto CURRENT_SIZE = target->position().size();