@@ -11,7 +11,7 @@ use std::{
1111use wayland_client:: {
1212 backend:: { Backend , ObjectId } ,
1313 globals:: { registry_queue_init, GlobalListContents } ,
14- protocol:: { wl_registry, wl_shm, wl_surface} ,
14+ protocol:: { wl_fixes , wl_registry, wl_shm, wl_surface} ,
1515 Connection , Dispatch , EventQueue , Proxy , QueueHandle ,
1616} ;
1717
@@ -58,6 +58,17 @@ impl<D: HasDisplayHandle + ?Sized> ContextInterface<D> for Arc<WaylandDisplayImp
5858 let shm: wl_shm:: WlShm = globals
5959 . bind ( & qh, 1 ..=1 , ( ) )
6060 . swbuf_err ( "Failed to instantiate Wayland Shm" ) ?;
61+
62+ // If `wl_fixes` is supported, destroy registry using it.
63+ // We don't need the registry anymore.
64+ if let Ok ( fixes) = globals. bind :: < wl_fixes:: WlFixes , _ , ( ) > ( & qh, 1 ..=1 , ( ) ) {
65+ fixes. destroy_registry ( globals. registry ( ) ) ;
66+ conn. backend ( )
67+ . destroy_object ( & globals. registry ( ) . id ( ) )
68+ . unwrap ( ) ;
69+ fixes. destroy ( ) ;
70+ }
71+
6172 Ok ( Arc :: new ( WaylandDisplayImpl {
6273 conn : Some ( conn) ,
6374 event_queue : Mutex :: new ( event_queue) ,
@@ -313,3 +324,15 @@ impl Dispatch<wl_shm::WlShm, ()> for State {
313324 ) {
314325 }
315326}
327+
328+ impl Dispatch < wl_fixes:: WlFixes , ( ) > for State {
329+ fn event (
330+ _: & mut State ,
331+ _: & wl_fixes:: WlFixes ,
332+ _: wl_fixes:: Event ,
333+ _: & ( ) ,
334+ _: & Connection ,
335+ _: & QueueHandle < State > ,
336+ ) {
337+ }
338+ }
0 commit comments