Address various warnings

This commit is contained in:
Ian Douglas Scott 2024-03-05 12:25:20 -08:00
parent ea0de44e42
commit 7106001179
7 changed files with 24 additions and 31 deletions

View file

@ -14,6 +14,7 @@ pub fn icon_for_app_id(app_id: String) -> Option<PathBuf> {
)
}
#[allow(dead_code)]
#[derive(Debug, Clone, Default)]
struct DesktopInfo {
id: String,

View file

@ -40,7 +40,6 @@ use cosmic::{
iced_sctk::commands::layer_surface::{destroy_layer_surface, get_layer_surface},
};
use cosmic_comp_config::CosmicCompConfig;
use cosmic_config::ConfigSet;
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
use i18n_embed::DesktopLanguageRequester;
use once_cell::sync::Lazy;
@ -117,6 +116,7 @@ enum Msg {
Close,
Closed(SurfaceId),
ActivateWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
#[allow(dead_code)]
CloseWorkspace(zcosmic_workspace_handle_v1::ZcosmicWorkspaceHandleV1),
ActivateToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
CloseToplevel(zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1),
@ -132,6 +132,7 @@ enum Msg {
DndWorkspaceDrop,
DndWorkspaceData(String, Vec<u8>),
SourceFinished,
#[allow(dead_code)]
NewWorkspace,
CompConfig(CosmicCompConfig),
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));
// XXX
// if mimes.iter().any(|x| x == WORKSPACE_MIME) && action == DndAction::Move {
@ -581,17 +582,14 @@ impl Application for App {
.ok()
.and_then(|s| u32::from_str(s).ok());
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 toplevel_manager.version() >= 2 {
toplevel_manager.move_to_workspace(
handle,
&drop_target.0,
&drop_target.1,
);
}
if let Some(drop_target) = &self.drop_target {
if let Some(toplevel_manager) = self.toplevel_manager.as_ref() {
if toplevel_manager.version() >= 2 {
toplevel_manager.move_to_workspace(
handle,
&drop_target.0,
&drop_target.1,
);
}
}
}

View file

@ -102,7 +102,7 @@ pub(crate) fn workspace_item<'a>(
fn workspace_sidebar_entry<'a>(
workspace: &'a Workspace,
output: &'a wl_output::WlOutput,
is_drop_target: bool,
_is_drop_target: bool,
) -> cosmic::Element<'a, Msg> {
/* XXX
let mouse_interaction = if is_drop_target {
@ -154,6 +154,7 @@ fn workspaces_sidebar<'a>(
};
let sidebar_entries_container =
widget::container(crate::widgets::workspace_bar(sidebar_entries, axis)).padding(12.0);
/*
let new_workspace_button = widget::button(
widget::container(row![
widget::icon::from_name("list-add-symbolic").symbolic(true),
@ -164,7 +165,6 @@ fn workspaces_sidebar<'a>(
)
.on_press(Msg::NewWorkspace)
.width(iced::Length::Fill);
/*
let bar: cosmic::Element<_> = if amount != WorkspaceAmount::Dynamic {
match layout {
WorkspaceLayout::Vertical => {

View file

@ -7,9 +7,7 @@ use cctk::{
},
};
use cosmic::cctk;
use cosmic::iced::widget::image;
use cosmic::iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf, SubsurfaceBuffer};
use memmap2::Mmap;
use cosmic::iced_sctk::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf};
use rustix::{io::Errno, shm::ShmOFlags};
use std::{
os::fd::{AsFd, OwnedFd},
@ -58,6 +56,7 @@ fn create_memfile() -> rustix::io::Result<OwnedFd> {
return Err(errno.into());
}
},
#[allow(unreachable_patterns)]
Err(Errno::EXIST | Errno::EXIST) => {
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 backing: Arc<BufferSource>,
pub buffer: wl_buffer::WlBuffer,
@ -81,7 +75,7 @@ pub struct Buffer {
impl AppData {
fn create_shm_buffer(&self, buffer_info: &BufferInfo) -> Buffer {
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(
fd.as_fd(),

View file

@ -20,7 +20,7 @@ use cctk::{
toplevel_management::ToplevelManagerState,
wayland_client::{
globals::registry_queue_init,
protocol::{wl_buffer, wl_output, wl_seat},
protocol::{wl_output, wl_seat},
Connection, QueueHandle,
},
workspace::WorkspaceState,
@ -99,7 +99,6 @@ pub enum Cmd {
}
pub struct AppData {
conn: Connection,
qh: QueueHandle<Self>,
dmabuf_state: DmabufState,
registry_state: RegistryState,
@ -244,7 +243,6 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
let registry_state = RegistryState::new(&globals);
let mut app_data = AppData {
conn: conn.clone(),
qh: qh.clone(),
dmabuf_state,
workspace_state: WorkspaceState::new(&registry_state, &qh), // Create before toplevel info state
@ -286,7 +284,10 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
}
})
.unwrap();
event_loop.handle().insert_source(executor, |(), _, _| {});
event_loop
.handle()
.insert_source(executor, |(), _, _| {})
.unwrap();
loop {
event_loop.dispatch(None, &mut app_data).unwrap();

View file

@ -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 {
return;
};

View file

@ -80,7 +80,7 @@ impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for Toplevels<'a, Msg
.zip(tree.children.iter_mut())
.map(|(child, tree)| {
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())
})
.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 size = Size::new(total_width, total_height);
limits;
layout::Node::with_children(size, nodes)
}