WIP activate workspace

This commit is contained in:
Ian Douglas Scott 2022-12-30 15:35:36 -08:00
parent 4abedacdfa
commit 4af2d4d669
2 changed files with 18 additions and 9 deletions

View file

@ -52,9 +52,9 @@ struct Toplevel {
struct LayerSurface {
output: wl_output::WlOutput,
output_name: Option<String>,
// Active workspace
// windows in workspace
// - for transitions, would need windows in more than one workspace
active_workspace: Option<zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1>,
// for transitions, would need windows in more than one workspace? But don't capture all of
// them all the time every frame.
}
#[derive(Default)]
@ -99,6 +99,7 @@ impl Application for App {
LayerSurface {
output: output.clone(),
output_name: info.name,
active_workspace: None,
},
);
return get_layer_surface(SctkLayerSurfaceSettings {
@ -172,8 +173,19 @@ impl Application for App {
std::process::exit(0);
}
Msg::Closed(_) => {}
Msg::ActivateWorkspace(workspace) => {
// TODO
Msg::ActivateWorkspace(workspace_handle) => {
// XXX
for workspace in &self.workspaces {
if &workspace.handle == &workspace_handle {
for surface in self.layer_surfaces.values_mut() {
if &surface.output_name == &workspace.output_name {
surface.active_workspace = Some(workspace_handle);
break;
}
}
break;
}
}
}
}

View file

@ -150,10 +150,7 @@ impl ToplevelInfoHandler for AppData {
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
) {
let info = self.toplevel_info_state.info(&toplevel).unwrap();
self.send_event(Event::NewToplevel(
toplevel.clone(),
info.clone(),
));
self.send_event(Event::NewToplevel(toplevel.clone(), info.clone()));
let frame = self.screencopy_state.screencopy_manager.capture_toplevel(
toplevel,