@@ -33,7 +33,7 @@ use smithay::{
3333 } ,
3434 utils:: { IsAlive , Logical , Point , Serial , Transform } ,
3535 wayland:: { seat:: WaylandFocus , session_lock:: LockSurface } ,
36- xwayland:: xwm:: XwmId ,
36+ xwayland:: { xwm:: XwmId , X11Surface } ,
3737} ;
3838
3939#[ derive( Debug , Clone , PartialEq ) ]
@@ -220,22 +220,20 @@ impl KeyboardFocusTarget {
220220 }
221221 }
222222
223- pub fn is_xwm ( & self , xwm : XwmId ) -> bool {
223+ fn x11_surface ( & self ) -> Option < X11Surface > {
224224 match self {
225- KeyboardFocusTarget :: Element ( mapped) => {
226- if let Some ( surface) = mapped. active_window ( ) . x11_surface ( ) {
227- return surface. xwm_id ( ) . unwrap ( ) == xwm;
228- }
229- }
230- KeyboardFocusTarget :: Fullscreen ( surface) => {
231- if let Some ( surface) = surface. x11_surface ( ) {
232- return surface. xwm_id ( ) . unwrap ( ) == xwm;
233- }
234- }
235- _ => { }
225+ KeyboardFocusTarget :: Element ( mapped) => mapped. active_window ( ) . x11_surface ( ) . cloned ( ) ,
226+ KeyboardFocusTarget :: Fullscreen ( surface) => surface. x11_surface ( ) . cloned ( ) ,
227+ _ => None ,
236228 }
229+ }
237230
238- false
231+ pub fn is_xwm ( & self , xwm : XwmId ) -> bool {
232+ if let Some ( surface) = self . x11_surface ( ) {
233+ surface. xwm_id ( ) . unwrap ( ) == xwm
234+ } else {
235+ false
236+ }
239237 }
240238}
241239
0 commit comments