mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 04:58:02 +02:00
monitor: fix centered floating windows off-screen in special workspace (#14203)
Signed-off-by: Zebra2711 <zebra2711t@gmail.com>
This commit is contained in:
parent
859bbb11e1
commit
bac49db9a1
2 changed files with 23 additions and 1 deletions
|
|
@ -588,6 +588,28 @@ TEST_CASE(issue14038) {
|
|||
// this should not crash hyprland. If we are alive, we good.
|
||||
}
|
||||
|
||||
TEST_CASE(specialFloatRecenters) {
|
||||
if (!spawnKitty("kitty_special_float_recenter"))
|
||||
FAIL_TEST("Could not spawn kitty");
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.float({ action = 'set', window = 'class:kitty_special_float_recenter' })"));
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.resize({ x = 10, y = 10, window = 'class:kitty_special_float_recenter' })"));
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.move({ workspace = 'special:recenter', follow = false, window = 'class:kitty_special_float_recenter' })"));
|
||||
OK(getFromSocket("/dispatch hl.dsp.window.move({ x = 50000, y = 50000, window = 'class:kitty_special_float_recenter' })"));
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.workspace.toggle_special('recenter')"));
|
||||
OK(getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_special_float_recenter' })"));
|
||||
|
||||
const auto active = getFromSocket("/activewindow");
|
||||
EXPECT_CONTAINS(active, "class: kitty_special_float_recenter");
|
||||
EXPECT_CONTAINS(active, "size: 10,10");
|
||||
EXPECT_CONTAINS(active, "at: 955,535");
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.workspace.toggle_special('recenter')"));
|
||||
Tests::killAllWindows();
|
||||
ASSERT(Tests::windowCount(), 0);
|
||||
}
|
||||
|
||||
// TODO: decompose this into multiple test cases
|
||||
TEST_CASE(windows) {
|
||||
// test on workspace "window"
|
||||
|
|
|
|||
|
|
@ -1564,7 +1564,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
|
|||
if (VECNOTINRECT(MIDDLE, PMONFROMMIDDLE->m_position.x, PMONFROMMIDDLE->m_position.y, PMONFROMMIDDLE->m_position.x + PMONFROMMIDDLE->m_size.x,
|
||||
PMONFROMMIDDLE->m_position.y + PMONFROMMIDDLE->m_size.y)) {
|
||||
// not on any monitor, center
|
||||
pos = middle() / 2.f - w->m_realSize->goal() / 2.f;
|
||||
pos = middle() - w->m_realSize->goal() / 2.f;
|
||||
} else
|
||||
pos = pos - PMONFROMMIDDLE->m_position + m_position;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue