Remove some comments
This commit is contained in:
parent
970885ec45
commit
7afd6451d2
3 changed files with 9 additions and 54 deletions
12
Cargo.toml
12
Cargo.toml
|
|
@ -6,8 +6,12 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cctk = { package = "cosmic-client-toolkit", git = "https://github.com/pop-os/cosmic-protocols" }
|
cctk = { package = "cosmic-client-toolkit", git = "https://github.com/pop-os/cosmic-protocols" }
|
||||||
futures-channel = "0.3.25"
|
futures-channel = "0.3.25"
|
||||||
iced = { git = "https://github.com/pop-os/libcosmic", features = ["tokio"] }
|
# iced = { git = "https://github.com/pop-os/libcosmic", features = ["tokio"] }
|
||||||
iced_native = { git = "https://github.com/pop-os/libcosmic" }
|
# iced_native = { git = "https://github.com/pop-os/libcosmic" }
|
||||||
iced_sctk = { git = "https://github.com/pop-os/libcosmic" }
|
# iced_sctk = { git = "https://github.com/pop-os/libcosmic" }
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic" }
|
# libcosmic = { git = "https://github.com/pop-os/libcosmic" }
|
||||||
|
iced = { path = "/home/ian/src/pop/libcosmic/iced", features = ["tokio"] }
|
||||||
|
iced_native = { path = "/home/ian/src/pop/libcosmic/iced/native" }
|
||||||
|
iced_sctk = { path = "/home/ian/src/pop/libcosmic/iced/sctk" }
|
||||||
|
libcosmic = { path = "/home/ian/src/pop/libcosmic" }
|
||||||
tokio = "1.23.0"
|
tokio = "1.23.0"
|
||||||
|
|
|
||||||
18
src/main.rs
18
src/main.rs
|
|
@ -39,7 +39,6 @@ struct Workspace {
|
||||||
|
|
||||||
struct LayerSurface {
|
struct LayerSurface {
|
||||||
output: wl_output::WlOutput,
|
output: wl_output::WlOutput,
|
||||||
//workspaces: Vec<Workspace>,
|
|
||||||
// Active workspace
|
// Active workspace
|
||||||
// windows in workspace
|
// windows in workspace
|
||||||
// - for transitions, would need windows in more than one workspace
|
// - for transitions, would need windows in more than one workspace
|
||||||
|
|
@ -79,28 +78,23 @@ impl Application for App {
|
||||||
Msg::WaylandEvent(evt) => match evt {
|
Msg::WaylandEvent(evt) => match evt {
|
||||||
WaylandEvent::Output(evt, output) => match evt {
|
WaylandEvent::Output(evt, output) => match evt {
|
||||||
OutputEvent::Created(Some(info)) => {
|
OutputEvent::Created(Some(info)) => {
|
||||||
//println!("Create: {:?}", output);
|
|
||||||
if let Some((width, height)) = info.logical_size {
|
if let Some((width, height)) = info.logical_size {
|
||||||
let id = self.next_surface_id();
|
let id = self.next_surface_id();
|
||||||
self.layer_surfaces.insert(
|
self.layer_surfaces.insert(
|
||||||
id.clone(),
|
id.clone(),
|
||||||
LayerSurface {
|
LayerSurface {
|
||||||
output: output.clone(),
|
output: output.clone(),
|
||||||
//workspaces: Vec::new(),
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// /*
|
|
||||||
return get_layer_surface(SctkLayerSurfaceSettings {
|
return get_layer_surface(SctkLayerSurfaceSettings {
|
||||||
id,
|
id,
|
||||||
keyboard_interactivity: KeyboardInteractivity::Exclusive,
|
keyboard_interactivity: KeyboardInteractivity::Exclusive,
|
||||||
//keyboard_interactivity: KeyboardInteractivity::None,
|
|
||||||
namespace: "workspaces".into(),
|
namespace: "workspaces".into(),
|
||||||
layer: Layer::Overlay,
|
layer: Layer::Overlay,
|
||||||
size: Some((Some(width as _), Some(height as _))),
|
size: Some((Some(width as _), Some(height as _))),
|
||||||
output: IcedOutput::Output(output),
|
output: IcedOutput::Output(output),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
// */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputEvent::Removed => {
|
OutputEvent::Removed => {
|
||||||
|
|
@ -126,11 +120,6 @@ impl Application for App {
|
||||||
// XXX removal
|
// XXX removal
|
||||||
self.workspaces = Vec::new();
|
self.workspaces = Vec::new();
|
||||||
for (output, workspace) in workspaces {
|
for (output, workspace) in workspaces {
|
||||||
/*
|
|
||||||
if output != &surface.output {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
self.workspaces.push(Workspace {
|
self.workspaces.push(Workspace {
|
||||||
name: workspace.name,
|
name: workspace.name,
|
||||||
handle: workspace.handle,
|
handle: workspace.handle,
|
||||||
|
|
@ -138,11 +127,10 @@ impl Application for App {
|
||||||
img: None,
|
img: None,
|
||||||
});
|
});
|
||||||
println!("add workspace");
|
println!("add workspace");
|
||||||
// Oh, set workspaces before surfaces created?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wayland::Event::WorkspaceCapture(workspace, image) => {
|
wayland::Event::WorkspaceCapture(workspace, image) => {
|
||||||
// XXX performanc
|
// XXX performance
|
||||||
for i in &mut self.workspaces {
|
for i in &mut self.workspaces {
|
||||||
if &i.handle == &workspace {
|
if &i.handle == &workspace {
|
||||||
i.img = Some(image.clone());
|
i.img = Some(image.clone());
|
||||||
|
|
@ -152,7 +140,6 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Msg::Close => {
|
Msg::Close => {
|
||||||
//println!("Close");
|
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
Msg::Closed(_) => {}
|
Msg::Closed(_) => {}
|
||||||
|
|
@ -226,7 +213,6 @@ fn workspace_sidebar_entry(workspace: &Workspace) -> cosmic::Element<Msg> {
|
||||||
fn workspaces_sidebar<'a>(
|
fn workspaces_sidebar<'a>(
|
||||||
workspaces: impl Iterator<Item = &'a Workspace>,
|
workspaces: impl Iterator<Item = &'a Workspace>,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
) -> cosmic::Element<'a, Msg> {
|
||||||
//println!("{:?}", workspaces);
|
|
||||||
iced::widget::column(workspaces.map(workspace_sidebar_entry).collect()).into()
|
iced::widget::column(workspaces.map(workspace_sidebar_entry).collect()).into()
|
||||||
// New workspace
|
// New workspace
|
||||||
}
|
}
|
||||||
|
|
@ -243,8 +229,6 @@ fn window_previews(windows: &[Window]) -> cosmic::Element<Msg> {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO create one surface per monitor?
|
|
||||||
// TODO how to get monitor size?
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
App::run(iced::Settings {
|
App::run(iced::Settings {
|
||||||
antialiasing: true,
|
antialiasing: true,
|
||||||
|
|
|
||||||
|
|
@ -127,12 +127,6 @@ impl ToplevelInfoHandler for AppData {
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
/*
|
|
||||||
println!(
|
|
||||||
"New toplevel: {:?}",
|
|
||||||
self.toplevel_info_state.info(toplevel).unwrap()
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_toplevel(
|
fn update_toplevel(
|
||||||
|
|
@ -141,12 +135,6 @@ impl ToplevelInfoHandler for AppData {
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
/*
|
|
||||||
println!(
|
|
||||||
"Update toplevel: {:?}",
|
|
||||||
self.toplevel_info_state.info(toplevel).unwrap()
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toplevel_closed(
|
fn toplevel_closed(
|
||||||
|
|
@ -155,12 +143,6 @@ impl ToplevelInfoHandler for AppData {
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
/*
|
|
||||||
println!(
|
|
||||||
"Closed toplevel: {:?}",
|
|
||||||
self.toplevel_info_state.info(toplevel).unwrap()
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,15 +155,7 @@ impl WorkspaceHandler for AppData {
|
||||||
let mut workspaces = Vec::new();
|
let mut workspaces = Vec::new();
|
||||||
|
|
||||||
for group in self.workspace_state.workspace_groups() {
|
for group in self.workspace_state.workspace_groups() {
|
||||||
/*
|
|
||||||
println!(
|
|
||||||
"Group: capabilities: {:?}, output: {:?}",
|
|
||||||
&group.capabilities, &group.output
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
for workspace in &group.workspaces {
|
for workspace in &group.workspaces {
|
||||||
//println!("{:?}", &workspace);
|
|
||||||
|
|
||||||
if let Some(output) = group.output.as_ref() {
|
if let Some(output) = group.output.as_ref() {
|
||||||
workspaces.push((output.clone(), workspace.clone()));
|
workspaces.push((output.clone(), workspace.clone()));
|
||||||
|
|
||||||
|
|
@ -222,10 +196,6 @@ impl ScreencopyHandler for AppData {
|
||||||
session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1,
|
session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1,
|
||||||
buffer_infos: &[BufferInfo],
|
buffer_infos: &[BufferInfo],
|
||||||
) {
|
) {
|
||||||
//println!("init_done");
|
|
||||||
// TODO BIND
|
|
||||||
|
|
||||||
// XXX
|
|
||||||
let buffer_info = buffer_infos
|
let buffer_info = buffer_infos
|
||||||
.iter()
|
.iter()
|
||||||
.find(|x| {
|
.find(|x| {
|
||||||
|
|
@ -280,8 +250,6 @@ impl ScreencopyHandler for AppData {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//println!("ready");
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn failed(
|
fn failed(
|
||||||
|
|
@ -291,7 +259,6 @@ impl ScreencopyHandler for AppData {
|
||||||
session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1,
|
session: &zcosmic_screencopy_session_v1::ZcosmicScreencopySessionV1,
|
||||||
reason: WEnum<zcosmic_screencopy_session_v1::FailureReason>,
|
reason: WEnum<zcosmic_screencopy_session_v1::FailureReason>,
|
||||||
) {
|
) {
|
||||||
//println!("failed");
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue