Update to workspace v2, based on ext-workspace
Requires https://github.com/pop-os/cosmic-protocols/pull/51, https://github.com/pop-os/cosmic-comp/pull/1225. The new protocol version is a hard requirement, and this will panic without it.
This commit is contained in:
parent
7f877f72a3
commit
6b6bf454db
11 changed files with 63 additions and 68 deletions
|
|
@ -94,7 +94,7 @@ impl AppData {
|
|||
let info = self.toplevel_info_state.info(&toplevel_handle);
|
||||
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
|
||||
if self.toplevel_manager_state.manager.version() >= 2 {
|
||||
self.toplevel_manager_state.manager.move_to_workspace(
|
||||
self.toplevel_manager_state.manager.move_to_ext_workspace(
|
||||
&cosmic_toplevel,
|
||||
&workspace_handle,
|
||||
&output,
|
||||
|
|
@ -113,11 +113,11 @@ impl AppData {
|
|||
|
||||
fn matches_capture_filter(&self, source: &CaptureSource) -> bool {
|
||||
match source {
|
||||
CaptureSource::CosmicToplevel(toplevel) => {
|
||||
CaptureSource::Toplevel(toplevel) => {
|
||||
let info = self
|
||||
.toplevel_info_state
|
||||
.toplevels()
|
||||
.find(|info| info.cosmic_toplevel.as_ref() == Some(&toplevel));
|
||||
.find(|info| info.foreign_toplevel == *toplevel);
|
||||
if let Some(info) = info {
|
||||
info.workspace.iter().any(|workspace| {
|
||||
self.capture_filter
|
||||
|
|
@ -128,18 +128,16 @@ impl AppData {
|
|||
false
|
||||
}
|
||||
}
|
||||
CaptureSource::CosmicWorkspace(workspace) => self
|
||||
CaptureSource::Workspace(workspace) => self
|
||||
.workspace_state
|
||||
.workspace_groups()
|
||||
.iter()
|
||||
.find(|g| g.workspaces.iter().any(|w| w.handle == *workspace))
|
||||
.find(|g| g.workspaces.iter().any(|w| w == workspace))
|
||||
.map_or(false, |group| {
|
||||
self.capture_filter
|
||||
.workspaces_on_outputs
|
||||
.iter()
|
||||
.any(|o| group.outputs.contains(o))
|
||||
}),
|
||||
CaptureSource::Toplevel(_) => false,
|
||||
CaptureSource::Output(_) => false,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,19 +192,19 @@ impl ScreencopyHandler for AppData {
|
|||
),
|
||||
};
|
||||
match &capture.source {
|
||||
CaptureSource::CosmicToplevel(toplevel) => {
|
||||
CaptureSource::Toplevel(toplevel) => {
|
||||
let info = self
|
||||
.toplevel_info_state
|
||||
.toplevels()
|
||||
.find(|info| info.cosmic_toplevel.as_ref() == Some(&toplevel));
|
||||
.find(|info| info.foreign_toplevel == *toplevel);
|
||||
if let Some(info) = info {
|
||||
self.send_event(Event::ToplevelCapture(info.foreign_toplevel.clone(), image))
|
||||
}
|
||||
}
|
||||
CaptureSource::CosmicWorkspace(workspace) => {
|
||||
CaptureSource::Workspace(workspace) => {
|
||||
self.send_event(Event::WorkspaceCapture(workspace.clone(), image));
|
||||
}
|
||||
CaptureSource::Output(_) | CaptureSource::Toplevel(_) => {
|
||||
CaptureSource::Output(_) => {
|
||||
unreachable!()
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,10 +22,9 @@ impl ToplevelInfoHandler for AppData {
|
|||
toplevel: &ExtForeignToplevelHandleV1,
|
||||
) {
|
||||
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
||||
let cosmic_toplevel = info.cosmic_toplevel.clone().unwrap();
|
||||
self.send_event(Event::NewToplevel(toplevel.clone(), info.clone()));
|
||||
|
||||
self.add_capture_source(CaptureSource::CosmicToplevel(cosmic_toplevel));
|
||||
self.add_capture_source(CaptureSource::Toplevel(toplevel.clone()));
|
||||
}
|
||||
|
||||
fn update_toplevel(
|
||||
|
|
@ -44,11 +43,9 @@ impl ToplevelInfoHandler for AppData {
|
|||
_qh: &QueueHandle<Self>,
|
||||
toplevel: &ExtForeignToplevelHandleV1,
|
||||
) {
|
||||
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
||||
let cosmic_toplevel = info.cosmic_toplevel.clone().unwrap();
|
||||
self.send_event(Event::CloseToplevel(toplevel.clone()));
|
||||
|
||||
self.remove_capture_source(CaptureSource::CosmicToplevel(cosmic_toplevel));
|
||||
self.remove_capture_source(CaptureSource::Toplevel(toplevel.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ impl WorkspaceHandler for AppData {
|
|||
// Handle move to another output
|
||||
|
||||
for group in self.workspace_state.workspace_groups() {
|
||||
for workspace in &group.workspaces {
|
||||
workspaces.push((group.outputs.iter().cloned().collect(), workspace.clone()));
|
||||
for workspace_handle in &group.workspaces {
|
||||
if let Some(workspace) = self.workspace_state.workspace_info(workspace_handle) {
|
||||
workspaces.push((group.outputs.iter().cloned().collect(), workspace.clone()));
|
||||
|
||||
// TODO one capture per output on workspace?
|
||||
self.add_capture_source(CaptureSource::CosmicWorkspace(workspace.handle.clone()));
|
||||
// TODO one capture per output on workspace?
|
||||
self.add_capture_source(CaptureSource::Workspace(workspace_handle.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue