mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
Implement focus_change for macos
Refs: https://github.com/wez/wezterm/issues/93
This commit is contained in:
parent
f09145756c
commit
d58f1ff5dc
@ -918,6 +918,18 @@ impl WindowView {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" fn did_become_key(this: &mut Object, _sel: Sel, _id: id) {
|
||||
if let Some(this) = Self::get_this(this) {
|
||||
this.inner.borrow_mut().callbacks.focus_change(true);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" fn did_resign_key(this: &mut Object, _sel: Sel, _id: id) {
|
||||
if let Some(this) = Self::get_this(this) {
|
||||
this.inner.borrow_mut().callbacks.focus_change(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Switch the coordinate system to have 0,0 in the top left
|
||||
extern "C" fn is_flipped(_this: &Object, _sel: Sel) -> BOOL {
|
||||
YES
|
||||
@ -1296,6 +1308,15 @@ impl WindowView {
|
||||
Self::did_resize as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
|
||||
cls.add_method(
|
||||
sel!(windowDidBecomeKey:),
|
||||
Self::did_become_key as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
cls.add_method(
|
||||
sel!(windowDidResignKey:),
|
||||
Self::did_resign_key as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
|
||||
cls.add_method(
|
||||
sel!(mouseMoved:),
|
||||
Self::mouse_moved_or_dragged as extern "C" fn(&mut Object, Sel, id),
|
||||
|
Loading…
Reference in New Issue
Block a user