mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 13:50:05 -04:00
Send the event before waking up the message pump. (#3418)
This commit is contained in:
@@ -12,6 +12,7 @@ Unreleased` header.
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
- On macOS, fix incorrect IME cursor rect origin.
|
- On macOS, fix incorrect IME cursor rect origin.
|
||||||
|
- On Windows, fixed a race condition when sending an event through the loop proxy.
|
||||||
|
|
||||||
# 0.29.10
|
# 0.29.10
|
||||||
|
|
||||||
|
|||||||
@@ -696,14 +696,13 @@ impl<T: 'static> Clone for EventLoopProxy<T> {
|
|||||||
|
|
||||||
impl<T: 'static> EventLoopProxy<T> {
|
impl<T: 'static> EventLoopProxy<T> {
|
||||||
pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed<T>> {
|
pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed<T>> {
|
||||||
unsafe {
|
self.event_send
|
||||||
if PostMessageW(self.target_window, USER_EVENT_MSG_ID.get(), 0, 0) != false.into() {
|
.send(event)
|
||||||
self.event_send.send(event).ok();
|
.map(|result| {
|
||||||
Ok(())
|
unsafe { PostMessageW(self.target_window, USER_EVENT_MSG_ID.get(), 0, 0) };
|
||||||
} else {
|
result
|
||||||
Err(EventLoopClosed(event))
|
})
|
||||||
}
|
.map_err(|e| EventLoopClosed(e.0))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user