diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2021-10-30 12:22:49 +0200 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2021-10-30 12:22:49 +0200 |
| commit | b9861961182e49c5be10929bd2f2b4d6c6d19677 (patch) | |
| tree | c49561c1a03479a7e96a46d1ddfa434a0f0dca1f | |
| parent | e447e1b41fbb4fa210e0a2cf8ecb1e3ac932ab32 (diff) | |
| download | river-b9861961182e49c5be10929bd2f2b4d6c6d19677.tar.gz river-b9861961182e49c5be10929bd2f2b4d6c6d19677.tar.xz | |
view: respect client size resize of floating views
mpv for example has key bindings to set the window size to a multiple of
the video resolution. This is a valid use case for client-size resizing
of the view and river should respect this if the view is floating.
| -rw-r--r-- | river/XdgToplevel.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index e2a04fb..79eaff7 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -307,10 +307,15 @@ fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) voi } } else { view.output.damage.addWhole(); - // TODO: handle unexpected change in dimensions - if (!std.meta.eql(view.surface_box, new_box)) - log.err("view changed size unexpectedly", .{}); + const size_changed = !std.meta.eql(view.surface_box, new_box); view.surface_box = new_box; + // If the client has decided to resize itself and the view is floating, + // then respect that resize. + if (view.pending.float and size_changed) { + view.pending.box.width = new_box.width; + view.pending.box.height = new_box.height; + view.applyPending(); + } } } |
