Introduce subscription::Event

... and remove `PlatformSpecific` from `Event`
This commit is contained in:
Héctor Ramón Jiménez 2024-06-11 19:41:05 +02:00
parent 83296a73eb
commit 5d7dcf417c
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
13 changed files with 156 additions and 129 deletions

View file

@ -12,7 +12,8 @@ use crate::core::widget::operation;
use crate::core::window;
use crate::core::{Color, Event, Point, Size, Theme};
use crate::futures::futures;
use crate::futures::{Executor, Runtime, Subscription};
use crate::futures::subscription::{self, Subscription};
use crate::futures::{Executor, Runtime};
use crate::graphics;
use crate::graphics::compositor::{self, Compositor};
use crate::runtime::clipboard;
@ -574,12 +575,10 @@ async fn run_instance<A, E, C>(
event::Event::PlatformSpecific(event::PlatformSpecific::MacOS(
event::MacOS::ReceivedUrl(url),
)) => {
use crate::core::event;
events.push(Event::PlatformSpecific(
event::PlatformSpecific::MacOS(event::MacOS::ReceivedUrl(
url,
)),
runtime.broadcast(subscription::Event::PlatformSpecific(
subscription::PlatformSpecific::MacOS(
subscription::MacOS::ReceivedUrl(url),
),
));
}
event::Event::UserEvent(message) => {
@ -650,11 +649,11 @@ async fn run_instance<A, E, C>(
_ => ControlFlow::Wait,
});
runtime.broadcast(
redraw_event,
core::event::Status::Ignored,
window::Id::MAIN,
);
runtime.broadcast(subscription::Event::Interaction {
window: window::Id::MAIN,
event: redraw_event,
status: core::event::Status::Ignored,
});
debug.draw_started();
let new_mouse_interaction = user_interface.draw(
@ -744,7 +743,11 @@ async fn run_instance<A, E, C>(
for (event, status) in
events.drain(..).zip(statuses.into_iter())
{
runtime.broadcast(event, status, window::Id::MAIN);
runtime.broadcast(subscription::Event::Interaction {
window: window::Id::MAIN,
event,
status,
});
}
if !messages.is_empty()