Skip to content

Commit 5018b3a

Browse files
committed
WIP Updates for future wayland-rs release
1 parent 840683c commit 5018b3a

3 files changed

Lines changed: 24 additions & 30 deletions

File tree

‎Cargo.toml‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@ default = ["wayland", "wayland-dlopen", "x11", "x11-dlopen"]
1616

1717
# Enable the Wayland backend.
1818
wayland = [
19-
"dep:wayland-backend",
2019
"dep:wayland-client",
21-
"dep:wayland-sys",
2220
"dep:memmap2",
2321
"dep:rustix",
2422
"dep:fastrand",
2523
# Only used as a dev-dependency.
2624
"winit/wayland",
2725
"winit/wayland-csd-adwaita",
2826
]
29-
wayland-dlopen = ["wayland-sys/dlopen", "winit/wayland-dlopen"]
27+
wayland-dlopen = ["wayland-client/dlopen", "winit/wayland-dlopen"]
3028

3129
# Enable the X11 backend.
3230
x11 = [
@@ -64,11 +62,8 @@ rustix = { version = "1.0.1", default-features = false, optional = true, feature
6462
] }
6563
# Wayland
6664
memmap2 = { version = "0.9.0", optional = true }
67-
wayland-backend = { version = "0.3.0", optional = true, features = [
68-
"client_system",
69-
] }
70-
wayland-client = { version = "0.31.14", optional = true }
71-
wayland-sys = { version = "0.31.0", optional = true }
65+
# wayland-client = { version = "0.31.14", optional = true, features = ["system"] }
66+
wayland-client = { git = "https://github.com/smithay/wayland-rs", optional = true, features = ["system"] }
7267
# X11
7368
as-raw-xcb-connection = { version = "1.0.0", optional = true }
7469
tiny-xlib = { version = "0.2.1", optional = true }

‎src/backends/wayland/buffer.rs‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ impl WaylandBuffer {
110110
util::byte_stride(width as u32) as i32,
111111
format,
112112
qh,
113-
released.clone(),
113+
WlBufferData {
114+
released: released.clone(),
115+
},
114116
);
115117

116118
Self {
@@ -151,7 +153,9 @@ impl WaylandBuffer {
151153
util::byte_stride(width as u32) as i32,
152154
format,
153155
&self.qh,
154-
self.released.clone(),
156+
WlBufferData {
157+
released: self.released.clone(),
158+
},
155159
);
156160
self.width = width;
157161
self.height = height;
@@ -189,29 +193,33 @@ impl Drop for WaylandBuffer {
189193
}
190194
}
191195

192-
impl Dispatch<wl_shm_pool::WlShmPool, ()> for State {
196+
impl Dispatch<wl_shm_pool::WlShmPool, State> for () {
193197
fn event(
198+
&self,
194199
_: &mut State,
195200
_: &wl_shm_pool::WlShmPool,
196201
_: wl_shm_pool::Event,
197-
_: &(),
198202
_: &Connection,
199203
_: &QueueHandle<State>,
200204
) {
201205
}
202206
}
203207

204-
impl Dispatch<wl_buffer::WlBuffer, Arc<AtomicBool>> for State {
208+
struct WlBufferData {
209+
released: Arc<AtomicBool>,
210+
}
211+
212+
impl Dispatch<wl_buffer::WlBuffer, State> for WlBufferData {
205213
fn event(
214+
&self,
206215
_: &mut State,
207216
_: &wl_buffer::WlBuffer,
208217
event: wl_buffer::Event,
209-
released: &Arc<AtomicBool>,
210218
_: &Connection,
211219
_: &QueueHandle<State>,
212220
) {
213221
if let wl_buffer::Event::Release = event {
214-
released.store(true, Ordering::SeqCst);
222+
self.released.store(true, Ordering::SeqCst);
215223
}
216224
}
217225
}

‎src/backends/wayland/mod.rs‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::{
1010
};
1111
use wayland_client::{
1212
backend::{Backend, ObjectId},
13-
globals::{registry_queue_init, GlobalListContents},
14-
protocol::{wl_registry, wl_shm, wl_surface},
13+
globals::{registry_queue_init, GlobalListHandler},
14+
protocol::{wl_shm, wl_surface},
1515
Connection, Dispatch, EventQueue, Proxy, QueueHandle,
1616
};
1717

@@ -310,25 +310,16 @@ impl BufferInterface for BufferImpl<'_> {
310310
}
311311
}
312312

313-
impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {
314-
fn event(
315-
_: &mut State,
316-
_: &wl_registry::WlRegistry,
317-
_: wl_registry::Event,
318-
_: &GlobalListContents,
319-
_: &Connection,
320-
_: &QueueHandle<State>,
321-
) {
322-
// Ignore globals added after initialization
323-
}
313+
impl GlobalListHandler for State {
314+
// Ignore globals added after initialization
324315
}
325316

326-
impl Dispatch<wl_shm::WlShm, ()> for State {
317+
impl Dispatch<wl_shm::WlShm, State> for () {
327318
fn event(
319+
&self,
328320
_: &mut State,
329321
_: &wl_shm::WlShm,
330322
_: wl_shm::Event,
331-
_: &(),
332323
_: &Connection,
333324
_: &QueueHandle<State>,
334325
) {

0 commit comments

Comments
 (0)