@@ -3,12 +3,19 @@ use super::{CosmicMappedInternal, PopupMappedInternal};
33use crate :: xdg_shell_wrapper:: shared_state:: GlobalState ;
44
55use anyhow:: bail;
6- use smithay:: input:: keyboard:: KeyboardTarget ;
7- use smithay:: input:: pointer:: PointerTarget ;
8- use smithay:: input:: touch:: TouchTarget ;
9- use smithay:: reexports:: wayland_server:: protocol:: wl_surface:: WlSurface ;
10- use smithay:: utils:: IsAlive ;
11- use smithay:: wayland:: seat:: WaylandFocus ;
6+ use smithay:: {
7+ input:: {
8+ Seat ,
9+ dnd:: { self , DndFocus } ,
10+ keyboard:: KeyboardTarget ,
11+ pointer:: PointerTarget ,
12+ touch:: TouchTarget ,
13+ } ,
14+ reexports:: wayland_server:: { DisplayHandle , protocol:: wl_surface:: WlSurface } ,
15+ utils:: IsAlive ,
16+ wayland:: { seat:: WaylandFocus , selection:: data_device:: WlOfferData } ,
17+ } ;
18+ use std:: sync:: Arc ;
1219
1320#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1421pub enum SpaceTarget {
@@ -349,3 +356,72 @@ impl WaylandFocus for SpaceTarget {
349356 }
350357 }
351358}
359+
360+ impl DndFocus < GlobalState > for SpaceTarget {
361+ type OfferData < S >
362+ = WlOfferData < S >
363+ where
364+ S : dnd:: Source ;
365+
366+ fn enter < S > (
367+ & self ,
368+ data : & mut GlobalState ,
369+ dh : & DisplayHandle ,
370+ source : Arc < S > ,
371+ seat : & Seat < GlobalState > ,
372+ location : smithay:: utils:: Point < f64 , smithay:: utils:: Logical > ,
373+ serial : & smithay:: utils:: Serial ,
374+ ) -> std:: option:: Option < WlOfferData < S > >
375+ where
376+ S : dnd:: Source ,
377+ {
378+ match self {
379+ SpaceTarget :: Surface ( s) => DndFocus :: enter ( s, data, dh, source, seat, location, serial) ,
380+ SpaceTarget :: OverflowButton ( _b) => None ,
381+ }
382+ }
383+
384+ fn motion < S > (
385+ & self ,
386+ data : & mut GlobalState ,
387+ offer : Option < & mut WlOfferData < S > > ,
388+ seat : & Seat < GlobalState > ,
389+ location : smithay:: utils:: Point < f64 , smithay:: utils:: Logical > ,
390+ time : u32 ,
391+ ) where
392+ S : dnd:: Source ,
393+ {
394+ match self {
395+ SpaceTarget :: Surface ( s) => DndFocus :: motion ( s, data, offer, seat, location, time) ,
396+ SpaceTarget :: OverflowButton ( _b) => { } ,
397+ }
398+ }
399+
400+ fn leave < S > (
401+ & self ,
402+ data : & mut GlobalState ,
403+ offer : Option < & mut WlOfferData < S > > ,
404+ seat : & Seat < GlobalState > ,
405+ ) where
406+ S : dnd:: Source ,
407+ {
408+ match self {
409+ SpaceTarget :: Surface ( s) => DndFocus :: leave ( s, data, offer, seat) ,
410+ SpaceTarget :: OverflowButton ( _b) => { } ,
411+ }
412+ }
413+
414+ fn drop < S > (
415+ & self ,
416+ data : & mut GlobalState ,
417+ offer : Option < & mut WlOfferData < S > > ,
418+ seat : & Seat < GlobalState > ,
419+ ) where
420+ S : dnd:: Source ,
421+ {
422+ match self {
423+ SpaceTarget :: Surface ( s) => DndFocus :: drop ( s, data, offer, seat) ,
424+ SpaceTarget :: OverflowButton ( _b) => { } ,
425+ }
426+ }
427+ }
0 commit comments