mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
Capture middle mouse events on macos
This commit is contained in:
parent
217dbfb99d
commit
0bae61d580
@ -1496,6 +1496,10 @@ impl WindowView {
|
||||
Self::mouse_common(this, nsevent, MouseEventKind::Release(MousePress::Right));
|
||||
}
|
||||
|
||||
extern "C" fn other_mouse_up(this: &mut Object, _sel: Sel, nsevent: id) {
|
||||
Self::mouse_common(this, nsevent, MouseEventKind::Release(MousePress::Middle));
|
||||
}
|
||||
|
||||
extern "C" fn scroll_wheel(this: &mut Object, _sel: Sel, nsevent: id) {
|
||||
let precise = unsafe { nsevent.hasPreciseScrollingDeltas() } == YES;
|
||||
let scale = if precise {
|
||||
@ -1563,6 +1567,10 @@ impl WindowView {
|
||||
Self::mouse_common(this, nsevent, MouseEventKind::Press(MousePress::Right));
|
||||
}
|
||||
|
||||
extern "C" fn other_mouse_down(this: &mut Object, _sel: Sel, nsevent: id) {
|
||||
Self::mouse_common(this, nsevent, MouseEventKind::Press(MousePress::Middle));
|
||||
}
|
||||
|
||||
extern "C" fn mouse_moved_or_dragged(this: &mut Object, _sel: Sel, nsevent: id) {
|
||||
Self::mouse_common(this, nsevent, MouseEventKind::Move);
|
||||
}
|
||||
@ -1956,6 +1964,14 @@ impl WindowView {
|
||||
sel!(rightMouseUp:),
|
||||
Self::right_mouse_up as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
cls.add_method(
|
||||
sel!(otherMouseDown:),
|
||||
Self::other_mouse_down as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
cls.add_method(
|
||||
sel!(otherMouseUp:),
|
||||
Self::other_mouse_up as extern "C" fn(&mut Object, Sel, id),
|
||||
);
|
||||
cls.add_method(
|
||||
sel!(scrollWheel:),
|
||||
Self::scroll_wheel as extern "C" fn(&mut Object, Sel, id),
|
||||
|
Loading…
Reference in New Issue
Block a user