wzrd

An ICCCM & EWMH compliant X11 reparenting, dynamic window manager, written in Rust
git clone git://git.deurzen.net/wzrd
Log | Files | Refs | LICENSE

commit 56a9de70cd1b817155b1595874449fa66bfdf736
parent e0663371e61c8d5ec4389a5cc8695d8cf8723134
Author: deurzen <m.deurzen@tum.de>
Date:   Wed, 17 Mar 2021 03:08:40 +0100

prevents applying same layout twice

Diffstat:
Msrc/core/model.rs | 5++---
Msrc/core/workspace.rs | 29+++++++++++++++++------------
Msrc/core/zone.rs | 4++++
3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/core/model.rs b/src/core/model.rs @@ -403,9 +403,8 @@ impl<'a> Model<'a> { let (free, regular): (Vec<Window>, Vec<Window>) = regular.into_iter().partition(|&window| { - self.client(window).map_or(true, |client| { - self.is_free(client) - }) + self.client(window) + .map_or(true, |client| self.is_free(client)) }); let above = self.stack.layer_windows(StackLayer::Above); diff --git a/src/core/workspace.rs b/src/core/workspace.rs @@ -333,7 +333,7 @@ impl Workspace { zone_manager: &mut ZoneManager, client_map: &HashMap<Window, Client>, screen_region: Region, - filter: F, + ignore_filter: F, ) -> Vec<Placement> where F: Fn(&Client) -> bool, @@ -346,7 +346,7 @@ impl Workspace { .clients .iter() .map(|window| client_map.get(window).unwrap()) - .filter(|&client| filter(client)) + .filter(|&client| ignore_filter(client)) .map(|client| (client.zone(), client)) .unzip(); @@ -354,21 +354,26 @@ impl Workspace { .arrange(self.root_zone, &to_ignore_ids) .into_iter() .chain(to_ignore_clients.into_iter().map(|client| { - let (method, decoration) = if client.is_fullscreen() && !client.is_in_window() { - (PlacementMethod::Tile, NO_DECORATION) - } else { - (PlacementMethod::Free, FREE_DECORATION) - }; + let (method, region, decoration) = + if client.is_fullscreen() && !client.is_in_window() { + ( + PlacementMethod::Tile, + PlacementRegion::NewRegion(screen_region), + NO_DECORATION, + ) + } else { + ( + PlacementMethod::Free, + PlacementRegion::FreeRegion, + FREE_DECORATION, + ) + }; Placement { method, kind: PlacementKind::Client(client.window()), zone: client.zone(), - region: if method == PlacementMethod::Tile { - PlacementRegion::NewRegion(screen_region) - } else { - PlacementRegion::FreeRegion - }, + region, decoration, } })) diff --git a/src/core/zone.rs b/src/core/zone.rs @@ -706,6 +706,10 @@ impl Layout { &mut self, kind: LayoutKind, ) { + if kind == self.kind { + return; + } + self.prev_kind = self.kind; self.kind = kind; }