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:
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user