mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Only return Awakened on NsApplicationActivated, rather than on every unknown event.
This commit is contained in:
parent
be09639b69
commit
35dcf8dab9
|
@ -115,19 +115,11 @@ impl EventsLoop {
|
||||||
foundation::NSDefaultRunLoopMode,
|
foundation::NSDefaultRunLoopMode,
|
||||||
cocoa::base::YES);
|
cocoa::base::YES);
|
||||||
|
|
||||||
// FIXME: we should check explicitly for `Awakened` events in `ns_event_to_event`
|
if let Some(event) = self.ns_event_to_event(ns_event) {
|
||||||
// and not just assume that an `Awakened` event occurred every time `None` is
|
|
||||||
// returned. Also, `Awakened` should be a variant of `Event`, not `WindowEvent`, so
|
|
||||||
// for now we do this hack with a fake ID.
|
|
||||||
let event = self.ns_event_to_event(ns_event)
|
|
||||||
.unwrap_or(Event::WindowEvent {
|
|
||||||
window_id: ::WindowId(super::WindowId(0)),
|
|
||||||
event: WindowEvent::Awakened,
|
|
||||||
});
|
|
||||||
|
|
||||||
if let Ok(mut callback) = self.callback.lock() {
|
if let Ok(mut callback) = self.callback.lock() {
|
||||||
callback.as_mut().unwrap()(event);
|
callback.as_mut().unwrap()(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let _: () = msg_send![pool, release];
|
let _: () = msg_send![pool, release];
|
||||||
}
|
}
|
||||||
|
@ -338,12 +330,21 @@ impl EventsLoop {
|
||||||
let window_event = WindowEvent::MouseWheel(delta, phase);
|
let window_event = WindowEvent::MouseWheel(delta, phase);
|
||||||
Some(into_event(window_event))
|
Some(into_event(window_event))
|
||||||
},
|
},
|
||||||
|
|
||||||
appkit::NSEventTypePressure => {
|
appkit::NSEventTypePressure => {
|
||||||
let pressure = ns_event.pressure();
|
let pressure = ns_event.pressure();
|
||||||
let stage = ns_event.stage();
|
let stage = ns_event.stage();
|
||||||
let window_event = WindowEvent::TouchpadPressure(pressure, stage);
|
let window_event = WindowEvent::TouchpadPressure(pressure, stage);
|
||||||
Some(into_event(window_event))
|
Some(into_event(window_event))
|
||||||
},
|
},
|
||||||
|
|
||||||
|
appkit::NSApplicationDefined => match ns_event.subtype() {
|
||||||
|
appkit::NSEventSubtype::NSApplicationActivatedEventType => {
|
||||||
|
Some(into_event(WindowEvent::Awakened))
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue