diff --git a/src/manage.c b/src/manage.c index 56a6d0ba..a7de243e 100644 --- a/src/manage.c +++ b/src/manage.c @@ -511,6 +511,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki if (nc->geometry.width == 0) nc->geometry = (Rect){geom->x, geom->y, geom->width, geom->height}; + if (want_floating) { + DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height); + if (floating_enable(nc, true)) { + nc->floating = FLOATING_AUTO_ON; + } + } + if (has_mwm_hints) { DLOG("MOTIF_WM_HINTS specifies decorations (border_style = %d)\n", motif_border_style); if (want_floating) { @@ -520,17 +527,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki } } - if (want_floating) { - DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height); - /* automatically set the border to the default value if a motif border - * was not specified */ - bool automatic_border = (motif_border_style == BS_NORMAL); - - if (floating_enable(nc, automatic_border)) { - nc->floating = FLOATING_AUTO_ON; - } - } - /* explicitly set the border width to the default */ if (nc->current_border_width == -1) { nc->current_border_width = (want_floating ? config.default_floating_border_width : config.default_border_width); diff --git a/testcases/t/548-motif-hints.t b/testcases/t/548-motif-hints.t index ee4a5f90..99b36b09 100644 --- a/testcases/t/548-motif-hints.t +++ b/testcases/t/548-motif-hints.t @@ -23,18 +23,38 @@ use List::Util qw(first); use i3test i3_autostart => 0; use X11::XCB qw(:all); +my $use_floating; sub subtest_with_config { my ($style, $cb) = @_; + my $some_other_style = $style eq "normal" ? "pixel" : "normal"; + + subtest 'with tiling', sub { my $config = <(); - kill_all_windows; exit_gracefully($pid); + }; + + subtest 'with floating', sub { + my $config = <(); + exit_gracefully($pid); + }; } sub _change_motif_property { @@ -51,7 +71,16 @@ sub _change_motif_property { sub open_window_with_motifs { my $value = shift; - my $window = open_window( + + # we don't need other windows anymore, simplifies get_border_style + kill_all_windows; + + my $open = \&open_window; + if ($use_floating) { + $open = \&open_floating_window; + } + + my $window = $open->( before_map => sub { my ($window) = @_; _change_motif_property($window, $value); @@ -71,9 +100,12 @@ sub change_motif_property { } sub get_border_style { - my @content = @{get_ws_content(focused_ws)}; - my $wininfo = first { $_->{window} == $window->id } @content; - return $wininfo->{border}; + if ($use_floating) { + my @floating = @{get_ws(focused_ws)->{floating_nodes}}; + return $floating[0]->{nodes}[0]->{border}; + } + + return @{get_ws(focused_ws)->{nodes}}[0]->{border}; } sub is_border_style {