Implement ApplicationHandler::can_create|destroy_surfaces() (#3765)

This commit is contained in:
daxpedda 2024-06-30 00:41:57 +02:00 committed by GitHub
parent a0d69c782a
commit 75ce71f05a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 178 additions and 114 deletions

View file

@ -496,8 +496,12 @@ pub fn did_finish_launching(mtm: MainThreadMarker) {
let (windows, events) = AppState::get_mut(mtm).did_finish_launching_transition();
let events = std::iter::once(EventWrapper::StaticEvent(Event::NewEvents(StartCause::Init)))
.chain(events);
let events = [
EventWrapper::StaticEvent(Event::NewEvents(StartCause::Init)),
EventWrapper::StaticEvent(Event::CreateSurfaces),
]
.into_iter()
.chain(events);
handle_nonuser_events(mtm, events);
// the above window dance hack, could possibly trigger new windows to be created.

View file

@ -130,6 +130,7 @@ fn map_user_event<A: ApplicationHandler>(
},
Event::Suspended => app.suspended(window_target),
Event::Resumed => app.resumed(window_target),
Event::CreateSurfaces => app.can_create_surfaces(window_target),
Event::AboutToWait => app.about_to_wait(window_target),
Event::LoopExiting => app.exiting(window_target),
Event::MemoryWarning => app.memory_warning(window_target),