Split up wayland code into more files
This commit is contained in:
parent
a5b78a4300
commit
b29f1149a4
6 changed files with 363 additions and 304 deletions
|
|
@ -3,11 +3,13 @@ use cctk::{
|
|||
sctk::{globals::ProvidesBoundGlobal, shm::raw::RawPool},
|
||||
wayland_client::{
|
||||
protocol::{wl_buffer, wl_shm},
|
||||
QueueHandle,
|
||||
Connection, Dispatch, QueueHandle,
|
||||
},
|
||||
};
|
||||
use cosmic::iced::widget::image;
|
||||
|
||||
use super::AppData;
|
||||
|
||||
pub struct Buffer {
|
||||
pub pool: RawPool,
|
||||
pub buffer: wl_buffer::WlBuffer,
|
||||
|
|
@ -18,7 +20,7 @@ impl Buffer {
|
|||
pub fn new(
|
||||
buffer_info: BufferInfo,
|
||||
shm: &impl ProvidesBoundGlobal<wl_shm::WlShm, 1>,
|
||||
qh: &QueueHandle<super::AppData>,
|
||||
qh: &QueueHandle<AppData>,
|
||||
) -> Self {
|
||||
// Assume format is already known to be valid
|
||||
let mut pool =
|
||||
|
|
@ -57,3 +59,19 @@ impl Drop for Buffer {
|
|||
self.buffer.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<wl_buffer::WlBuffer, ()> for AppData {
|
||||
fn event(
|
||||
_app_data: &mut Self,
|
||||
_buffer: &wl_buffer::WlBuffer,
|
||||
event: wl_buffer::Event,
|
||||
_: &(),
|
||||
_: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
) {
|
||||
match event {
|
||||
wl_buffer::Event::Release => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue