Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Released binaries are not codesigned with a Developer ID, so after every upgrade
| Enter | Double click |
| `m` | Triple click |
| Delete | Right click |
| Insert | Middle click (macOS is not supported) |
| Insert | Middle click |
| Escape | Close overlay |
| Backspace | Undo last step |
| Arrow keys | Scroll (up/down/left/right) |
Expand Down
14 changes: 13 additions & 1 deletion src/backend/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ const K_CGEVENT_RIGHT_MOUSE_DOWN: u32 = 3;
const K_CGEVENT_RIGHT_MOUSE_UP: u32 = 4;
const K_CGEVENT_MOUSE_MOVED: u32 = 5;
const K_CGEVENT_LEFT_MOUSE_DRAGGED: u32 = 6;
const K_CGEVENT_OTHER_MOUSE_DOWN: u32 = 25;
const K_CGEVENT_OTHER_MOUSE_UP: u32 = 26;
const K_CGEVENT_KEY_DOWN: u32 = 10;
const K_CGEVENT_TAP_DISABLED_BY_TIMEOUT: u32 = 0xFFFFFFFE;
const K_CGEVENT_TAP_DISABLED_BY_USER_INPUT: u32 = 0xFFFFFFFF;

const K_CGMOUSE_BUTTON_LEFT: u32 = 0;
const K_CGMOUSE_BUTTON_RIGHT: u32 = 1;
const K_CGMOUSE_BUTTON_CENTER: u32 = 2;

const K_CGHIDEVENT_TAP: u32 = 0;
const K_CGANNOTATED_SESSION_EVENT_TAP: u32 = 2;
Expand Down Expand Up @@ -687,7 +690,16 @@ impl Backend for MacosBackend {
}

fn middle_click(&mut self, x: u32, y: u32) -> Result<()> {
unimplemented!();
self.hide_overlay();
self.focus_target_app();
self.click_at(
K_CGEVENT_OTHER_MOUSE_DOWN,
K_CGEVENT_OTHER_MOUSE_UP,
K_CGMOUSE_BUTTON_CENTER,
x,
y,
1,
);
Ok(())
}

Expand Down