ForceClickToRightClick converts Force Clicks into right/secondary clicks.
- This app does not log or transmit any events. All data is stored in memory and is deleted when you release the mouse button.
- This app only receives the following events:
- Left Mouse Down
- Left Mouse Up
- Pressure Change
- Left Mouse Dragged
- Notably, this app does not access your keyboard/typing behavior in any way.
(See EventHandler.swift
for the code, which is ordered slightly differently from this explanation)
- When the app detect a left mouse down, it tells the system to ignore it and starts a 200ms countdown.
- If the app has detected a left mouse down, it takes over handling of all mouse events:
- When the mouse is released, the app:
- Replays the left mouse down at its original location
- Replays the mouse moves in order, sending them as left mouse drag events
- Cancels the countdown and waits until another left mouse down before observing further events
- When the mouse is dragged:
- If the cursor has moved more than 8px from its starting location, the app:
- Replays the left mouse down at its original location
- Replays the mouse moves in order, sending them as left mouse drag events
- Cancels the countdown and waits until another left mouse down before observing further events
- Otherwise, the app:
- Adds the new cursor location to the list of mouse moves to replay later
- Dispatches a mouse move event to continue to give the user feedback
- If the cursor has moved more than 8px from its starting location, the app:
- When pressure change is detected on the trackpad:
- If the pressure change goes over the system’s threshold for a force click, the app:
- Replays the mouse down event and mouse motion as right mouse down/drag events
- Cancels the countdown and transitions into right-click mode (see below)
- Otherwise, the app discards the pressure event
- If the pressure change goes over the system’s threshold for a force click, the app:
- When the mouse is released, the app:
- Replays the left mouse down at its original location
- Replays the mouse moves in order, sending them as left mouse drag events
- Cancels the countdown and waits until another left mouse down before observing further events
- When the mouse is released, the app:
- If the app is in right-click mode, it takes over handling of all mouse events:
- When the mouse is released, the app:
- Dispatches a right mouse up event
- Waits until another left mouse down before observing further events
- When the mouse is dragged, the app changes the event to a right-mouse-drag event.
- When the mouse is released, the app:
All events not specified above are passed through as-is.