iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
26.35k stars 1.28k forks source link

advanced::Widget - on_event not firing under custom winit workflow #2821

Closed doronnac closed 1 month ago

doronnac commented 1 month ago

Is your issue REALLY a bug?

Is there an existing issue for this?

Is this issue related to iced?

What happened?

I'm in the process of combining iced gstreamer library and iced integration example .

Unfortunately, it appears the gstreamer library seems to be relying on the advanced::Widget trait's onevent method, specifically on the iced::Event::Window(iced::window::Event::RedrawRequested()) event. However, with the custom winit workflow, on_event doesn't seem to be called at all.

Thank you for your attention.

What is the expected behavior?

Ideally in order for iced_video_player to work as-is, aforementioned on_event should be invoked with the appropriate event.

Version

crates.io release

Operating System

macOS

Do you have any log output?

doronnac commented 1 month ago

Solved, needed to add:

state.queue_event(iced::Event::Window(iced::window::Event::RedrawRequested( Instant::now(), )));

to the WindowEvent::RedrawRequested event handler, and moved the state.update there as well.

I'll probably issue a PR once I have more time.