📦📎-fixes, typo fixes

This commit is contained in:
Aleksander
2025-09-20 12:17:17 +02:00
parent cfb733de09
commit b9e5541971
41 changed files with 494 additions and 498 deletions

View File

@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(clippy::expect_fun_call)]
use frame::{DrmFormat, WlxFrame};

View File

@@ -1,13 +1,13 @@
use std::any::Any;
use std::sync::Arc;
use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering;
use std::sync::mpsc;
use std::sync::Arc;
use std::thread::JoinHandle;
use ashpd::desktop::{
screencast::{CursorMode, Screencast, SourceType},
PersistMode,
screencast::{CursorMode, Screencast, SourceType},
};
pub use ashpd::Error as AshpdError;
@@ -17,35 +17,35 @@ use pw::spa;
use pw::properties::properties;
use pw::stream::{Stream, StreamFlags};
use pw::{context::Context, main_loop::MainLoop, Error};
use pw::{Error, context::Context, main_loop::MainLoop};
use spa::buffer::DataType;
use spa::buffer::MetaData;
use spa::buffer::MetaType;
use spa::param::ParamType;
use spa::param::video::VideoFormat;
use spa::param::video::VideoInfoRaw;
use spa::param::ParamType;
use spa::pod::serialize::GenError;
use spa::pod::ChoiceValue;
use spa::pod::Pod;
use spa::pod::serialize::GenError;
use spa::pod::{Object, Property, PropertyFlags, Value};
use spa::utils::Choice;
use spa::utils::ChoiceEnum;
use spa::utils::ChoiceFlags;
use crate::WlxCapture;
use crate::frame::DRM_FORMAT_ABGR8888;
use crate::frame::DRM_FORMAT_ABGR2101010;
use crate::frame::DRM_FORMAT_ARGB8888;
use crate::frame::DRM_FORMAT_XBGR8888;
use crate::frame::DRM_FORMAT_XBGR2101010;
use crate::frame::DRM_FORMAT_XRGB8888;
use crate::frame::DrmFormat;
use crate::frame::FourCC;
use crate::frame::FrameFormat;
use crate::frame::MouseMeta;
use crate::frame::Transform;
use crate::frame::WlxFrame;
use crate::frame::DRM_FORMAT_ABGR2101010;
use crate::frame::DRM_FORMAT_ABGR8888;
use crate::frame::DRM_FORMAT_ARGB8888;
use crate::frame::DRM_FORMAT_XBGR2101010;
use crate::frame::DRM_FORMAT_XBGR8888;
use crate::frame::DRM_FORMAT_XRGB8888;
use crate::frame::{DmabufFrame, FramePlane, MemFdFrame, MemPtrFrame};
use crate::WlxCapture;
pub struct PipewireStream {
pub node_id: u32,
@@ -76,7 +76,7 @@ pub async fn pipewire_select_screen(
log::debug!("Available cursor modes: {cursor_modes:#x}");
// propery will be same system-wide, so race condition not a concern
// properly will be same system-wide, so race condition not a concern
CURSOR_MODES.store(cursor_modes, Ordering::Relaxed);
}
@@ -369,13 +369,12 @@ where
}
if let Some(mut buffer) = maybe_buffer {
if let MetaData::Header(header) = buffer.find_meta_data(MetaType::Header) {
if header.flags & spa::sys::SPA_META_HEADER_FLAG_CORRUPTED != 0 {
log::warn!("{}: PipeWire buffer is corrupt.", &name);
return;
}
if let MetaData::Header(header) = buffer.find_meta_data(MetaType::Header)
&& header.flags & spa::sys::SPA_META_HEADER_FLAG_CORRUPTED != 0
{
log::warn!("{}: PipeWire buffer is corrupt.", &name);
return;
}
if let MetaData::VideoTransform(transform) =
buffer.find_meta_data(MetaType::VideoTransform)
{
@@ -497,7 +496,7 @@ where
.collect();
format_params.push(obj_to_bytes(get_format_params(None)).unwrap()); // safe unwrap: known
// good values
// good values
let mut params: Vec<&Pod> = format_params
.iter()

View File

@@ -19,15 +19,15 @@ use smithay_client_toolkit::reexports::{
pub use wayland_client;
use wayland_client::{
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
backend::WaylandError,
globals::{registry_queue_init, GlobalList, GlobalListContents},
globals::{GlobalList, GlobalListContents, registry_queue_init},
protocol::{
wl_output::{self, Transform, WlOutput},
wl_registry::{self, WlRegistry},
wl_seat::WlSeat,
wl_shm::WlShm,
},
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
};
use crate::frame;
@@ -179,10 +179,10 @@ impl WlxClient {
}
},
Err(err) => {
if let WaylandError::Io(ref e) = err {
if e.kind() == std::io::ErrorKind::WouldBlock {
return;
}
if let WaylandError::Io(ref e) = err
&& e.kind() == std::io::ErrorKind::WouldBlock
{
return;
}
log::warn!("Error while reading from event queue: {err:?}");
}

View File

@@ -10,9 +10,9 @@ use smithay_client_toolkit::reexports::protocols_wlr::export_dmabuf::v1::client:
use wayland_client::{Connection, QueueHandle, Dispatch, Proxy};
use crate::{
WlxCapture,
frame::{DmabufFrame, DrmFormat, FramePlane, WlxFrame},
wayland::WlxClient,
WlxCapture,
};
use log::{debug, warn};
@@ -84,20 +84,20 @@ where
true
}
fn receive(&mut self) -> Option<R> {
if let Some(data) = self.data.as_ref() {
if let Some(WlxFrame::Dmabuf(last)) = data.receiver.try_iter().last() {
// this is the only protocol that requires us to manually close the FD
while self.fds.len() > 6 * last.num_planes {
// safe unwrap
let _ = unsafe { OwnedFd::from_raw_fd(self.fds.pop_back().unwrap()) };
}
for p in 0..last.num_planes {
if let Some(fd) = last.planes[p].fd {
self.fds.push_front(fd);
}
}
return (data.receive_callback)(&data.user_data, WlxFrame::Dmabuf(last));
if let Some(data) = self.data.as_ref()
&& let Some(WlxFrame::Dmabuf(last)) = data.receiver.try_iter().last()
{
// this is the only protocol that requires us to manually close the FD
while self.fds.len() > 6 * last.num_planes {
// safe unwrap
let _ = unsafe { OwnedFd::from_raw_fd(self.fds.pop_back().unwrap()) };
}
for p in 0..last.num_planes {
if let Some(fd) = last.planes[p].fd {
self.fds.push_front(fd);
}
}
return (data.receive_callback)(&data.user_data, WlxFrame::Dmabuf(last));
}
None
}

View File

@@ -3,16 +3,16 @@ use std::{
env,
error::Error,
sync::{
mpsc::{self},
Arc,
mpsc::{self},
},
};
use rxscreen::monitor::Monitor;
use crate::{
frame::{DrmFormat, FrameFormat, MemPtrFrame, MouseMeta, WlxFrame, DRM_FORMAT_XRGB8888},
WlxCapture,
frame::{DRM_FORMAT_XRGB8888, DrmFormat, FrameFormat, MemPtrFrame, MouseMeta, WlxFrame},
};
pub struct XshmScreen {
@@ -169,10 +169,10 @@ where
self.request_new_frame();
}
fn request_new_frame(&mut self) {
if let Some(sender) = &self.sender {
if let Err(e) = sender.send(()) {
log::debug!("Failed to send frame request: {}", e);
}
if let Some(sender) = &self.sender
&& let Err(e) = sender.send(())
{
log::debug!("Failed to send frame request: {}", e);
}
}
}