Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Dec 5, 2024
1 parent 92b3e1c commit 095098c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/wayland/protocols/overlap_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ impl OverlapNotifyState {
.registered_toplevels()
.filter(|w| {
if let Some(active_workspace) = active_workspace.as_ref() {
ToplevelHandleStateInner::from_window(*w)
.lock()
let state = w
.user_data()
.get::<ToplevelState>()
.unwrap()
.in_workspace(&active_workspace)
.lock()
.unwrap();
state.in_workspace(&active_workspace)
} else {
true
}
Expand Down
8 changes: 4 additions & 4 deletions src/wayland/protocols/toplevel_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ impl ToplevelStateInner {
pub fn foreign_handle(&self) -> Option<&ForeignToplevelHandle> {
self.foreign_handle.as_ref()
}

pub fn in_workspace(&self, handle: &WorkspaceHandle) -> bool {
self.workspaces.contains(handle)
}
}

pub struct ToplevelHandleStateInner<W: Window> {
Expand Down Expand Up @@ -120,10 +124,6 @@ impl<W: Window> ToplevelHandleStateInner<W> {
window: None,
})
}

pub fn in_workspace(&self, handle: &WorkspaceHandle) -> bool {
self.workspaces.contains(handle)
}
}

impl<D, W> GlobalDispatch<ZcosmicToplevelInfoV1, ToplevelInfoGlobalData, D>
Expand Down

0 comments on commit 095098c

Please sign in to comment.