Windows: enable mouse events in Simulator on all skins#925
Open
XeduR wants to merge 1 commit into
Open
Conversation
- Add iOS/tvOS/WinPhone to the Simulator's supportsMouse config so mouse events fire on those skins (they were blocked on Windows), matching how key events already warn-and-fire
- Just adding Windows Phone here since the option exists in the Simulator (in case some poor soul selects it)
- Extend the init.lua simulated-device warning to cover "mouse" as well as "key", reminding devs the events won't fire on a real devices
- Report mouse as an available event source on macOS and Linux so Runtime:hasEventSource("mouse") returns true instead of returning false / asserting in debug
- Also adding a third optional suppressSimulatorWarning parameter to Runtime:addEventListener to suppress "key" and "mouse" warnings on the Simulator
- Making the Simulator's/Welcome Screen's own internal mouse-cursor listener suppress warnings so it won't fire every time when simulating unsupported devices/skins
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.
I've spent too many hours on Windows debugging why mouse events weren't firing only to remember that I was simulating an iOS device. 😅 Currently adding mouse events just fails silently on Simulator, but key events work just fine and they just give out a warning when simulating unsupported devices, so I replicated that behaviour for mouse events.
Changes
To test
Create an empty projects and just copy this to main.lua. Then run the project on the Simulator while simulating iOS, tvOS or Windows Phone device.