view: double buffer focus, use counter not bool

- Double buffering focus state ensures that border color is kept in sync
with the transaction state of views in the layout.
- Using a counter instead of a bool will allow for proper handling of
multiple seats. This is done in the same commit to avoid more churn in
the future.
This commit is contained in:
Isaac Freund
2020-08-03 15:00:04 +02:00
parent 7d77160fe3
commit 96a91fd2f7
8 changed files with 49 additions and 54 deletions

View File

@ -63,14 +63,15 @@ pub fn needsConfigure(self: Self) bool {
self.wlr_xwayland_surface.height != self.view.pending.box.height;
}
/// Tell the client to take a new size
pub fn configure(self: Self, pending_box: Box) void {
/// Apply pending state
pub fn configure(self: Self) void {
const state = &self.view.pending;
c.wlr_xwayland_surface_configure(
self.wlr_xwayland_surface,
@intCast(i16, pending_box.x),
@intCast(i16, pending_box.y),
@intCast(u16, pending_box.width),
@intCast(u16, pending_box.height),
@intCast(i16, state.box.x),
@intCast(i16, state.box.y),
@intCast(u16, state.box.width),
@intCast(u16, state.box.height),
);
// Xwayland surfaces don't use serials, so we will just assume they have
// configured the next time they commit. Set pending serial to a dummy
@ -80,11 +81,6 @@ pub fn configure(self: Self, pending_box: Box) void {
self.view.pending_serial = 0x66666666;
}
/// Inform the xwayland surface that it has gained focus
pub fn setActivated(self: Self, activated: bool) void {
c.wlr_xwayland_surface_activate(self.wlr_xwayland_surface, activated);
}
pub fn setFullscreen(self: Self, fullscreen: bool) void {
c.wlr_xwayland_surface_set_fullscreen(self.wlr_xwayland_surface, fullscreen);
}