Merge #386: gui: filter unused events

75c4109373fecf527b0d93daa1b8df6f4250f068 gui: filter unused events (edouard)

Pull request description:

  It may removes the annoying logs that occurs after a while.
  ```
  [1669885771][iced_futures::subscription::tracker][WARN] Error sending event to subscription: TrySendError { kind: Full }
  [1669885771][iced_futures::subscription::tracker][WARN] Error sending event to subscription: TrySendError { kind: Full }
  [1669885771][iced_futures::subscription::tracker][WARN] Error sending event to subscription: TrySendError { kind: Full }
  ```
  By filtering the events to use only the events listened by the application, we may not reach some buffer size limit

ACKs for top commit:
  edouardparis:
    Self-ACK 75c4109373fecf527b0d93daa1b8df6f4250f068

Tree-SHA512: d4d699675bea624e6fb4d671dba9a6862d42b7462fa6c9988c635ea29fa8b22ea038a1f76e5aca9c4702fe9f689d1c9824fe1ffafdf0f0e75910ea236025f3b6
This commit is contained in:
edouard 2023-03-27 18:55:11 +02:00
commit e1926c40a4
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F

View File

@ -241,7 +241,17 @@ impl Application for GUI {
State::App(v) => v.subscription().map(|msg| Message::Run(Box::new(msg))),
State::Launcher(v) => v.subscription().map(|msg| Message::Launch(Box::new(msg))),
},
iced_native::subscription::events().map(Self::Message::Event),
iced_native::subscription::events_with(|event, _status| {
if matches!(
event,
iced::Event::Window(iced_native::window::Event::CloseRequested)
) {
Some(event)
} else {
None
}
})
.map(Self::Message::Event),
])
}