Skip to content

311-various-macos-issues-mostly-to-do-with-mouse-inputs - #314

Merged
OneLoneCoder merged 1 commit into
developfrom
311-various-macos-issues-mostly-to-do-with-mouse-inputs
Sep 25, 2026
Merged

OneLoneCoder merged 1 commit into
developfrom
311-various-macos-issues-mostly-to-do-with-mouse-inputs

Conversation

@Johnnyg63

Copy link
Copy Markdown
Collaborator

@SteveBirtles, reported and fixed the below issues. All have been tested, Please see #311 for issue, pdf can be downloaded here: https://github.com/user-attachments/files/32536930/MacOS.specific.patches.for.olcPixelGameEngine3-1.pdf

  • Resizing the window on a retina display caused the mouse position to be reported wrong (pixel vs ‘point’ scaling). Items 1 and 2 below fix this…_ :
    • Corrected
    • Corrected
  • Program would crash when an attempt was made to close it due to queued window events, fixed by item 3…
  • On MacOS, the trackpad sends type 3 which meant clicks were ignored and mouse stayed at (0,0). Fixed with item 4, 5 and 6…
    • All 3 items corrected, I didn't have a macBook / Neo so I was really able to test this fully, sp again great catch and brilliant fix!!!
  • A tricky one, this. Changing the mouse visibility or position could deadlock, with two threads waiting on each other, so the program hung. Making the event dispatches
    asynchronous and adding a 16ms limit on the wait (one frame) resolved this issue, as seen in item 7 and 8…
    • I could not reproduce, however it is a tricky one/rare that this could happen so:
    • I implemented item 7
    • However for item 8, hardcoding a delay of 16ms or adding a magic numbers will have all the other Guru's on my back.
    • Therefore I added a MainThread task SET_MOUSE_POSITION to handle it
case SET_MOUSE_POSITION:
{
    // Set mouse position on main thread
    pMacOSWindow->setCursorPosition(vPositionMouse.x, vPositionMouse.y);
    res = false; // No need to skip frame
    break;
}

@Johnnyg63 Johnnyg63 self-assigned this Sep 24, 2026
@OneLoneCoder
OneLoneCoder merged commit 8a51d72 into develop Sep 25, 2026
1 check passed
@Johnnyg63
Johnnyg63 deleted the 311-various-macos-issues-mostly-to-do-with-mouse-inputs branch September 25, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants