xdg-shell: determine tiled state by float state

How river currently sets this isn't really in accordance with the spirit
of the protocol. It was originally done this way to get gtk3 windows to
look a little bit better with borders drawn around them. However, I've
come to believe that river shouldn't just ignore standards like this.

The right way to do things would be to either implement the
xdg-decoration protocol for gtk properly or to be pragmatic and accept
some programs are intended to be used with CSD and that's OK.
This commit is contained in:
Isaac Freund 2023-03-06 20:43:40 +01:00
parent 0752b6b9ba
commit fc6d1cca15
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -98,15 +98,20 @@ pub fn configure(self: *Self) bool {
const inflight = &self.view.inflight; const inflight = &self.view.inflight;
const current = &self.view.current; const current = &self.view.current;
const inflight_fullscreen = inflight.output != null and inflight.output.?.inflight.fullscreen == self.view;
const current_fullscreen = current.output != null and current.output.?.current.fullscreen == self.view;
const inflight_float = inflight.float or (inflight.output != null and inflight.output.?.layout == null);
const current_float = current.float or (current.output != null and current.output.?.layout == null);
// We avoid a special case for newly mapped views which we have not yet // We avoid a special case for newly mapped views which we have not yet
// configured by setting the current width/height to the initial width/height // configured by setting the current width/height to the initial width/height
// of the view in handleMap(). // of the view in handleMap().
if (inflight.box.width == current.box.width and if (inflight.box.width == current.box.width and
inflight.box.height == current.box.height and inflight.box.height == current.box.height and
(inflight.focus != 0) == (current.focus != 0) and (inflight.focus != 0) == (current.focus != 0) and
(inflight.output != null and inflight.output.?.inflight.fullscreen == self.view) == inflight_fullscreen == current_fullscreen and
(current.output != null and current.output.?.current.fullscreen == self.view) and inflight_float == current_float and
inflight.borders == current.borders and
inflight.resizing == current.resizing) inflight.resizing == current.resizing)
{ {
return false; return false;
@ -114,13 +119,12 @@ pub fn configure(self: *Self) bool {
_ = self.xdg_toplevel.setActivated(inflight.focus != 0); _ = self.xdg_toplevel.setActivated(inflight.focus != 0);
const fullscreen = inflight.output != null and inflight.output.?.inflight.fullscreen == self.view; _ = self.xdg_toplevel.setFullscreen(inflight_fullscreen);
_ = self.xdg_toplevel.setFullscreen(fullscreen);
if (inflight.borders) { if (inflight_float) {
_ = self.xdg_toplevel.setTiled(.{ .top = true, .bottom = true, .left = true, .right = true });
} else {
_ = self.xdg_toplevel.setTiled(.{ .top = false, .bottom = false, .left = false, .right = false }); _ = self.xdg_toplevel.setTiled(.{ .top = false, .bottom = false, .left = false, .right = false });
} else {
_ = self.xdg_toplevel.setTiled(.{ .top = true, .bottom = true, .left = true, .right = true });
} }
_ = self.xdg_toplevel.setResizing(inflight.resizing); _ = self.xdg_toplevel.setResizing(inflight.resizing);