fixes: various fixes and cleanup

This commit is contained in:
Ashley Wulber 2026-02-19 17:01:13 -05:00
parent b4346ff3ca
commit c1edb81084
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
27 changed files with 676 additions and 1455 deletions

View file

@ -341,7 +341,7 @@ impl<'a, Message: 'static> Widget<Message, iced::Theme, iced::Renderer>
);
if matches!(s, event::Status::Captured) {
shell.capture_event();
return;
return;
}
let state = tree.state.downcast_mut::<State<()>>();
@ -383,7 +383,7 @@ return;
);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(id, OfferEvent::Leave))
if id == Some(my_id) =>
@ -407,7 +407,7 @@ return;
);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(id, OfferEvent::Motion { x, y }))
if id == Some(my_id) =>
@ -441,7 +441,7 @@ return;
);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(id, OfferEvent::LeaveDestination))
if id == Some(my_id) =>
@ -452,7 +452,7 @@ return;
shell.publish(msg);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(id, OfferEvent::Drop))
if id == Some(my_id) =>
@ -463,7 +463,7 @@ return;
shell.publish(msg);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(
id,
@ -478,13 +478,12 @@ return;
shell.publish(msg);
}
shell.capture_event();
return;
return;
}
Event::Dnd(DndEvent::Offer(
id,
OfferEvent::Data { data, mime_type },
)) if id == Some(my_id) => {
dbg!("got data");
if let (Some(msg), ret) = state.on_data_received(
mime_type,
data,
@ -497,7 +496,7 @@ return;
return ret;
}
shell.capture_event();
return;
return;
}
_ => {}
}
@ -705,7 +704,6 @@ impl<T> State<T> {
impl Fn(String, Vec<u8>, DndAction, f64, f64) -> Message,
>,
) -> (Option<Message>, event::Status) {
dbg!("data received");
let Some(dnd) = self.drag_offer.as_ref() else {
self.drag_offer = None;
return (None, event::Status::Ignored);

View file

@ -217,9 +217,8 @@ impl<
}
state.left_pressed_position = Some(position);
// dbg!(&state, &self.id);
shell.capture_event();
return;
return;
}
}
mouse::Event::ButtonReleased(mouse::Button::Left)
@ -227,7 +226,7 @@ return;
{
state.left_pressed_position = None;
shell.capture_event();
return;
return;
}
mouse::Event::CursorMoved { .. } => {
if let Some(position) = cursor.position() {
@ -240,7 +239,6 @@ return;
if let Some(left_pressed_position) =
state.left_pressed_position
{
// dbg!(&state);
if position.distance(left_pressed_position)
> self.drag_threshold
{
@ -261,7 +259,7 @@ return;
state.hovered = true;
}
shell.capture_event();
return;
return;
}
}
_ => return ret,
@ -272,7 +270,7 @@ return;
if state.is_dragging {
state.is_dragging = false;
shell.capture_event();
return;
return;
}
return ret;
}