diff --git a/src/workspace.c b/src/workspace.c index f55c920e..8bd4b5ea 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -29,6 +29,7 @@ static void _workspace_apply_default_orientation(Con *ws) { if (config.default_orientation == NO_ORIENTATION) { Con *output = con_get_output(ws); ws->layout = (output->rect.height > output->rect.width) ? L_SPLITV : L_SPLITH; + ws->rect = output->rect; DLOG("Auto orientation. Workspace size set to (%d,%d), setting layout to %d.\n", output->rect.width, output->rect.height, ws->layout); } else { diff --git a/testcases/t/244-new-workspace-floating-enable-center.t b/testcases/t/244-new-workspace-floating-enable-center.t new file mode 100644 index 00000000..dbc9a80a --- /dev/null +++ b/testcases/t/244-new-workspace-floating-enable-center.t @@ -0,0 +1,53 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) +# +# Ensures that 'move workspace $new, floating enable' on a marked window +# leaves the window centered on the new workspace. +# Bug still in: 4.10.2-137-ga4f0ed6 +use i3test i3_autostart => 0; + +my $config = <rect; + +is(int($pos->{x} + $pos->{width} / 2), int($x->root->rect->width / 2), + 'x coordinates match'); +is(int($pos->{y} + $pos->{height} / 2), int($x->root->rect->height / 2), + 'y coordinates match'); + +exit_gracefully($pid); + +done_testing;