mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-23 10:26:34 +11:00
fix(mac_platform): forward keyevent to system (#511)
* fix(mac_platform): forward keyevent to system * doc(changelog): update changelog
This commit is contained in:
parent
ffa9b51d27
commit
1819be1173
3 changed files with 9 additions and 8 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
- `Icon::to_cardinals` is no longer public, since it was never supposed to be.
|
- `Icon::to_cardinals` is no longer public, since it was never supposed to be.
|
||||||
- Wayland: improve diagnostics if initialization fails
|
- Wayland: improve diagnostics if initialization fails
|
||||||
|
- Fix some system event key doesn't work when focused, do not block keyevent forward to system on macOS
|
||||||
|
|
||||||
# Version 0.14.0 (2018-05-09)
|
# Version 0.14.0 (2018-05-09)
|
||||||
|
|
||||||
|
|
|
@ -294,10 +294,7 @@ impl EventsLoop {
|
||||||
|
|
||||||
// FIXME: Document this. Why do we do this? Seems like it passes on events to window/app.
|
// FIXME: Document this. Why do we do this? Seems like it passes on events to window/app.
|
||||||
// If we don't do this, window does not become main for some reason.
|
// If we don't do this, window does not become main for some reason.
|
||||||
match event_type {
|
appkit::NSApp().sendEvent_(ns_event);
|
||||||
appkit::NSKeyDown => (),
|
|
||||||
_ => appkit::NSApp().sendEvent_(ns_event),
|
|
||||||
}
|
|
||||||
|
|
||||||
let windows = self.shared.windows.lock().unwrap();
|
let windows = self.shared.windows.lock().unwrap();
|
||||||
let maybe_window = windows.iter()
|
let maybe_window = windows.iter()
|
||||||
|
|
|
@ -686,10 +686,13 @@ impl Window2 {
|
||||||
static INIT: std::sync::Once = std::sync::ONCE_INIT;
|
static INIT: std::sync::Once = std::sync::ONCE_INIT;
|
||||||
|
|
||||||
INIT.call_once(|| unsafe {
|
INIT.call_once(|| unsafe {
|
||||||
|
extern fn on_key_down(_this: &Object, _sel: Sel, _id: id) {}
|
||||||
|
|
||||||
let window_superclass = Class::get("NSWindow").unwrap();
|
let window_superclass = Class::get("NSWindow").unwrap();
|
||||||
let mut decl = ClassDecl::new("WinitWindow", window_superclass).unwrap();
|
let mut decl = ClassDecl::new("WinitWindow", window_superclass).unwrap();
|
||||||
decl.add_method(sel!(canBecomeMainWindow), yes as extern fn(&Object, Sel) -> BOOL);
|
decl.add_method(sel!(canBecomeMainWindow), yes as extern fn(&Object, Sel) -> BOOL);
|
||||||
decl.add_method(sel!(canBecomeKeyWindow), yes as extern fn(&Object, Sel) -> BOOL);
|
decl.add_method(sel!(canBecomeKeyWindow), yes as extern fn(&Object, Sel) -> BOOL);
|
||||||
|
decl.add_method(sel!(keyDown:), on_key_down as extern fn(&Object, Sel, id));
|
||||||
WINDOW2_CLASS = decl.register();
|
WINDOW2_CLASS = decl.register();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue