Skip to content

Commit

Permalink
[awm2] Don’t send Ctrl+W or Ctrl+Tab to any floating windows
Browse files Browse the repository at this point in the history
  • Loading branch information
codyd51 committed Dec 31, 2022
1 parent f3c0570 commit bcaa18d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rust_programs/awm2/src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,28 @@ impl Desktop {
})
}

fn windows_in_z_hierarchy(&self) -> impl Iterator<Item = &Rc<Window>> {
// Don't include floating windows in the search. For example, this
// will never return the dock window
self.windows
.iter()
.filter(|w| w.z_index_category() == DesktopElementZIndexCategory::Window)
}

fn bottom_window(&self) -> Option<&Rc<Window>> {
self.windows.last()
self.windows_in_z_hierarchy().last()
}

fn top_window(&self) -> Option<&Rc<Window>> {
self.windows.first()
self.windows_in_z_hierarchy().next()
}

fn is_topmost_window(&self, w: &Rc<Window>) -> bool {
Rc::ptr_eq(&self.windows[0], w)
if let Some(top_window) = self.top_window() {
Rc::ptr_eq(top_window, w)
} else {
false
}
}

fn handle_left_click_began(&mut self) {
Expand Down

0 comments on commit bcaa18d

Please sign in to comment.