wayland.data_device: Add None as a valid DND action
This commit is contained in:
parent
46209cfb38
commit
6856ae891f
|
@ -300,7 +300,11 @@ fn implement_dnd_data_offer(
|
|||
preferred_action,
|
||||
} => {
|
||||
let preferred_action = preferred_action;
|
||||
if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) {
|
||||
|
||||
// preferred_action must only contain one bitflag at the same time
|
||||
if ![DndAction::None, DndAction::Move, DndAction::Copy, DndAction::Ask]
|
||||
.contains(&preferred_action)
|
||||
{
|
||||
offer.as_ref().post_error(
|
||||
wl_data_offer::Error::InvalidAction as u32,
|
||||
"Invalid preferred action.".into(),
|
||||
|
@ -312,7 +316,8 @@ fn implement_dnd_data_offer(
|
|||
data.chosen_action = (&mut *action_choice.borrow_mut())(possible_actions, preferred_action);
|
||||
// check that the user provided callback respects that one precise action should be chosen
|
||||
debug_assert!(
|
||||
[DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action)
|
||||
[DndAction::None, DndAction::Move, DndAction::Copy, DndAction::Ask]
|
||||
.contains(&data.chosen_action)
|
||||
);
|
||||
offer.action(data.chosen_action);
|
||||
source.action(data.chosen_action);
|
||||
|
|
|
@ -295,7 +295,11 @@ where
|
|||
preferred_action,
|
||||
} => {
|
||||
let preferred_action = preferred_action;
|
||||
if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) {
|
||||
|
||||
// preferred_action must only contain one bitflag at the same time
|
||||
if ![DndAction::None, DndAction::Move, DndAction::Copy, DndAction::Ask]
|
||||
.contains(&preferred_action)
|
||||
{
|
||||
offer.as_ref().post_error(
|
||||
wl_data_offer::Error::InvalidAction as u32,
|
||||
"Invalid preferred action.".into(),
|
||||
|
@ -305,7 +309,8 @@ where
|
|||
data.chosen_action = (&mut *action_choice.borrow_mut())(possible_actions, preferred_action);
|
||||
// check that the user provided callback respects that one precise action should be chosen
|
||||
debug_assert!(
|
||||
[DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action)
|
||||
[DndAction::None, DndAction::Move, DndAction::Copy, DndAction::Ask]
|
||||
.contains(&data.chosen_action)
|
||||
);
|
||||
offer.action(data.chosen_action);
|
||||
(&mut *callback.borrow_mut())(ServerDndEvent::Action(data.chosen_action));
|
||||
|
|
Loading…
Reference in New Issue