@@ -3,7 +3,7 @@ use cosmic_protocols::corner_radius::v1::server::{
33} ;
44use smithay:: reexports:: {
55 wayland_protocols:: xdg:: shell:: server:: xdg_toplevel:: XdgToplevel ,
6- wayland_server:: { Client , Dispatch , DisplayHandle , GlobalDispatch , Resource } ,
6+ wayland_server:: { Client , Dispatch , DisplayHandle , GlobalDispatch , Resource , Weak } ,
77} ;
88use smithay:: wayland:: compositor:: with_states;
99use smithay:: wayland:: shell:: xdg:: ToplevelSurface ;
@@ -50,10 +50,6 @@ pub trait CornerRadiusHandler {
5050 & mut self ,
5151 toplevel : & cosmic_corner_radius_toplevel_v1:: CosmicCornerRadiusToplevelV1 ,
5252 data : & CornerRadiusData ,
53- top_left : u32 ,
54- top_right : u32 ,
55- bottom_right : u32 ,
56- bottom_left : u32 ,
5753 ) ;
5854 fn unset_corner_radius (
5955 & mut self ,
@@ -110,7 +106,13 @@ where
110106 corner_radius_state. instances . retain ( |i| i != _resource) ;
111107 }
112108 cosmic_corner_radius_manager_v1:: Request :: GetCornerRadius { id, toplevel } => {
113- let data = CornerRadiusData :: default ( ) ;
109+ let data = Mutex :: new ( CornerRadiusInternal {
110+ toplevel : toplevel. downgrade ( ) ,
111+ top_left : 0 ,
112+ top_right : 0 ,
113+ bottom_right : 0 ,
114+ bottom_left : 0 ,
115+ } ) ;
114116 let instance = data_init. init ( id, data) ;
115117
116118 if let Some ( surface) = state. toplevel_from_resource ( & toplevel) {
@@ -178,14 +180,7 @@ where
178180 ) ;
179181 }
180182
181- _state. set_corner_radius (
182- resource,
183- data,
184- top_left,
185- top_right,
186- bottom_right,
187- bottom_left,
188- ) ;
183+ _state. set_corner_radius ( resource, data) ;
189184 }
190185 cosmic_corner_radius_toplevel_v1:: Request :: UnsetRadius => {
191186 _state. unset_corner_radius ( resource, data) ;
@@ -197,8 +192,9 @@ where
197192
198193pub type CornerRadiusData = Mutex < CornerRadiusInternal > ;
199194
200- #[ derive( Debug , Default ) ]
195+ #[ derive( Debug ) ]
201196pub struct CornerRadiusInternal {
197+ pub toplevel : Weak < XdgToplevel > ,
202198 pub top_left : u8 ,
203199 pub top_right : u8 ,
204200 pub bottom_right : u8 ,
0 commit comments