Skip to content

Cross platform scaffolding#64

Open
LikeTheSalad wants to merge 4 commits into
petoncle:mainfrom
LikeTheSalad:cross-platform-scaffolding
Open

Cross platform scaffolding#64
LikeTheSalad wants to merge 4 commits into
petoncle:mainfrom
LikeTheSalad:cross-platform-scaffolding

Conversation

@LikeTheSalad

@LikeTheSalad LikeTheSalad commented May 19, 2026

Copy link
Copy Markdown

These changes attempt to abstract Windows-specific functionality into interfaces and create implementations for Windows. The functionality should remain the same, however, it sets up a scaffolding for adding new platform support in the future.

Since I'm not using Windows, the validations I ran are the existing unit tests, so it's probably wise to try these changes out in a Windows machine to make sure nothing's broken (in case some use cases aren't covered by tests).

@petoncle

Copy link
Copy Markdown
Owner

Thanks @LikeTheSalad! I'll look into it. There are little unit tests unfortunately, the hard parts are difficult to test (keyboard/mouse OS interaction and overlay UI).
Are you interested in a Linux version or macOS? Did you ever use mousemaster on Windows?

@LikeTheSalad

Copy link
Copy Markdown
Author

Thanks @LikeTheSalad! I'll look into it. There are little unit tests unfortunately, the hard parts are difficult to test (keyboard/mouse OS interaction and overlay UI). Are you interested in a Linux version or macOS? Did you ever use mousemaster on Windows?

Thanks 🙏 I'm interested in a macOS version. I still haven't tried to make it work locally, so I'm frankly not sure if all the Windows apis have a 1-1 alternative here, but still, fully isolating the existing platform should make it easier to test it later. I still haven't tried mousemaster before, but from the docs, it seems the most feature-rich tool available out there, which is why it'd be nice to use it on other platforms.

@petoncle

Copy link
Copy Markdown
Owner

Forgot about your PR, sorry. I just reviewed and it's looking good, thanks a lot for this. I just tested quickly and it's working fine.
I just have some notes I took while reviewing:

  • WindowsKeyboardAdapter implements Keyboard: Instead of WindowsKeyboardAdapter, maybe it could be WindowsKeyboard implements Keyboard. And we'd remove static methods from WindowsKeyboard. And I think it needs to be called KeyboardController instead of Keyboard, because for Mouse there is a conflict (there's a Mouse class that already exists).
  • Same for WindowsMouseAdapter implements PlatformMouse: could it be WindowsMouseController implements MouseController?
  • Same for WindowsOverlayAdapter: WindowsOverlay implements Overlay
  • Same for WindowsUiAutomationAdapter: WindowsUiAutomation implement UiAutomation
  • WindowsKeyRegurgitator implements KeyRegurgitator: I'm not sure if it needs to be platform-aware (for now at least?), i.e. it could stay as one single KeyRegurgitator class.
  • Question I asked myself regarding the enum WindowsVirtualKey. Maybe it's possible to make this enum cross-platform, i.e. the enum would be VirtualKey. This would avoid the need to carry around the enum name, we could just carry around the enum instance instead. We'd keep keyFromVirtualKey() instead of keyFromVirtualKeyName(); we wouldn't need KeyboardLayoutKeyDeserializer.

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