Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/layout/floating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,18 @@ impl<W: LayoutElement> FloatingSpace<W> {
let win_height = ensure_min_max_size(win_height, min_size.h, max_size.h);

let win_size = Size::from((win_width, win_height));
if win_size.w > 0
&& win_size.h > 0
&& win.size() == win_size
&& win.sizing_mode().is_normal()
&& win.pending_sizing_mode().is_normal()
&& matches!(
win.configure_intent(),
ConfigureIntent::NotNeeded | ConfigureIntent::Throttled
)
{
return;
}
win.request_size_once(win_size, animate);
}

Expand Down Expand Up @@ -830,6 +842,18 @@ impl<W: LayoutElement> FloatingSpace<W> {
let win_width = ensure_min_max_size(win_width, min_size.w, max_size.w);

let win_size = Size::from((win_width, win_height));
if win_size.w > 0
&& win_size.h > 0
&& win.size() == win_size
&& win.sizing_mode().is_normal()
&& win.pending_sizing_mode().is_normal()
&& matches!(
win.configure_intent(),
ConfigureIntent::NotNeeded | ConfigureIntent::Throttled
)
{
return;
}
win.request_size_once(win_size, animate);
}

Expand Down
10 changes: 2 additions & 8 deletions src/tests/floating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,9 @@ fn resize_to_same_size() {

// This needn't request anything because we're already that size; the size in the current
// server state matches the requested size.
//
// FIXME: However, currently it will request the size anyway because the code checks the
// current server state, and the last size niri requested of the window was 100×100 (even if
// the window already acked and committed in response).
assert_snapshot!(
f.client(id).window(&surface).format_recent_configures(),
@"size: 200 × 200, bounds: 1920 × 1080, states: [Activated]"
@""
);
}

Expand Down Expand Up @@ -1357,10 +1353,8 @@ fn repeated_size_request() {
f.double_roundtrip(id);

// This should send a new configure since the window had committed.
//
// FIXME: doesn't request that currently.
assert_snapshot!(
f.client(id).window(&surface).format_recent_configures(),
@""
@"size: 200 × 100, bounds: 1920 × 1080, states: [Activated]"
);
}
7 changes: 7 additions & 0 deletions src/window/mapped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,13 @@ impl LayoutElement for Mapped {
self.animate_next_configure = true;
}

// If we requested a concrete size before and the client committed without applying it,
// role state may already contain that size even though the actual window size differs.
// In that case, force another configure on the next same-size request.
if !changed && size.w > 0 && size.h > 0 && self.window.geometry().size != size {
self.needs_configure = true;
}

self.request_size_once = Some(RequestSizeOnce::WaitingForConfigure);
}

Expand Down