fixes: various fixes and cleanup
This commit is contained in:
parent
b4346ff3ca
commit
c1edb81084
27 changed files with 676 additions and 1455 deletions
|
|
@ -11,6 +11,5 @@ iced = { path = "../..", default-features = false, features = [
|
|||
"tokio",
|
||||
"debug",
|
||||
"winit",
|
||||
"multi-window",
|
||||
"tiny-skia",
|
||||
] }
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use cctk::sctk::reexports::{
|
|||
|
||||
use iced::platform_specific::shell::commands::subsurface::get_subsurface;
|
||||
use iced::{
|
||||
Element, Length, Subscription, Task,
|
||||
event::wayland::Event as WaylandEvent,
|
||||
platform_specific::{
|
||||
runtime::wayland::subsurface::SctkSubsurfaceSettings,
|
||||
|
|
@ -14,7 +15,6 @@ use iced::{
|
|||
},
|
||||
widget::{button, column, text, text_input},
|
||||
window::{self, Id, Settings},
|
||||
Element, Length, Subscription, Task,
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
|
|
@ -70,20 +70,17 @@ impl SubsurfaceApp {
|
|||
|
||||
fn update(&mut self, message: Message) -> Task<Message> {
|
||||
match message {
|
||||
Message::WaylandEvent(evt) => {
|
||||
dbg!(&evt);
|
||||
match evt {
|
||||
WaylandEvent::Output(_evt, output) => {
|
||||
if self.connection.is_none() {
|
||||
if let Some(backend) = output.backend().upgrade() {
|
||||
self.connection =
|
||||
Some(Connection::from_backend(backend));
|
||||
}
|
||||
Message::WaylandEvent(evt) => match evt {
|
||||
WaylandEvent::Output(_evt, output) => {
|
||||
if self.connection.is_none() {
|
||||
if let Some(backend) = output.backend().upgrade() {
|
||||
self.connection =
|
||||
Some(Connection::from_backend(backend));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
Message::Wayland(evt) => match evt {
|
||||
wayland::Event::RedBuffer(buffer) => {
|
||||
self.red_buffer = Some(buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue