On Wayland, fix WindowEvent::Destroyed delivery
This commit is contained in:
parent
4f6fd44c6c
commit
9a28bb4b49
2 changed files with 29 additions and 28 deletions
|
|
@ -23,6 +23,7 @@ Unreleased` header.
|
||||||
- **Breaking:** On Web, return `RawWindowHandle::WebCanvas` instead of `RawWindowHandle::Web`.
|
- **Breaking:** On Web, return `RawWindowHandle::WebCanvas` instead of `RawWindowHandle::Web`.
|
||||||
- **Breaking:** On Web, macOS and iOS, return `HandleError::Unavailable` when a window handle is not available.
|
- **Breaking:** On Web, macOS and iOS, return `HandleError::Unavailable` when a window handle is not available.
|
||||||
- **Breaking:** Bump MSRV from `1.65` to `1.70`.
|
- **Breaking:** Bump MSRV from `1.65` to `1.70`.
|
||||||
|
- On Wayland, fix `WindowEvent::Destroyed` not being delivered after destroying window.
|
||||||
|
|
||||||
# 0.29.5
|
# 0.29.5
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,44 +467,44 @@ impl<T: 'static> EventLoop<T> {
|
||||||
});
|
});
|
||||||
|
|
||||||
for window_id in window_ids.drain(..) {
|
for window_id in window_ids.drain(..) {
|
||||||
let request_redraw = self.with_state(|state| {
|
let event = self.with_state(|state| {
|
||||||
let window_requests = state.window_requests.get_mut();
|
let window_requests = state.window_requests.get_mut();
|
||||||
if window_requests.get(&window_id).unwrap().take_closed() {
|
if window_requests.get(&window_id).unwrap().take_closed() {
|
||||||
mem::drop(window_requests.remove(&window_id));
|
mem::drop(window_requests.remove(&window_id));
|
||||||
mem::drop(state.windows.get_mut().remove(&window_id));
|
mem::drop(state.windows.get_mut().remove(&window_id));
|
||||||
false
|
return Some(WindowEvent::Destroyed);
|
||||||
} else {
|
|
||||||
let mut window = state
|
|
||||||
.windows
|
|
||||||
.get_mut()
|
|
||||||
.get_mut(&window_id)
|
|
||||||
.unwrap()
|
|
||||||
.lock()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if window.frame_callback_state() == FrameCallbackState::Requested {
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
// Reset the frame callbacks state.
|
|
||||||
window.frame_callback_reset();
|
|
||||||
let mut redraw_requested = window_requests
|
|
||||||
.get(&window_id)
|
|
||||||
.unwrap()
|
|
||||||
.take_redraw_requested();
|
|
||||||
|
|
||||||
// Redraw the frame while at it.
|
|
||||||
redraw_requested |= window.refresh_frame();
|
|
||||||
|
|
||||||
redraw_requested
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut window = state
|
||||||
|
.windows
|
||||||
|
.get_mut()
|
||||||
|
.get_mut(&window_id)
|
||||||
|
.unwrap()
|
||||||
|
.lock()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if window.frame_callback_state() == FrameCallbackState::Requested {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the frame callbacks state.
|
||||||
|
window.frame_callback_reset();
|
||||||
|
let mut redraw_requested = window_requests
|
||||||
|
.get(&window_id)
|
||||||
|
.unwrap()
|
||||||
|
.take_redraw_requested();
|
||||||
|
|
||||||
|
// Redraw the frame while at it.
|
||||||
|
redraw_requested |= window.refresh_frame();
|
||||||
|
|
||||||
|
redraw_requested.then_some(WindowEvent::RedrawRequested)
|
||||||
});
|
});
|
||||||
|
|
||||||
if request_redraw {
|
if let Some(event) = event {
|
||||||
callback(
|
callback(
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
window_id: crate::window::WindowId(window_id),
|
window_id: crate::window::WindowId(window_id),
|
||||||
event: WindowEvent::RedrawRequested,
|
event,
|
||||||
},
|
},
|
||||||
&self.window_target,
|
&self.window_target,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue