Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ default = ["wayland", "wayland-dlopen", "x11", "x11-dlopen"]

# Enable the Wayland backend.
wayland = [
"dep:wayland-backend",
"dep:wayland-client",
"dep:wayland-sys",
"dep:memmap2",
"dep:rustix",
"dep:fastrand",
# Only used as a dev-dependency.
"winit/wayland",
"winit/wayland-csd-adwaita",
]
wayland-dlopen = ["wayland-sys/dlopen", "winit/wayland-dlopen"]
wayland-dlopen = ["wayland-client/dlopen", "winit/wayland-dlopen"]

# Enable the X11 backend.
x11 = [
Expand Down Expand Up @@ -64,11 +62,8 @@ rustix = { version = "1.0.1", default-features = false, optional = true, feature
] }
# Wayland
memmap2 = { version = "0.9.0", optional = true }
wayland-backend = { version = "0.3.0", optional = true, features = [
"client_system",
] }
wayland-client = { version = "0.31.14", optional = true }
wayland-sys = { version = "0.31.0", optional = true }
# wayland-client = { version = "0.31.14", optional = true, features = ["system"] }
wayland-client = { git = "https://github.com/smithay/wayland-rs", optional = true, features = ["system"] }
# X11
as-raw-xcb-connection = { version = "1.0.0", optional = true }
tiny-xlib = { version = "0.2.1", optional = true }
Expand Down
22 changes: 15 additions & 7 deletions src/backends/wayland/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ impl WaylandBuffer {
util::byte_stride(width as u32) as i32,
format,
qh,
released.clone(),
WlBufferData {
released: released.clone(),
},
);

Self {
Expand Down Expand Up @@ -151,7 +153,9 @@ impl WaylandBuffer {
util::byte_stride(width as u32) as i32,
format,
&self.qh,
self.released.clone(),
WlBufferData {
released: self.released.clone(),
},
);
self.width = width;
self.height = height;
Expand Down Expand Up @@ -189,29 +193,33 @@ impl Drop for WaylandBuffer {
}
}

impl Dispatch<wl_shm_pool::WlShmPool, ()> for State {
impl Dispatch<wl_shm_pool::WlShmPool, State> for () {
fn event(
&self,
_: &mut State,
_: &wl_shm_pool::WlShmPool,
_: wl_shm_pool::Event,
_: &(),
_: &Connection,
_: &QueueHandle<State>,
) {
}
}

impl Dispatch<wl_buffer::WlBuffer, Arc<AtomicBool>> for State {
struct WlBufferData {
released: Arc<AtomicBool>,
}

impl Dispatch<wl_buffer::WlBuffer, State> for WlBufferData {
fn event(
&self,
_: &mut State,
_: &wl_buffer::WlBuffer,
event: wl_buffer::Event,
released: &Arc<AtomicBool>,
_: &Connection,
_: &QueueHandle<State>,
) {
if let wl_buffer::Event::Release = event {
released.store(true, Ordering::SeqCst);
self.released.store(true, Ordering::SeqCst);
}
}
}
21 changes: 6 additions & 15 deletions src/backends/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use std::{
};
use wayland_client::{
backend::{Backend, ObjectId},
globals::{registry_queue_init, GlobalListContents},
protocol::{wl_registry, wl_shm, wl_surface},
globals::{registry_queue_init, GlobalListHandler},
protocol::{wl_shm, wl_surface},
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
};

Expand Down Expand Up @@ -310,25 +310,16 @@ impl BufferInterface for BufferImpl<'_> {
}
}

impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {
fn event(
_: &mut State,
_: &wl_registry::WlRegistry,
_: wl_registry::Event,
_: &GlobalListContents,
_: &Connection,
_: &QueueHandle<State>,
) {
// Ignore globals added after initialization
}
impl GlobalListHandler for State {
// Ignore globals added after initialization
}

impl Dispatch<wl_shm::WlShm, ()> for State {
impl Dispatch<wl_shm::WlShm, State> for () {
fn event(
&self,
_: &mut State,
_: &wl_shm::WlShm,
_: wl_shm::Event,
_: &(),
_: &Connection,
_: &QueueHandle<State>,
) {
Expand Down
Loading