Update for toplevel-info cctk changes
This commit is contained in:
parent
e283cfe456
commit
4acd62abb0
9 changed files with 90 additions and 68 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
|
@ -1134,7 +1134,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-client-toolkit"
|
name = "cosmic-client-toolkit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=29ab323#29ab32305c6457fccf0728caaaf79fcac4cca665"
|
source = "git+https://github.com/pop-os/cosmic-protocols?rev=178eb0b#178eb0b14a0e5c192f64f6dee6c40341a8e5ee51"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmic-protocols",
|
"cosmic-protocols",
|
||||||
"libc",
|
"libc",
|
||||||
|
|
@ -1156,7 +1156,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-config"
|
name = "cosmic-config"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomicwrites",
|
"atomicwrites",
|
||||||
"cosmic-config-derive",
|
"cosmic-config-derive",
|
||||||
|
|
@ -1175,7 +1175,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-config-derive"
|
name = "cosmic-config-derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
|
|
@ -1197,7 +1197,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-protocols"
|
name = "cosmic-protocols"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/cosmic-protocols?rev=29ab323#29ab32305c6457fccf0728caaaf79fcac4cca665"
|
source = "git+https://github.com/pop-os/cosmic-protocols?rev=178eb0b#178eb0b14a0e5c192f64f6dee6c40341a8e5ee51"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.8.0",
|
"bitflags 2.8.0",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
|
|
@ -1233,7 +1233,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-theme"
|
name = "cosmic-theme"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"almost",
|
"almost",
|
||||||
"cosmic-config",
|
"cosmic-config",
|
||||||
|
|
@ -2517,7 +2517,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced"
|
name = "iced"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dnd",
|
"dnd",
|
||||||
"iced_accessibility",
|
"iced_accessibility",
|
||||||
|
|
@ -2535,7 +2535,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_accessibility"
|
name = "iced_accessibility"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"accesskit",
|
"accesskit",
|
||||||
"accesskit_winit",
|
"accesskit_winit",
|
||||||
|
|
@ -2544,7 +2544,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_core"
|
name = "iced_core"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.8.0",
|
"bitflags 2.8.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -2568,7 +2568,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_futures"
|
name = "iced_futures"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"iced_core",
|
"iced_core",
|
||||||
|
|
@ -2594,7 +2594,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_graphics"
|
name = "iced_graphics"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.8.0",
|
"bitflags 2.8.0",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
|
@ -2616,7 +2616,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_renderer"
|
name = "iced_renderer"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iced_graphics",
|
"iced_graphics",
|
||||||
"iced_tiny_skia",
|
"iced_tiny_skia",
|
||||||
|
|
@ -2628,7 +2628,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_runtime"
|
name = "iced_runtime"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"cosmic-client-toolkit",
|
"cosmic-client-toolkit",
|
||||||
|
|
@ -2643,7 +2643,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_tiny_skia"
|
name = "iced_tiny_skia"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cosmic-text",
|
"cosmic-text",
|
||||||
|
|
@ -2659,7 +2659,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_wgpu"
|
name = "iced_wgpu"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as-raw-xcb-connection",
|
"as-raw-xcb-connection",
|
||||||
"bitflags 2.8.0",
|
"bitflags 2.8.0",
|
||||||
|
|
@ -2690,7 +2690,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_widget"
|
name = "iced_widget"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmic-client-toolkit",
|
"cosmic-client-toolkit",
|
||||||
"dnd",
|
"dnd",
|
||||||
|
|
@ -2708,7 +2708,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced_winit"
|
name = "iced_winit"
|
||||||
version = "0.14.0-dev"
|
version = "0.14.0-dev"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cosmic-client-toolkit",
|
"cosmic-client-toolkit",
|
||||||
"dnd",
|
"dnd",
|
||||||
|
|
@ -3163,7 +3163,7 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcosmic"
|
name = "libcosmic"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/libcosmic#9426a985c62288e996827a3560770c19271b337a"
|
source = "git+https://github.com/pop-os/libcosmic#0b7e23444afb3f351cd947c52babb6b87f30381d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"apply",
|
"apply",
|
||||||
"ashpd 0.9.2",
|
"ashpd 0.9.2",
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ impl ZcosmicWorkspaceHandleV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
#[derive(Eq, PartialEq, Clone, Debug, Hash)]
|
||||||
pub struct ZcosmicToplevelHandleV1(MockObjectId);
|
pub struct ExtForeignToplevelHandleV1(MockObjectId);
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct CaptureFilter {
|
pub struct CaptureFilter {
|
||||||
|
|
@ -147,7 +147,7 @@ impl AppData {
|
||||||
};
|
};
|
||||||
// Add three toplevels for each workspace
|
// Add three toplevels for each workspace
|
||||||
for j in 0..=3 {
|
for j in 0..=3 {
|
||||||
let toplevel_handle = ZcosmicToplevelHandleV1(MockObjectId::new());
|
let toplevel_handle = ExtForeignToplevelHandleV1(MockObjectId::new());
|
||||||
let toplevel_info = ToplevelInfo {
|
let toplevel_info = ToplevelInfo {
|
||||||
title: format!("App {}", j),
|
title: format!("App {}", j),
|
||||||
app_id: "com.example.app".to_string(),
|
app_id: "com.example.app".to_string(),
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,12 @@ use std::collections::HashSet;
|
||||||
mod wayland;
|
mod wayland;
|
||||||
#[cfg(not(feature = "mock-backend"))]
|
#[cfg(not(feature = "mock-backend"))]
|
||||||
pub use cosmic::cctk::{
|
pub use cosmic::cctk::{
|
||||||
cosmic_protocols::{
|
cosmic_protocols::workspace::v1::client::zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1,
|
||||||
toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel_info::ToplevelInfo, workspace::Workspace,
|
||||||
workspace::v1::client::zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1,
|
|
||||||
},
|
|
||||||
toplevel_info::ToplevelInfo,
|
|
||||||
workspace::Workspace,
|
|
||||||
};
|
};
|
||||||
|
#[cfg(not(feature = "mock-backend"))]
|
||||||
|
pub use wayland_protocols::ext::foreign_toplevel_list::v1::client::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1;
|
||||||
|
|
||||||
#[cfg(not(feature = "mock-backend"))]
|
#[cfg(not(feature = "mock-backend"))]
|
||||||
pub use wayland::subscription;
|
pub use wayland::subscription;
|
||||||
|
|
||||||
|
|
@ -33,7 +32,7 @@ pub use wayland::subscription;
|
||||||
mod mock;
|
mod mock;
|
||||||
#[cfg(feature = "mock-backend")]
|
#[cfg(feature = "mock-backend")]
|
||||||
pub use mock::{
|
pub use mock::{
|
||||||
subscription, ToplevelInfo, Workspace, ZcosmicToplevelHandleV1, ZcosmicWorkspaceHandleV1,
|
subscription, ExtForeignToplevelHandleV1, ToplevelInfo, Workspace, ZcosmicWorkspaceHandleV1,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
#[derive(Clone, Debug, Default)]
|
||||||
|
|
@ -59,19 +58,19 @@ pub enum Event {
|
||||||
CmdSender(calloop::channel::Sender<Cmd>),
|
CmdSender(calloop::channel::Sender<Cmd>),
|
||||||
Workspaces(Vec<(HashSet<wl_output::WlOutput>, Workspace)>),
|
Workspaces(Vec<(HashSet<wl_output::WlOutput>, Workspace)>),
|
||||||
WorkspaceCapture(ZcosmicWorkspaceHandleV1, CaptureImage),
|
WorkspaceCapture(ZcosmicWorkspaceHandleV1, CaptureImage),
|
||||||
NewToplevel(ZcosmicToplevelHandleV1, ToplevelInfo),
|
NewToplevel(ExtForeignToplevelHandleV1, ToplevelInfo),
|
||||||
UpdateToplevel(ZcosmicToplevelHandleV1, ToplevelInfo),
|
UpdateToplevel(ExtForeignToplevelHandleV1, ToplevelInfo),
|
||||||
CloseToplevel(ZcosmicToplevelHandleV1),
|
CloseToplevel(ExtForeignToplevelHandleV1),
|
||||||
ToplevelCapture(ZcosmicToplevelHandleV1, CaptureImage),
|
ToplevelCapture(ExtForeignToplevelHandleV1, CaptureImage),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
CaptureFilter(CaptureFilter),
|
CaptureFilter(CaptureFilter),
|
||||||
ActivateToplevel(ZcosmicToplevelHandleV1),
|
ActivateToplevel(ExtForeignToplevelHandleV1),
|
||||||
CloseToplevel(ZcosmicToplevelHandleV1),
|
CloseToplevel(ExtForeignToplevelHandleV1),
|
||||||
MoveToplevelToWorkspace(
|
MoveToplevelToWorkspace(
|
||||||
ZcosmicToplevelHandleV1,
|
ExtForeignToplevelHandleV1,
|
||||||
ZcosmicWorkspaceHandleV1,
|
ZcosmicWorkspaceHandleV1,
|
||||||
wl_output::WlOutput,
|
wl_output::WlOutput,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -75,22 +75,31 @@ impl AppData {
|
||||||
self.invalidate_capture_filter();
|
self.invalidate_capture_filter();
|
||||||
}
|
}
|
||||||
Cmd::ActivateToplevel(toplevel_handle) => {
|
Cmd::ActivateToplevel(toplevel_handle) => {
|
||||||
for seat in self.seat_state.seats() {
|
let info = self.toplevel_info_state.info(&toplevel_handle);
|
||||||
self.toplevel_manager_state
|
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
|
||||||
.manager
|
for seat in self.seat_state.seats() {
|
||||||
.activate(&toplevel_handle, &seat);
|
self.toplevel_manager_state
|
||||||
|
.manager
|
||||||
|
.activate(&cosmic_toplevel, &seat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cmd::CloseToplevel(toplevel_handle) => {
|
Cmd::CloseToplevel(toplevel_handle) => {
|
||||||
self.toplevel_manager_state.manager.close(&toplevel_handle);
|
let info = self.toplevel_info_state.info(&toplevel_handle);
|
||||||
|
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
|
||||||
|
self.toplevel_manager_state.manager.close(&cosmic_toplevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Cmd::MoveToplevelToWorkspace(toplevel_handle, workspace_handle, output) => {
|
Cmd::MoveToplevelToWorkspace(toplevel_handle, workspace_handle, output) => {
|
||||||
if self.toplevel_manager_state.manager.version() >= 2 {
|
let info = self.toplevel_info_state.info(&toplevel_handle);
|
||||||
self.toplevel_manager_state.manager.move_to_workspace(
|
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
|
||||||
&toplevel_handle,
|
if self.toplevel_manager_state.manager.version() >= 2 {
|
||||||
&workspace_handle,
|
self.toplevel_manager_state.manager.move_to_workspace(
|
||||||
&output,
|
&cosmic_toplevel,
|
||||||
);
|
&workspace_handle,
|
||||||
|
&output,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cmd::ActivateWorkspace(workspace_handle) => {
|
Cmd::ActivateWorkspace(workspace_handle) => {
|
||||||
|
|
@ -105,12 +114,19 @@ impl AppData {
|
||||||
fn matches_capture_filter(&self, source: &CaptureSource) -> bool {
|
fn matches_capture_filter(&self, source: &CaptureSource) -> bool {
|
||||||
match source {
|
match source {
|
||||||
CaptureSource::CosmicToplevel(toplevel) => {
|
CaptureSource::CosmicToplevel(toplevel) => {
|
||||||
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
let info = self
|
||||||
info.workspace.iter().any(|workspace| {
|
.toplevel_info_state
|
||||||
self.capture_filter
|
.toplevels()
|
||||||
.toplevels_on_workspaces
|
.find(|info| info.cosmic_toplevel.as_ref() == Some(&toplevel));
|
||||||
.contains(workspace)
|
if let Some(info) = info {
|
||||||
})
|
info.workspace.iter().any(|workspace| {
|
||||||
|
self.capture_filter
|
||||||
|
.toplevels_on_workspaces
|
||||||
|
.contains(workspace)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CaptureSource::CosmicWorkspace(workspace) => self
|
CaptureSource::CosmicWorkspace(workspace) => self
|
||||||
.workspace_state
|
.workspace_state
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,13 @@ impl ScreencopyHandler for AppData {
|
||||||
};
|
};
|
||||||
match &capture.source {
|
match &capture.source {
|
||||||
CaptureSource::CosmicToplevel(toplevel) => {
|
CaptureSource::CosmicToplevel(toplevel) => {
|
||||||
self.send_event(Event::ToplevelCapture(toplevel.clone(), image))
|
let info = self
|
||||||
|
.toplevel_info_state
|
||||||
|
.toplevels()
|
||||||
|
.find(|info| info.cosmic_toplevel.as_ref() == Some(&toplevel));
|
||||||
|
if let Some(info) = info {
|
||||||
|
self.send_event(Event::ToplevelCapture(info.foreign_toplevel.clone(), image))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CaptureSource::CosmicWorkspace(workspace) => {
|
CaptureSource::CosmicWorkspace(workspace) => {
|
||||||
self.send_event(Event::WorkspaceCapture(workspace.clone(), image));
|
self.send_event(Event::WorkspaceCapture(workspace.clone(), image));
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
use cctk::{
|
use cctk::{
|
||||||
cosmic_protocols::{
|
cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||||
toplevel_info::v1::client::zcosmic_toplevel_handle_v1,
|
|
||||||
toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
|
||||||
},
|
|
||||||
toplevel_info::{ToplevelInfoHandler, ToplevelInfoState},
|
toplevel_info::{ToplevelInfoHandler, ToplevelInfoState},
|
||||||
toplevel_management::{ToplevelManagerHandler, ToplevelManagerState},
|
toplevel_management::{ToplevelManagerHandler, ToplevelManagerState},
|
||||||
wayland_client::{Connection, QueueHandle, WEnum},
|
wayland_client::{Connection, QueueHandle, WEnum},
|
||||||
};
|
};
|
||||||
use cosmic::cctk;
|
use cosmic::cctk;
|
||||||
|
use wayland_protocols::ext::foreign_toplevel_list::v1::client::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1;
|
||||||
|
|
||||||
use super::{AppData, CaptureSource, Event};
|
use super::{AppData, CaptureSource, Event};
|
||||||
|
|
||||||
|
|
@ -21,19 +19,20 @@ impl ToplevelInfoHandler for AppData {
|
||||||
&mut self,
|
&mut self,
|
||||||
_conn: &Connection,
|
_conn: &Connection,
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &ExtForeignToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
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.send_event(Event::NewToplevel(toplevel.clone(), info.clone()));
|
||||||
|
|
||||||
self.add_capture_source(CaptureSource::CosmicToplevel(toplevel.clone()));
|
self.add_capture_source(CaptureSource::CosmicToplevel(cosmic_toplevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_toplevel(
|
fn update_toplevel(
|
||||||
&mut self,
|
&mut self,
|
||||||
_conn: &Connection,
|
_conn: &Connection,
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &ExtForeignToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
let info = self.toplevel_info_state.info(toplevel).unwrap();
|
||||||
self.send_event(Event::UpdateToplevel(toplevel.clone(), info.clone()));
|
self.send_event(Event::UpdateToplevel(toplevel.clone(), info.clone()));
|
||||||
|
|
@ -43,11 +42,13 @@ impl ToplevelInfoHandler for AppData {
|
||||||
&mut self,
|
&mut self,
|
||||||
_conn: &Connection,
|
_conn: &Connection,
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
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.send_event(Event::CloseToplevel(toplevel.clone()));
|
||||||
|
|
||||||
self.remove_capture_source(CaptureSource::CosmicToplevel(toplevel.clone()));
|
self.remove_capture_source(CaptureSource::CosmicToplevel(cosmic_toplevel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use cosmic::{
|
||||||
};
|
};
|
||||||
use std::{borrow::Cow, sync::LazyLock};
|
use std::{borrow::Cow, sync::LazyLock};
|
||||||
|
|
||||||
use crate::backend::{ZcosmicToplevelHandleV1, ZcosmicWorkspaceHandleV1};
|
use crate::backend::{ExtForeignToplevelHandleV1, ZcosmicWorkspaceHandleV1};
|
||||||
|
|
||||||
// Include `pid` in mime. Want to drag between our surfaces, but not another
|
// Include `pid` in mime. Want to drag between our surfaces, but not another
|
||||||
// process, if we use Wayland object ids.
|
// process, if we use Wayland object ids.
|
||||||
|
|
@ -20,7 +20,7 @@ static TOPLEVEL_MIME: LazyLock<String> =
|
||||||
pub enum DragSurface {
|
pub enum DragSurface {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
Workspace(ZcosmicWorkspaceHandleV1),
|
Workspace(ZcosmicWorkspaceHandleV1),
|
||||||
Toplevel(ZcosmicToplevelHandleV1),
|
Toplevel(ExtForeignToplevelHandleV1),
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO store protocol object id?
|
// TODO store protocol object id?
|
||||||
|
|
|
||||||
10
src/main.rs
10
src/main.rs
|
|
@ -43,7 +43,7 @@ mod desktop_info;
|
||||||
mod localize;
|
mod localize;
|
||||||
mod backend;
|
mod backend;
|
||||||
mod view;
|
mod view;
|
||||||
use backend::{ToplevelInfo, ZcosmicToplevelHandleV1, ZcosmicWorkspaceHandleV1};
|
use backend::{ExtForeignToplevelHandleV1, ToplevelInfo, ZcosmicWorkspaceHandleV1};
|
||||||
mod dnd;
|
mod dnd;
|
||||||
mod utils;
|
mod utils;
|
||||||
mod widgets;
|
mod widgets;
|
||||||
|
|
@ -92,8 +92,8 @@ enum Msg {
|
||||||
ActivateWorkspace(ZcosmicWorkspaceHandleV1),
|
ActivateWorkspace(ZcosmicWorkspaceHandleV1),
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
CloseWorkspace(ZcosmicWorkspaceHandleV1),
|
CloseWorkspace(ZcosmicWorkspaceHandleV1),
|
||||||
ActivateToplevel(ZcosmicToplevelHandleV1),
|
ActivateToplevel(ExtForeignToplevelHandleV1),
|
||||||
CloseToplevel(ZcosmicToplevelHandleV1),
|
CloseToplevel(ExtForeignToplevelHandleV1),
|
||||||
StartDrag(DragSurface),
|
StartDrag(DragSurface),
|
||||||
DndEnter(DropTarget, f64, f64, Vec<String>),
|
DndEnter(DropTarget, f64, f64, Vec<String>),
|
||||||
DndLeave(DropTarget),
|
DndLeave(DropTarget),
|
||||||
|
|
@ -125,7 +125,7 @@ struct Workspace {
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct Toplevel {
|
struct Toplevel {
|
||||||
handle: ZcosmicToplevelHandleV1,
|
handle: ExtForeignToplevelHandleV1,
|
||||||
info: ToplevelInfo,
|
info: ToplevelInfo,
|
||||||
img: Option<backend::CaptureImage>,
|
img: Option<backend::CaptureImage>,
|
||||||
icon: Option<PathBuf>,
|
icon: Option<PathBuf>,
|
||||||
|
|
@ -193,7 +193,7 @@ impl App {
|
||||||
|
|
||||||
fn toplevel_for_handle_mut(
|
fn toplevel_for_handle_mut(
|
||||||
&mut self,
|
&mut self,
|
||||||
handle: &ZcosmicToplevelHandleV1,
|
handle: &ExtForeignToplevelHandleV1,
|
||||||
) -> Option<&mut Toplevel> {
|
) -> Option<&mut Toplevel> {
|
||||||
self.toplevels.iter_mut().find(|i| &i.handle == handle)
|
self.toplevels.iter_mut().find(|i| &i.handle == handle)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ fn toplevel_previews_entry<'a>(
|
||||||
fn toplevel_previews<'a>(
|
fn toplevel_previews<'a>(
|
||||||
toplevels: impl Iterator<Item = &'a Toplevel>,
|
toplevels: impl Iterator<Item = &'a Toplevel>,
|
||||||
layout: WorkspaceLayout,
|
layout: WorkspaceLayout,
|
||||||
drag_toplevel: Option<&'a backend::ZcosmicToplevelHandleV1>,
|
drag_toplevel: Option<&'a backend::ExtForeignToplevelHandleV1>,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
) -> cosmic::Element<'a, Msg> {
|
||||||
let (width, height) = match layout {
|
let (width, height) = match layout {
|
||||||
WorkspaceLayout::Vertical => (iced::Length::FillPortion(4), iced::Length::Fill),
|
WorkspaceLayout::Vertical => (iced::Length::FillPortion(4), iced::Length::Fill),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue