diff --git a/Cargo.toml b/Cargo.toml index 24db5ed..3d3a8ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,3 +115,11 @@ targets = [ "x86_64-unknown-linux-gnu", "wasm32-unknown-unknown", ] + +[patch.crates-io] +wayland-protocols = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } +wayland-protocols-wlr = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } +wayland-client = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } +wayland-sys = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } +wayland-backend = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } +wayland-scanner = { git = "https://github.com/ids1024/wayland-rs", branch = "wl-fixes" } diff --git a/src/backends/wayland/mod.rs b/src/backends/wayland/mod.rs index 32be3d4..8c38a12 100644 --- a/src/backends/wayland/mod.rs +++ b/src/backends/wayland/mod.rs @@ -12,7 +12,7 @@ use std::{ use wayland_client::{ backend::{Backend, ObjectId}, globals::{registry_queue_init, GlobalListContents}, - protocol::{wl_registry, wl_shm, wl_surface}, + protocol::{wl_fixes, wl_registry, wl_shm, wl_surface}, Connection, Dispatch, EventQueue, Proxy, QueueHandle, }; @@ -59,6 +59,17 @@ impl ContextInterface for Rc(&qh, 1..=1, ()) { + fixes.destroy_registry(globals.registry()); + conn.backend() + .destroy_object(&globals.registry().id()) + .unwrap(); + fixes.destroy(); + } + Ok(Rc::new(WaylandDisplayImpl { conn: Some(conn), event_queue: RefCell::new(event_queue), @@ -71,6 +82,9 @@ impl ContextInterface for Rc Drop for WaylandDisplayImpl { fn drop(&mut self) { + if self.shm.version() >= 2 { + self.shm.release(); + } // Make sure the connection is dropped first. self.conn = None; } @@ -312,3 +326,15 @@ impl Dispatch for State { ) { } } + +impl Dispatch for State { + fn event( + _: &mut State, + _: &wl_fixes::WlFixes, + _: wl_fixes::Event, + _: &(), + _: &Connection, + _: &QueueHandle, + ) { + } +}