Skip to content

Commit

Permalink
Pass target and validated to ClientDnDGrabHandler::dropped()
Browse files Browse the repository at this point in the history
Allows the compositor to focus the target window on successful drop.
  • Loading branch information
YaLTeR authored and Drakulix committed Nov 21, 2024
1 parent eef0768 commit 11ebf9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion anvil/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl<BackendData: Backend> ClientDndGrabHandler for AnvilState<BackendData> {
};
self.dnd_icon = icon.map(|surface| DndIcon { surface, offset });
}
fn dropped(&mut self, _seat: Seat<Self>) {
fn dropped(&mut self, _target: Option<WlSurface>, _validated: bool, _seat: Seat<Self>) {
self.dnd_icon = None;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/wayland/selection/data_device/dnd_grab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ where
}
}

ClientDndGrabHandler::dropped(data, self.seat.clone());
ClientDndGrabHandler::dropped(data, self.current_focus.clone(), validated, self.seat.clone());
self.icon = None;
// in all cases abandon the drop
// no more buttons are pressed, release the grab
Expand Down
5 changes: 4 additions & 1 deletion src/wayland/selection/data_device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ pub trait ClientDndGrabHandler: SeatHandler + Sized {
///
/// Note that this event will only be generated for client-initiated drag'n'drop session.
///
/// * `target` - The target surface that the contents were dropped on.
/// * `validated` - Whether the drop offer was negotiated and accepted. If `false`, the drop
/// was cancelled or otherwise not successful.
/// * `seat` - The seat on which the DnD action was finished.
fn dropped(&mut self, seat: Seat<Self>) {}
fn dropped(&mut self, target: Option<WlSurface>, validated: bool, seat: Seat<Self>) {}
}

/// Event generated by the interactions of clients with a server initiated drag'n'drop
Expand Down

0 comments on commit 11ebf9d

Please sign in to comment.