cleanup warnings

This commit is contained in:
Janis 2024-11-27 01:26:03 +01:00
parent 2f7b20fde7
commit 28a882852d

View file

@ -36,13 +36,6 @@ struct BufferInfo {
stride: u32, stride: u32,
} }
#[derive(Debug, PartialEq, Eq)]
enum FrameState {
Pre,
BufferDone,
Copied,
}
#[derive(Debug)] #[derive(Debug)]
enum FrameData { enum FrameData {
Pre(Vec<BufferInfo>), Pre(Vec<BufferInfo>),
@ -53,25 +46,15 @@ enum FrameData {
offset: usize, offset: usize,
}, },
Copied { Copied {
buffer: WlBuffer,
info: BufferInfo, info: BufferInfo,
offset: usize, offset: usize,
}, },
Done, Done,
} }
impl FrameData {
fn select_buffer(&mut self) {
if let Self::Pre(infos) = self {
*self = Self::Buffer(infos.pop().unwrap());
}
}
}
#[derive(Debug)] #[derive(Debug)]
struct Frame { struct Frame {
frame: ZwlrScreencopyFrameV1, frame: ZwlrScreencopyFrameV1,
buffer_infos: Vec<BufferInfo>,
inverted_y: bool, inverted_y: bool,
data: FrameData, data: FrameData,
} }
@ -79,6 +62,8 @@ struct Frame {
#[derive(Debug)] #[derive(Debug)]
struct Output { struct Output {
output: WlOutput, output: WlOutput,
// this isn't actually unused since we need to keep it around for the dispatcher
#[allow(unused)]
xdg_output: ZxdgOutputV1, xdg_output: ZxdgOutputV1,
logical_size: Option<(i32, i32)>, logical_size: Option<(i32, i32)>,
physical_size: Option<(i32, i32)>, physical_size: Option<(i32, i32)>,
@ -120,7 +105,6 @@ impl Output {
frame: Frame { frame: Frame {
frame, frame,
inverted_y: false, inverted_y: false,
buffer_infos: Vec::new(),
data: FrameData::Pre(vec![]), data: FrameData::Pre(vec![]),
}, },
} }
@ -151,7 +135,7 @@ impl Dispatch<ZwlrScreencopyManagerV1, ()> for App {
impl Dispatch<ZwlrScreencopyFrameV1, ObjectId> for App { impl Dispatch<ZwlrScreencopyFrameV1, ObjectId> for App {
fn event( fn event(
state: &mut Self, state: &mut Self,
proxy: &ZwlrScreencopyFrameV1, _proxy: &ZwlrScreencopyFrameV1,
event: <ZwlrScreencopyFrameV1 as Proxy>::Event, event: <ZwlrScreencopyFrameV1 as Proxy>::Event,
data: &ObjectId, data: &ObjectId,
_conn: &Connection, _conn: &Connection,
@ -189,11 +173,8 @@ impl Dispatch<ZwlrScreencopyFrameV1, ObjectId> for App {
offset, offset,
} = core::mem::replace(&mut output.frame.data, FrameData::Done) } = core::mem::replace(&mut output.frame.data, FrameData::Done)
{ {
output.frame.data = FrameData::Copied { buffer.destroy();
buffer, output.frame.data = FrameData::Copied { info, offset };
info,
offset,
};
} }
} }
zwlr_screencopy_frame_v1::Event::Failed => { zwlr_screencopy_frame_v1::Event::Failed => {
@ -225,12 +206,12 @@ impl Dispatch<ZwlrScreencopyFrameV1, ObjectId> for App {
impl Dispatch<ZxdgOutputManagerV1, ()> for App { impl Dispatch<ZxdgOutputManagerV1, ()> for App {
fn event( fn event(
state: &mut Self, _state: &mut Self,
proxy: &ZxdgOutputManagerV1, _proxy: &ZxdgOutputManagerV1,
event: <ZxdgOutputManagerV1 as Proxy>::Event, _event: <ZxdgOutputManagerV1 as Proxy>::Event,
data: &(), _data: &(),
conn: &Connection, _conn: &Connection,
qhandle: &wayland_client::QueueHandle<Self>, _qhandle: &wayland_client::QueueHandle<Self>,
) { ) {
} }
} }
@ -238,11 +219,11 @@ impl Dispatch<ZxdgOutputManagerV1, ()> for App {
impl Dispatch<ZxdgOutputV1, ObjectId> for App { impl Dispatch<ZxdgOutputV1, ObjectId> for App {
fn event( fn event(
state: &mut Self, state: &mut Self,
proxy: &ZxdgOutputV1, _proxy: &ZxdgOutputV1,
event: <ZxdgOutputV1 as Proxy>::Event, event: <ZxdgOutputV1 as Proxy>::Event,
data: &ObjectId, data: &ObjectId,
conn: &Connection, _conn: &Connection,
qhandle: &wayland_client::QueueHandle<Self>, _qhandle: &wayland_client::QueueHandle<Self>,
) { ) {
let Some(output) = state.outputs.get_mut(data) else { let Some(output) = state.outputs.get_mut(data) else {
return; return;
@ -298,12 +279,12 @@ impl Dispatch<wl_output::WlOutput, u32> for App {
impl Dispatch<WlShm, ()> for App { impl Dispatch<WlShm, ()> for App {
fn event( fn event(
state: &mut Self, _state: &mut Self,
proxy: &WlShm, _proxy: &WlShm,
event: <WlShm as Proxy>::Event, _event: <WlShm as Proxy>::Event,
data: &(), _data: &(),
conn: &Connection, _conn: &Connection,
qhandle: &wayland_client::QueueHandle<Self>, _qhandle: &wayland_client::QueueHandle<Self>,
) { ) {
} }
} }
@ -312,7 +293,7 @@ impl Dispatch<WlShmPool, ()> for App {
fn event( fn event(
_state: &mut Self, _state: &mut Self,
_proxy: &WlShmPool, _proxy: &WlShmPool,
event: <WlShmPool as Proxy>::Event, _event: <WlShmPool as Proxy>::Event,
_data: &(), _data: &(),
_conn: &Connection, _conn: &Connection,
_qhandle: &wayland_client::QueueHandle<Self>, _qhandle: &wayland_client::QueueHandle<Self>,
@ -324,7 +305,7 @@ impl Dispatch<WlBuffer, ()> for App {
fn event( fn event(
_state: &mut Self, _state: &mut Self,
_proxy: &WlBuffer, _proxy: &WlBuffer,
event: <WlBuffer as Proxy>::Event, _event: <WlBuffer as Proxy>::Event,
_data: &(), _data: &(),
_conn: &Connection, _conn: &Connection,
_qhandle: &wayland_client::QueueHandle<Self>, _qhandle: &wayland_client::QueueHandle<Self>,