Split up wayland code into more files
This commit is contained in:
parent
a5b78a4300
commit
b29f1149a4
6 changed files with 363 additions and 304 deletions
36
src/wayland/workspace.rs
Normal file
36
src/wayland/workspace.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use cctk::{
|
||||
wayland_client::Proxy,
|
||||
workspace::{WorkspaceHandler, WorkspaceState},
|
||||
};
|
||||
|
||||
use super::{AppData, CaptureSource, Event};
|
||||
|
||||
impl WorkspaceHandler for AppData {
|
||||
fn workspace_state(&mut self) -> &mut WorkspaceState {
|
||||
&mut self.workspace_state
|
||||
}
|
||||
|
||||
fn done(&mut self) {
|
||||
let mut workspaces = Vec::new();
|
||||
|
||||
// XXX remove capture source for removed workspaces
|
||||
|
||||
for group in self.workspace_state.workspace_groups() {
|
||||
for workspace in &group.workspaces {
|
||||
if let Some(output) = group.output.as_ref() {
|
||||
let output_name = self.output_names.get(&output.id()).unwrap().clone();
|
||||
workspaces.push((output_name, workspace.clone()));
|
||||
|
||||
self.add_capture_source(CaptureSource::Workspace(
|
||||
workspace.handle.clone(),
|
||||
output.clone(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.send_event(Event::Workspaces(workspaces));
|
||||
}
|
||||
}
|
||||
|
||||
cctk::delegate_workspace!(AppData);
|
||||
Loading…
Add table
Add a link
Reference in a new issue