Skip to content

Fix for Amazon Fire TV relative mouse mode - #16349

Open
Packetdancer wants to merge 1 commit into
libsdl-org:mainfrom
Packetdancer:amazon_fire_mouse
Open

Packetdancer wants to merge 1 commit into
libsdl-org:mainfrom
Packetdancer:amazon_fire_mouse

Conversation

@Packetdancer

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

For some reason, Amazon Fire TV Stick devices have a weird behavior where, when you put the mouse into relative mode rather than absolute, it also generates keyboard events alongside the mouse. Specifically, the following mappings:

  • Left mouse button = KEYCODE_ENTER
  • Right mouse button = KEYCODE_BACK
  • Mouse movement = KEYCODE_DPAD_[UP|DOWN|LEFT|RIGHT] (repeatedly as you move the mouse)

Needless to say, this does some... interesting things. However, conveniently, the Amazon version of Android will generate these from a keyboard with device ID -1, where a real keyboard always has a real device ID. So this change just checks if we're on an Amazon device, and if so, discards keyboard events coming from a SOURCE_KEYBOARD device with ID -1.

Existing Issue(s)

In particular, this fixes a weird issue people were seeing where when you started streaming a first-person shooter with Steam Link, the mouse would go into relative mode and now suddenly trying to fire your weapon would also hit enter (opening a chatbox or some other nonsense).

This prevents that. Yay! \o/

@Packetdancer

Copy link
Copy Markdown
Contributor Author

slouken - If you happen to look at this one over the weekend, hold off on it just yet. This does fix the issue on Amazon Fire TV, but I've now dug up reports of the behavior on Samsung devices too, so I want to dig a bit deeper before we merge.

@slouken

slouken commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Okay, holding off...

@slouken slouken added this to the 3.4.18 milestone Sep 20, 2026
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