Pass toplevel_capabilities from backend to frontend
This commit is contained in:
parent
fc784af1b9
commit
77ff4e62e9
4 changed files with 28 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ use cosmic::{
|
|||
cctk::{
|
||||
cosmic_protocols::{
|
||||
toplevel_info::v1::client::zcosmic_toplevel_handle_v1,
|
||||
toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||
workspace::v2::client::zcosmic_workspace_handle_v2,
|
||||
},
|
||||
wayland_client::{
|
||||
|
|
@ -219,6 +220,11 @@ fn start(_conn: Connection) -> mpsc::Receiver<Event> {
|
|||
outputs: Vec::new(),
|
||||
workspaces: Vec::new(),
|
||||
};
|
||||
app_data.send_event(Event::ToplevelCapabilities(vec![
|
||||
zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1::Close,
|
||||
zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1::Activate,
|
||||
zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1::MoveToWorkspace,
|
||||
]));
|
||||
app_data.send_event(Event::CmdSender(cmd_sender));
|
||||
loop {
|
||||
event_loop.dispatch(None, &mut app_data).unwrap();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@
|
|||
//! backend for testing without any special protocols.
|
||||
|
||||
use cosmic::{
|
||||
cctk::wayland_client::protocol::wl_output,
|
||||
cctk::{
|
||||
cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||
wayland_client::protocol::wl_output,
|
||||
},
|
||||
iced_winit::platform_specific::wayland::subsurface_widget::SubsurfaceBuffer,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
|
|
@ -62,6 +65,9 @@ pub enum Event {
|
|||
UpdateToplevel(ExtForeignToplevelHandleV1, ToplevelInfo),
|
||||
CloseToplevel(ExtForeignToplevelHandleV1),
|
||||
ToplevelCapture(ExtForeignToplevelHandleV1, CaptureImage),
|
||||
ToplevelCapabilities(
|
||||
Vec<zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1>,
|
||||
),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -58,10 +58,18 @@ impl ToplevelManagerHandler for AppData {
|
|||
&mut self,
|
||||
_conn: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
_capabilities: Vec<
|
||||
capabilities: Vec<
|
||||
WEnum<zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1>,
|
||||
>,
|
||||
) {
|
||||
let capabilities = capabilities
|
||||
.into_iter()
|
||||
.filter_map(|i| match i {
|
||||
WEnum::Value(value) => Some(value),
|
||||
WEnum::Unknown(_) => None,
|
||||
})
|
||||
.collect();
|
||||
self.send_event(Event::ToplevelCapabilities(capabilities));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#![allow(clippy::single_match)]
|
||||
|
||||
use cctk::{
|
||||
cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||
sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer},
|
||||
wayland_client::{protocol::wl_output, Connection, Proxy},
|
||||
wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1,
|
||||
|
|
@ -169,6 +170,8 @@ struct App {
|
|||
outputs: Vec<Output>,
|
||||
workspaces: Vec<Workspace>,
|
||||
toplevels: Vec<Toplevel>,
|
||||
toplevel_capabilities:
|
||||
Vec<zcosmic_toplevel_manager_v1::ZcosmicToplelevelManagementCapabilitiesV1>,
|
||||
conn: Option<Connection>,
|
||||
visible: bool,
|
||||
wayland_cmd_sender: Option<calloop::channel::Sender<backend::Cmd>>,
|
||||
|
|
@ -463,6 +466,9 @@ impl Application for App {
|
|||
toplevel.img = Some(image);
|
||||
}
|
||||
}
|
||||
backend::Event::ToplevelCapabilities(capabilities) => {
|
||||
self.toplevel_capabilities = capabilities;
|
||||
}
|
||||
}
|
||||
}
|
||||
Msg::Close => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue