qt: Fix absolute mouse button events dropped on macOS primary monitor#7026
Merged
OBattler merged 1 commit intoApr 9, 2026
Merged
Conversation
The __APPLE__ ifdef in mousePressEvent() and mouseReleaseEvent() used a condition requiring both m_monitor_index >= 1 and mouse_tablet_in_proximity, which is never satisfied on a single primary monitor (index 0) without physical tablet hardware. This caused all absolute input button events (mouse_input_mode >= 1) — such as those from the 3M MicroTouch Serial touchscreen — to be silently dropped on macOS when using the primary display. Linux and Windows both handle monitor index 0 correctly by including the (m_monitor_index < 1) && (mouse_input_mode >= 1) branch. Align the macOS code path with the Windows/Linux behavior by removing the nested __APPLE__ conditional and applying the same condition on all non-Windows platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
On macOS, clicking inside the emulated display has no effect when using an absolute input device such as the 3M MicroTouch Serial touchscreen (
mouse_input_mode >= 1). The mouse gets captured (cursor disappears) but all button press and release events are silently dropped.Linux and Windows are unaffected.
Root Cause
mousePressEvent()andmouseReleaseEvent()insrc/qt/qt_rendererstack.cppeach contain a platform-specific preprocessor block that guards themouse_set_buttons_ex()call. The macOS (__APPLE__) branch had a uniquely broken condition:```cpp
else // APPLE
endif
```
This requires both:
m_monitor_index >= 1— alwaysfalseon a single primary monitor (index 0)mousedata.mouse_tablet_in_proximity— alwaysfalsewithout physical tablet/stylus hardware in proximitySo the condition can never be true on a typical single-monitor macOS setup, and
mouse_set_buttons_ex()is never called, meaning clicks are never forwarded to the emulated machine.By contrast, Linux uses:
```cpp
if (((m_monitor_index >= 1) && (mouse_input_mode >= 1) && mousedata.mouse_tablet_in_proximity) || (m_monitor_index < 1))
```
and Windows uses:
```cpp
if (((m_monitor_index >= 1) && (mouse_input_mode >= 1) && mousedata.mouse_tablet_in_proximity) || ((m_monitor_index < 1) && (mouse_input_mode >= 1)))
```
Both of these correctly handle
m_monitor_index == 0(primary monitor).How to Reproduce
mouse_input_mode >= 1device) as the mouse type in 86Box settings.Fix
Remove the nested
__APPLE__-specific branch and replace it with the same condition used on Windows —((m_monitor_index >= 1) && (mouse_input_mode >= 1) && mousedata.mouse_tablet_in_proximity) || ((m_monitor_index < 1) && (mouse_input_mode >= 1))— in bothmousePressEvent()andmouseReleaseEvent().This ensures absolute input button events are forwarded on the primary monitor (index 0) when
mouse_input_mode >= 1, and retains the existing proximity guard for secondary monitors (m_monitor_index >= 1).The change affects any absolute input device (
mouse_input_mode >= 1) on macOS using the primary monitor. Multi-monitor secondary windows are not affected.Tested
Verified working on a MacBook Pro (Apple M1 Pro) running macOS. The fix was confirmed by binary-patching the equivalent ARM64 instructions in the released 86Box 5.3 build 8200 universal binary and testing with a Megatouch Maxx arcade image that uses the 3M MicroTouch Serial touchscreen — clicks in the emulated display now correctly register as touch events in the guest OS.