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