Update wayland-rs to 0.28

This commit is contained in:
Jonas Platte 2020-09-15 00:28:43 +02:00 committed by Victor Berger
parent d5931c5957
commit c4f64489e8
4 changed files with 15 additions and 15 deletions

View File

@ -28,11 +28,11 @@ slog-stdlog = { version = "4", optional = true }
tempfile = { version = "3.0", optional = true } tempfile = { version = "3.0", optional = true }
thiserror = "1" thiserror = "1"
udev = { version = "0.4", optional = true } udev = { version = "0.4", optional = true }
wayland-commons = { version = "0.27", optional = true } wayland-commons = { version = "0.28", optional = true }
wayland-egl = { version = "0.27", optional = true } wayland-egl = { version = "0.28", optional = true }
wayland-protocols = { version = "0.27", features = ["unstable_protocols", "server"], optional = true } wayland-protocols = { version = "0.28", features = ["unstable_protocols", "server"], optional = true }
wayland-server = { version = "0.27", optional = true } wayland-server = { version = "0.28", optional = true }
wayland-sys = { version = "0.27", optional = true } wayland-sys = { version = "0.28", optional = true }
winit = { version = "0.22.0", optional = true } winit = { version = "0.22.0", optional = true }
xkbcommon = "0.4.0" xkbcommon = "0.4.0"
# TODO: remove as soon as drm-rs provides an error implementing Error # TODO: remove as soon as drm-rs provides an error implementing Error

View File

@ -24,7 +24,7 @@ pub(crate) fn implement_data_source(src: Main<WlDataSource>) -> WlDataSource {
match req { match req {
Request::Offer { mime_type } => guard.mime_types.push(mime_type), Request::Offer { mime_type } => guard.mime_types.push(mime_type),
Request::SetActions { dnd_actions } => { Request::SetActions { dnd_actions } => {
guard.dnd_action = DndAction::from_bits_truncate(dnd_actions); guard.dnd_action = dnd_actions;
} }
Request::Destroy => {} Request::Destroy => {}
_ => unreachable!(), _ => unreachable!(),

View File

@ -130,7 +130,7 @@ impl<R: Role<DnDIconRole> + 'static> PointerGrab for DnDGrab<R> {
for mime_type in meta.mime_types.iter().cloned() { for mime_type in meta.mime_types.iter().cloned() {
offer.offer(mime_type); offer.offer(mime_type);
} }
offer.source_actions(meta.dnd_action.to_raw()); offer.source_actions(meta.dnd_action);
}) })
.unwrap(); .unwrap();
device.enter(serial.into(), &surface, x - sx, y - sy, Some(&offer)); device.enter(serial.into(), &surface, x - sx, y - sy, Some(&offer));
@ -304,7 +304,7 @@ fn implement_dnd_data_offer(
dnd_actions, dnd_actions,
preferred_action, preferred_action,
} => { } => {
let preferred_action = DndAction::from_bits_truncate(preferred_action); let preferred_action = preferred_action;
if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) { if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) {
offer.as_ref().post_error( offer.as_ref().post_error(
wl_data_offer::Error::InvalidAction as u32, wl_data_offer::Error::InvalidAction as u32,
@ -313,14 +313,14 @@ fn implement_dnd_data_offer(
} }
let source_actions = with_source_metadata(&source, |meta| meta.dnd_action) let source_actions = with_source_metadata(&source, |meta| meta.dnd_action)
.unwrap_or_else(|_| DndAction::empty()); .unwrap_or_else(|_| DndAction::empty());
let possible_actions = source_actions & DndAction::from_bits_truncate(dnd_actions); let possible_actions = source_actions & dnd_actions;
data.chosen_action = (&mut *action_choice.borrow_mut())(possible_actions, preferred_action); 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 // check that the user provided callback respects that one precise action should be chosen
debug_assert!( debug_assert!(
[DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action) [DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action)
); );
offer.action(data.chosen_action.to_raw()); offer.action(data.chosen_action);
source.action(data.chosen_action.to_raw()); source.action(data.chosen_action);
} }
_ => unreachable!(), _ => unreachable!(),
} }

View File

@ -142,7 +142,7 @@ where
for mime_type in self.metadata.mime_types.iter().cloned() { for mime_type in self.metadata.mime_types.iter().cloned() {
offer.offer(mime_type); offer.offer(mime_type);
} }
offer.source_actions(self.metadata.dnd_action.to_raw()); offer.source_actions(self.metadata.dnd_action);
device.enter(serial.into(), &surface, x - sx, y - sy, Some(&offer)); device.enter(serial.into(), &surface, x - sx, y - sy, Some(&offer));
self.pending_offers.push(offer); self.pending_offers.push(offer);
} }
@ -288,20 +288,20 @@ where
dnd_actions, dnd_actions,
preferred_action, preferred_action,
} => { } => {
let preferred_action = DndAction::from_bits_truncate(preferred_action); let preferred_action = preferred_action;
if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) { if ![DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&preferred_action) {
offer.as_ref().post_error( offer.as_ref().post_error(
wl_data_offer::Error::InvalidAction as u32, wl_data_offer::Error::InvalidAction as u32,
"Invalid preferred action.".into(), "Invalid preferred action.".into(),
); );
} }
let possible_actions = metadata.dnd_action & DndAction::from_bits_truncate(dnd_actions); let possible_actions = metadata.dnd_action & dnd_actions;
data.chosen_action = (&mut *action_choice.borrow_mut())(possible_actions, preferred_action); 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 // check that the user provided callback respects that one precise action should be chosen
debug_assert!( debug_assert!(
[DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action) [DndAction::Move, DndAction::Copy, DndAction::Ask].contains(&data.chosen_action)
); );
offer.action(data.chosen_action.to_raw()); offer.action(data.chosen_action);
(&mut *callback.borrow_mut())(ServerDndEvent::Action(data.chosen_action)); (&mut *callback.borrow_mut())(ServerDndEvent::Action(data.chosen_action));
} }
_ => unreachable!(), _ => unreachable!(),