diff options
author | Orestis Floros <orestisflo@gmail.com> | 2022-09-24 20:33:03 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2022-10-24 21:12:25 +0200 |
commit | 3f58d51ec6c672013d87acbd29231ef8971aa68d (patch) | |
tree | cc15f2a06425cfe92f4654cacbb8789003f68ae7 | |
parent | 304e815ed4d3e58ef52f90b807f9ae6fc52c5463 (diff) | |
download | i3-3f58d51ec6c672013d87acbd29231ef8971aa68d.tar.gz i3-3f58d51ec6c672013d87acbd29231ef8971aa68d.zip |
Fix motif logic for new floats
- manage.c still used wrong `motif_border_style == BS_NORMAL`
- container must be set to floating first for correct code path and
correct max_user_border_style to be used in con_set_border_style
- Motif test now includes default_floating_border
-rw-r--r-- | src/manage.c | 18 | ||||
-rw-r--r-- | testcases/t/548-motif-hints.t | 42 |
2 files changed, 44 insertions, 16 deletions
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 = <<EOT; # i3 config file (v4) font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 default_border $style +default_floating_border $some_other_style EOT my $pid = launch_with_config($config); + $use_floating = 0; + $cb->(); + exit_gracefully($pid); + }; + + subtest 'with floating', sub { + my $config = <<EOT; +# i3 config file (v4) +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 + +default_border $some_other_style +default_floating_border $style +EOT + my $pid = launch_with_config($config); + $use_floating = 1; $cb->(); - kill_all_windows; 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 { |