Address various warnings
This commit is contained in:
parent
ea0de44e42
commit
7106001179
7 changed files with 24 additions and 31 deletions
|
|
@ -14,6 +14,7 @@ pub fn icon_for_app_id(app_id: String) -> Option<PathBuf> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
struct DesktopInfo {
|
struct DesktopInfo {
|
||||||
id: String,
|
id: String,
|
||||||
|
|
|
||||||
24
src/main.rs
24
src/main.rs
|
|
@ -40,7 +40,6 @@ use cosmic::{
|
||||||
iced_sctk::commands::layer_surface::{destroy_layer_surface, get_layer_surface},
|
iced_sctk::commands::layer_surface::{destroy_layer_surface, get_layer_surface},
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::CosmicCompConfig;
|
use cosmic_comp_config::CosmicCompConfig;
|
||||||
use cosmic_config::ConfigSet;
|
|
||||||
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
|
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
|
||||||
use i18n_embed::DesktopLanguageRequester;
|
use i18n_embed::DesktopLanguageRequester;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
@ -117,6 +116,7 @@ enum Msg {
|
||||||
Close,
|
Close,
|
||||||
Closed(SurfaceId),
|
Closed(SurfaceId),
|
||||||
ActivateWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
|
ActivateWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
|
||||||
|
#[allow(dead_code)]
|
||||||
CloseWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
|
CloseWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
|
||||||
ActivateToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
|
ActivateToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
|
||||||
CloseToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
|
CloseToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
|
||||||
|
|
@ -132,6 +132,7 @@ enum Msg {
|
||||||
DndWorkspaceDrop,
|
DndWorkspaceDrop,
|
||||||
DndWorkspaceData(String, Vec<u8>),
|
DndWorkspaceData(String, Vec<u8>),
|
||||||
SourceFinished,
|
SourceFinished,
|
||||||
|
#[allow(dead_code)]
|
||||||
NewWorkspace,
|
NewWorkspace,
|
||||||
CompConfig(CosmicCompConfig),
|
CompConfig(CosmicCompConfig),
|
||||||
Config(CosmicWorkspacesConfig),
|
Config(CosmicWorkspacesConfig),
|
||||||
|
|
@ -555,7 +556,7 @@ impl Application for App {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Msg::DndWorkspaceEnter(handle, output, action, mimes, (_x, _y)) => {
|
Msg::DndWorkspaceEnter(handle, output, _action, mimes, (_x, _y)) => {
|
||||||
self.drop_target = Some((handle, output));
|
self.drop_target = Some((handle, output));
|
||||||
// XXX
|
// XXX
|
||||||
// if mimes.iter().any(|x| x == WORKSPACE_MIME) && action == DndAction::Move {
|
// if mimes.iter().any(|x| x == WORKSPACE_MIME) && action == DndAction::Move {
|
||||||
|
|
@ -581,17 +582,14 @@ impl Application for App {
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|s| u32::from_str(s).ok());
|
.and_then(|s| u32::from_str(s).ok());
|
||||||
if let Some((_, DragSurface::Toplevel { handle, .. }, _)) = &self.drag_surface {
|
if let Some((_, DragSurface::Toplevel { handle, .. }, _)) = &self.drag_surface {
|
||||||
if let Some(toplevel) = self.toplevels.iter().find(|t| &t.handle == handle)
|
if let Some(drop_target) = &self.drop_target {
|
||||||
{
|
if let Some(toplevel_manager) = self.toplevel_manager.as_ref() {
|
||||||
if let Some(drop_target) = &self.drop_target {
|
if toplevel_manager.version() >= 2 {
|
||||||
if let Some(toplevel_manager) = self.toplevel_manager.as_ref() {
|
toplevel_manager.move_to_workspace(
|
||||||
if toplevel_manager.version() >= 2 {
|
handle,
|
||||||
toplevel_manager.move_to_workspace(
|
&drop_target.0,
|
||||||
handle,
|
&drop_target.1,
|
||||||
&drop_target.0,
|
);
|
||||||
&drop_target.1,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ pub(crate) fn workspace_item<'a>(
|
||||||
fn workspace_sidebar_entry<'a>(
|
fn workspace_sidebar_entry<'a>(
|
||||||
workspace: &'a Workspace,
|
workspace: &'a Workspace,
|
||||||
output: &'a wl_output::WlOutput,
|
output: &'a wl_output::WlOutput,
|
||||||
is_drop_target: bool,
|
_is_drop_target: bool,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
) -> cosmic::Element<'a, Msg> {
|
||||||
/* XXX
|
/* XXX
|
||||||
let mouse_interaction = if is_drop_target {
|
let mouse_interaction = if is_drop_target {
|
||||||
|
|
@ -154,6 +154,7 @@ fn workspaces_sidebar<'a>(
|
||||||
};
|
};
|
||||||
let sidebar_entries_container =
|
let sidebar_entries_container =
|
||||||
widget::container(crate::widgets::workspace_bar(sidebar_entries, axis)).padding(12.0);
|
widget::container(crate::widgets::workspace_bar(sidebar_entries, axis)).padding(12.0);
|
||||||
|
/*
|
||||||
let new_workspace_button = widget::button(
|
let new_workspace_button = widget::button(
|
||||||
widget::container(row![
|
widget::container(row![
|
||||||
widget::icon::from_name("list-add-symbolic").symbolic(true),
|
widget::icon::from_name("list-add-symbolic").symbolic(true),
|
||||||
|
|
@ -164,7 +165,6 @@ fn workspaces_sidebar<'a>(
|
||||||
)
|
)
|
||||||
.on_press(Msg::NewWorkspace)
|
.on_press(Msg::NewWorkspace)
|
||||||
.width(iced::Length::Fill);
|
.width(iced::Length::Fill);
|
||||||
/*
|
|
||||||
let bar: cosmic::Element<_> = if amount != WorkspaceAmount::Dynamic {
|
let bar: cosmic::Element<_> = if amount != WorkspaceAmount::Dynamic {
|
||||||
match layout {
|
match layout {
|
||||||
WorkspaceLayout::Vertical => {
|
WorkspaceLayout::Vertical => {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ use cctk::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use cosmic::cctk;
|
use cosmic::cctk;
|
||||||
use cosmic::iced::widget::image;
|
use cosmic::iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf};
|
||||||
use cosmic::iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf, SubsurfaceBuffer};
|
|
||||||
use memmap2::Mmap;
|
|
||||||
use rustix::{io::Errno, shm::ShmOFlags};
|
use rustix::{io::Errno, shm::ShmOFlags};
|
||||||
use std::{
|
use std::{
|
||||||
os::fd::{AsFd, OwnedFd},
|
os::fd::{AsFd, OwnedFd},
|
||||||
|
|
@ -58,6 +56,7 @@ fn create_memfile() -> rustix::io::Result<OwnedFd> {
|
||||||
return Err(errno.into());
|
return Err(errno.into());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
Err(Errno::EXIST | Errno::EXIST) => {
|
Err(Errno::EXIST | Errno::EXIST) => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -66,11 +65,6 @@ fn create_memfile() -> rustix::io::Result<OwnedFd> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BufferBacking {
|
|
||||||
Shm { fd: OwnedFd },
|
|
||||||
Dmabuf { fd: OwnedFd, stride: u32 },
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Buffer {
|
pub struct Buffer {
|
||||||
pub backing: Arc<BufferSource>,
|
pub backing: Arc<BufferSource>,
|
||||||
pub buffer: wl_buffer::WlBuffer,
|
pub buffer: wl_buffer::WlBuffer,
|
||||||
|
|
@ -81,7 +75,7 @@ pub struct Buffer {
|
||||||
impl AppData {
|
impl AppData {
|
||||||
fn create_shm_buffer(&self, buffer_info: &BufferInfo) -> Buffer {
|
fn create_shm_buffer(&self, buffer_info: &BufferInfo) -> Buffer {
|
||||||
let fd = create_memfile().unwrap(); // XXX?
|
let fd = create_memfile().unwrap(); // XXX?
|
||||||
rustix::fs::ftruncate(&fd, buffer_info.stride as u64 * buffer_info.height as u64);
|
rustix::fs::ftruncate(&fd, buffer_info.stride as u64 * buffer_info.height as u64).unwrap();
|
||||||
|
|
||||||
let pool = self.shm_state.wl_shm().create_pool(
|
let pool = self.shm_state.wl_shm().create_pool(
|
||||||
fd.as_fd(),
|
fd.as_fd(),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use cctk::{
|
||||||
toplevel_management::ToplevelManagerState,
|
toplevel_management::ToplevelManagerState,
|
||||||
wayland_client::{
|
wayland_client::{
|
||||||
globals::registry_queue_init,
|
globals::registry_queue_init,
|
||||||
protocol::{wl_buffer, wl_output, wl_seat},
|
protocol::{wl_output, wl_seat},
|
||||||
Connection, QueueHandle,
|
Connection, QueueHandle,
|
||||||
},
|
},
|
||||||
workspace::WorkspaceState,
|
workspace::WorkspaceState,
|
||||||
|
|
@ -99,7 +99,6 @@ pub enum Cmd {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct AppData {
|
pub struct AppData {
|
||||||
conn: Connection,
|
|
||||||
qh: QueueHandle<Self>,
|
qh: QueueHandle<Self>,
|
||||||
dmabuf_state: DmabufState,
|
dmabuf_state: DmabufState,
|
||||||
registry_state: RegistryState,
|
registry_state: RegistryState,
|
||||||
|
|
@ -244,7 +243,6 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
||||||
|
|
||||||
let registry_state = RegistryState::new(&globals);
|
let registry_state = RegistryState::new(&globals);
|
||||||
let mut app_data = AppData {
|
let mut app_data = AppData {
|
||||||
conn: conn.clone(),
|
|
||||||
qh: qh.clone(),
|
qh: qh.clone(),
|
||||||
dmabuf_state,
|
dmabuf_state,
|
||||||
workspace_state: WorkspaceState::new(®istry_state, &qh), // Create before toplevel info state
|
workspace_state: WorkspaceState::new(®istry_state, &qh), // Create before toplevel info state
|
||||||
|
|
@ -286,7 +284,10 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
event_loop.handle().insert_source(executor, |(), _, _| {});
|
event_loop
|
||||||
|
.handle()
|
||||||
|
.insert_source(executor, |(), _, _| {})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
event_loop.dispatch(None, &mut app_data).unwrap();
|
event_loop.dispatch(None, &mut app_data).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ impl ScreencopySession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn attach_buffer_and_commit(&mut self, capture: &Capture, conn: &Connection) {
|
fn attach_buffer_and_commit(&mut self, _capture: &Capture, conn: &Connection) {
|
||||||
let Some(back) = self.buffers.as_ref().map(|x| &x[1]) else {
|
let Some(back) = self.buffers.as_ref().map(|x| &x[1]) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for Toplevels<'a, Msg
|
||||||
.zip(tree.children.iter_mut())
|
.zip(tree.children.iter_mut())
|
||||||
.map(|(child, tree)| {
|
.map(|(child, tree)| {
|
||||||
let child_limits = layout::Limits::new(Size::ZERO, limits.max());
|
let child_limits = layout::Limits::new(Size::ZERO, limits.max());
|
||||||
let mut layout = child.as_widget().layout(tree, renderer, &child_limits);
|
let layout = child.as_widget().layout(tree, renderer, &child_limits);
|
||||||
self.axis.main(layout.size())
|
self.axis.main(layout.size())
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
@ -122,7 +122,6 @@ impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for Toplevels<'a, Msg
|
||||||
|
|
||||||
let (total_width, total_height) = self.axis.pack(total_main, max_cross);
|
let (total_width, total_height) = self.axis.pack(total_main, max_cross);
|
||||||
let size = Size::new(total_width, total_height);
|
let size = Size::new(total_width, total_height);
|
||||||
limits;
|
|
||||||
layout::Node::with_children(size, nodes)
|
layout::Node::with_children(size, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue