mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-08-18 11:02:10 +00:00
config/actions: fix center not saving the new pos of a floating window (#15810)
This commit is contained in:
@ -1180,3 +1180,46 @@ TEST_CASE(defaultHandledFsfocusInDirection) {
|
||||
EXPECT_CONTAINS(str, "fullscreenClient: 0");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(dwindleFullsreenCenterDispatchSavesPos) {
|
||||
/*
|
||||
This test serves as a test for all layouts that use deafult FS behaviour
|
||||
|
||||
Also tests hl.dsp.window.center() incidentally
|
||||
|
||||
*/
|
||||
|
||||
SPAWN_KITTY("kot");
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.float({ action = 'set', window = 'class:kot' })"));
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.move({ x =100 , y =100 , relative = false, window = 'class:kot' })"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: kot");
|
||||
EXPECT_CONTAINS(str, "at: 100,100");
|
||||
EXPECT_CONTAINS(str, "fullscreen: 0");
|
||||
EXPECT_CONTAINS(str, "fullscreenClient: 0");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.center({ window = 'class:kot' })"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: kot");
|
||||
EXPECT_CONTAINS(str, "at: 0,0");
|
||||
EXPECT_CONTAINS(str, "fullscreen: 0");
|
||||
EXPECT_CONTAINS(str, "fullscreenClient: 0");
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.fullscreen({ mode = 'fullscreen', action = 'set', window = 'class:kot' })"));
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.fullscreen({ mode = 'fullscreen', action = 'unset', window = 'class:kot' })"));
|
||||
|
||||
{
|
||||
auto str = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(str, "class: kot");
|
||||
EXPECT_CONTAINS(str, "at: 0,0");
|
||||
EXPECT_CONTAINS(str, "fullscreen: 0");
|
||||
EXPECT_CONTAINS(str, "fullscreenClient: 0");
|
||||
}
|
||||
}
|
||||
@ -567,8 +567,10 @@ ActionResult Actions::center(std::optional<PHLWINDOW> w) {
|
||||
|
||||
const auto PMONITOR = window->m_monitor.lock();
|
||||
|
||||
window->layoutTarget()->setPositionGlobal(
|
||||
CBox{PMONITOR->logicalBoxMinusReserved().middle() - window->size(Desktop::View::IGeometric::GEOMETRIC_GOAL) / 2.F, window->layoutTarget()->position().size()});
|
||||
if (window->m_isFloating)
|
||||
g_layoutManager->setTargetGeom(
|
||||
CBox{PMONITOR->logicalBoxMinusReserved().middle() - window->size(Desktop::View::IGeometric::GEOMETRIC_GOAL) / 2.F, window->layoutTarget()->position().size()},
|
||||
window->m_target);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user