chore: clippy
This commit is contained in:
parent
22bef1b596
commit
e45d2ea694
5 changed files with 65 additions and 76 deletions
|
|
@ -92,13 +92,13 @@ impl AppData {
|
|||
let Some(feedback) = self.dmabuf_feedback.as_ref() else {
|
||||
return Ok(None);
|
||||
};
|
||||
let drm_dev = drm_dev.unwrap_or(feedback.main_device() as u64);
|
||||
if let Some(vulkan) = &mut self.vulkan {
|
||||
if let Ok(Some(name)) = vulkan.device_name(drm_dev) {
|
||||
// TODO Workaround: force shm on Meteor/Arrow/Lunar Lake
|
||||
if name.contains("MTL") || name.contains("ARL") || name.contains("LNL") {
|
||||
return Ok(None);
|
||||
}
|
||||
let drm_dev = drm_dev.unwrap_or(feedback.main_device());
|
||||
if let Some(vulkan) = &mut self.vulkan
|
||||
&& let Ok(Some(name)) = vulkan.device_name(drm_dev)
|
||||
{
|
||||
// TODO Workaround: force shm on Meteor/Arrow/Lunar Lake
|
||||
if name.contains("MTL") || name.contains("ARL") || name.contains("LNL") {
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
let Some((_dev_path, gbm)) = self.gbm_devices.gbm_device(drm_dev)? else {
|
||||
|
|
@ -204,7 +204,7 @@ impl AppData {
|
|||
modifiers,
|
||||
formats.buffer_size,
|
||||
false,
|
||||
formats.dmabuf_device.map(|dev| dev as u64),
|
||||
formats.dmabuf_device,
|
||||
) {
|
||||
Ok(Some(buffer)) => {
|
||||
return buffer;
|
||||
|
|
|
|||
|
|
@ -91,59 +91,52 @@ impl AppData {
|
|||
}
|
||||
Cmd::CloseToplevel(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()) {
|
||||
if let Some(state) = &self.toplevel_manager_state {
|
||||
state.manager.close(cosmic_toplevel);
|
||||
}
|
||||
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref())
|
||||
&& let Some(state) = &self.toplevel_manager_state
|
||||
{
|
||||
state.manager.close(cosmic_toplevel);
|
||||
}
|
||||
}
|
||||
Cmd::MoveToplevelToWorkspace(toplevel_handle, workspace_handle, output) => {
|
||||
let info = self.toplevel_info_state.info(&toplevel_handle);
|
||||
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref()) {
|
||||
if let Some(state) = &self.toplevel_manager_state {
|
||||
if state.manager.version() >= 2 {
|
||||
state.manager.move_to_ext_workspace(
|
||||
cosmic_toplevel,
|
||||
&workspace_handle,
|
||||
&output,
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(cosmic_toplevel) = info.and_then(|x| x.cosmic_toplevel.as_ref())
|
||||
&& let Some(state) = &self.toplevel_manager_state
|
||||
&& state.manager.version() >= 2
|
||||
{
|
||||
state.manager.move_to_ext_workspace(
|
||||
cosmic_toplevel,
|
||||
&workspace_handle,
|
||||
&output,
|
||||
);
|
||||
}
|
||||
}
|
||||
// TODO version check
|
||||
Cmd::MoveWorkspaceBefore(workspace_handle, other_workspace_handle) => {
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get() {
|
||||
if let Some(cosmic_workspace) = self
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get()
|
||||
&& let Some(cosmic_workspace) = self
|
||||
.workspace_state
|
||||
.workspaces()
|
||||
.find(|w| w.handle == workspace_handle)
|
||||
.and_then(|w| w.cosmic_handle.as_ref())
|
||||
{
|
||||
if cosmic_workspace.version()
|
||||
>= zcosmic_workspace_handle_v2::REQ_MOVE_BEFORE_SINCE
|
||||
{
|
||||
cosmic_workspace.move_before(&other_workspace_handle, 0);
|
||||
workspace_manager.commit();
|
||||
}
|
||||
}
|
||||
&& cosmic_workspace.version()
|
||||
>= zcosmic_workspace_handle_v2::REQ_MOVE_BEFORE_SINCE
|
||||
{
|
||||
cosmic_workspace.move_before(&other_workspace_handle, 0);
|
||||
workspace_manager.commit();
|
||||
}
|
||||
}
|
||||
Cmd::MoveWorkspaceAfter(workspace_handle, other_workspace_handle) => {
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get() {
|
||||
if let Some(cosmic_workspace) = self
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get()
|
||||
&& let Some(cosmic_workspace) = self
|
||||
.workspace_state
|
||||
.workspaces()
|
||||
.find(|w| w.handle == workspace_handle)
|
||||
.and_then(|w| w.cosmic_handle.as_ref())
|
||||
{
|
||||
if cosmic_workspace.version()
|
||||
>= zcosmic_workspace_handle_v2::REQ_MOVE_AFTER_SINCE
|
||||
{
|
||||
cosmic_workspace.move_after(&other_workspace_handle, 0);
|
||||
workspace_manager.commit();
|
||||
}
|
||||
}
|
||||
&& cosmic_workspace.version()
|
||||
>= zcosmic_workspace_handle_v2::REQ_MOVE_AFTER_SINCE
|
||||
{
|
||||
cosmic_workspace.move_after(&other_workspace_handle, 0);
|
||||
workspace_manager.commit();
|
||||
}
|
||||
}
|
||||
Cmd::ActivateWorkspace(workspace_handle) => {
|
||||
|
|
@ -153,24 +146,21 @@ impl AppData {
|
|||
}
|
||||
}
|
||||
Cmd::SetWorkspacePinned(workspace_handle, pinned) => {
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get() {
|
||||
if let Some(cosmic_workspace) = self
|
||||
if let Ok(workspace_manager) = self.workspace_state.workspace_manager().get()
|
||||
&& let Some(cosmic_workspace) = self
|
||||
.workspace_state
|
||||
.workspaces()
|
||||
.find(|w| w.handle == workspace_handle)
|
||||
.and_then(|w| w.cosmic_handle.as_ref())
|
||||
{
|
||||
if cosmic_workspace.version() >= zcosmic_workspace_handle_v2::REQ_PIN_SINCE
|
||||
{
|
||||
// TODO check capability
|
||||
if pinned {
|
||||
cosmic_workspace.pin();
|
||||
} else {
|
||||
cosmic_workspace.unpin();
|
||||
}
|
||||
workspace_manager.commit();
|
||||
}
|
||||
&& cosmic_workspace.version() >= zcosmic_workspace_handle_v2::REQ_PIN_SINCE
|
||||
{
|
||||
// TODO check capability
|
||||
if pinned {
|
||||
cosmic_workspace.pin();
|
||||
} else {
|
||||
cosmic_workspace.unpin();
|
||||
}
|
||||
workspace_manager.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ impl ScreencopyHandler for AppData {
|
|||
return;
|
||||
};
|
||||
if let Some(formats) = &session.formats {
|
||||
session.buffers = Some(array::from_fn(|_| self.create_buffer(&formats)));
|
||||
session.buffers = Some(array::from_fn(|_| self.create_buffer(formats)));
|
||||
}
|
||||
session.attach_buffer_and_commit(&capture, conn, &self.qh);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl Vulkan {
|
|||
.unwrap()
|
||||
.as_ref()
|
||||
.map(|x| x.as_deref())
|
||||
.map_err(|err| err.clone())
|
||||
.map_err(|err| *err)
|
||||
}
|
||||
|
||||
fn device_name_uncached(&mut self, dev: u64) -> VkResult<Option<String>> {
|
||||
|
|
|
|||
37
src/main.rs
37
src/main.rs
|
|
@ -4,8 +4,10 @@
|
|||
#![allow(clippy::single_match)]
|
||||
|
||||
use cctk::{
|
||||
cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||
cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2,
|
||||
cosmic_protocols::{
|
||||
toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
|
||||
workspace::v2::client::zcosmic_workspace_handle_v2,
|
||||
},
|
||||
sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer},
|
||||
wayland_client::{Connection, Proxy, protocol::wl_output},
|
||||
wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1,
|
||||
|
|
@ -456,10 +458,10 @@ impl Application for App {
|
|||
Msg::WaylandEvent(evt) => match evt {
|
||||
WaylandEvent::Output(evt, output) => {
|
||||
// TODO: Less hacky way to get connection from iced-sctk
|
||||
if self.conn.is_none() {
|
||||
if let Some(backend) = output.backend().upgrade() {
|
||||
self.conn = Some(Connection::from_backend(backend));
|
||||
}
|
||||
if self.conn.is_none()
|
||||
&& let Some(backend) = output.backend().upgrade()
|
||||
{
|
||||
self.conn = Some(Connection::from_backend(backend));
|
||||
}
|
||||
|
||||
match evt {
|
||||
|
|
@ -581,13 +583,12 @@ impl Application for App {
|
|||
}
|
||||
backend::Event::WorkspaceCapture(handle, image) => {
|
||||
//println!("Workspace capture");
|
||||
if let Some(workspace) = self.workspaces.for_handle_mut(&handle) {
|
||||
if self
|
||||
if let Some(workspace) = self.workspaces.for_handle_mut(&handle)
|
||||
&& self
|
||||
.capture_filter
|
||||
.workspace_outputs_matches(&workspace.outputs)
|
||||
{
|
||||
workspace.img = Some(image);
|
||||
}
|
||||
{
|
||||
workspace.img = Some(image);
|
||||
}
|
||||
}
|
||||
backend::Event::ToplevelCapture(handle, image) => {
|
||||
|
|
@ -607,10 +608,10 @@ impl Application for App {
|
|||
return self.hide();
|
||||
}
|
||||
Msg::ActivateWorkspace(workspace_handle) => {
|
||||
if let Some(workspace) = self.workspaces.for_handle(&workspace_handle) {
|
||||
if workspace.is_active() {
|
||||
return self.hide();
|
||||
}
|
||||
if let Some(workspace) = self.workspaces.for_handle(&workspace_handle)
|
||||
&& workspace.is_active()
|
||||
{
|
||||
return self.hide();
|
||||
}
|
||||
self.send_wayland_cmd(backend::Cmd::ActivateWorkspace(workspace_handle));
|
||||
}
|
||||
|
|
@ -770,11 +771,9 @@ impl Application for App {
|
|||
};
|
||||
}
|
||||
Msg::PanelContainerEntries(entries) => {
|
||||
self.panel_configs.retain(|k, _| entries.contains(&k));
|
||||
self.panel_configs.retain(|k, _| entries.contains(k));
|
||||
for entry in entries {
|
||||
if !self.panel_configs.contains_key(&entry) {
|
||||
self.panel_configs.insert(entry, None);
|
||||
}
|
||||
self.panel_configs.entry(entry).or_insert(None);
|
||||
}
|
||||
}
|
||||
Msg::PanelConfig(config) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue