Commit Graph

3 Commits

Author SHA1 Message Date
Maxim Poliakovski
920c2024be Revert "Add a basic mouse grab mode when running on macOS"
This reverts commit 587eb48f61.
2023-12-19 13:15:10 +01:00
Mihai Parparita
587eb48f61 Add a basic mouse grab mode when running on macOS
Adds a "Grab Mouse" command to the "Window" menu which toggles
SDL_SetRelativeMouseMode. That "traps" the mouse to the current window
(and hides it) which makes it less annoying to deal with the separate
acceleration curves of the host and guest OS.

This needs to be done via AppKit code since SDL does not have a
cross-platform way to add menu commands.

I also looked into the extended ADB mouse protocol but it does not
appear to do that we want. If we use it to report a device class of
classAbsolute (0) the acceleration curve changes to a flat response
(we end up using 'accl' 0 from 9dd3c4bef8/base/SuperMarioProj.1994-02-09/Resources/MiscROMRsrcs.r (L64-L76))
but the coordinates are still interpreted as being deltas. If I use a
device type 4 (Absolute pointing devices) then the mouse position is
never queried. Per https://68kmla.org/bb/index.php?threads/anyone-have-an-adb-graphics-tablet-or-joystick.39128/
all tablet devices end up using custom drivers.
2023-12-15 15:38:32 -08:00
Mihai Parparita
ec155bf7ba Remap Cocoa/macOS menu item key modifiers
As part of adding ADB keyboard support (#56), we're now running into
conflicts between the guest and host OS keyboard shortcuts when running
on macOS hosts.

SDL2 unconditionally adds some menu items to the "Window" menu, and
there are built-in ones too. As a workaround, we now iterate over all
menu items are swap out command for control, since the the latter is
generally unused in classic Mac OS.
2023-10-29 12:16:01 -07:00