This loop breakout was originally from an attempt to parse coalesced packets.
Breaking out early does more harm than good, and no devices coalesce packets,
so this is unnecessary.
By moving the message sending onto the main thread and adding a small timeout
we can now ensure the ACKs are sent fast enough to avoid the firmware bugs in
these controllers.
At the moment, only the ThrustMaster T.Flight Hotas One has full support. The
documentation says you can query the extra buttons via a specific command, but
the stick appears to reject the command. Further investigation is needed for
automatically querying this state.
This is needed for future work bringing up things like the chatpad.
This commit also fixes a few minor things, such as still sending motor packets
to devices that don't support it, enabling quirks that hide trigger rumble on
devices that are marked as not having it, and fixing #12942.
The surrounding code in all of these instances expects the Unicode
variants. Previously, this code mixed Unicode and ANSI/ASCII calls if
`UNICODE` was undefined, which caused type and logic errors. Explicitly
spelling out the W removes any reliance on that macro.
IME text events can result in sending duplicate key press events, which will result in undesired repeated key presses. Since the events are exact duplicates, compare the serials to filter out redundant key down events.
The Module interface is the one used by the outside world. This code
is inside the module itself so can use the internal name, avoiding the
need to export this function on the Module at all.
See https://github.com/emscripten-core/emscripten/pull/24269
You can't have two sections with the same name (so it can generate unique
page anchors), so fix one of these, and tweak another thing that _isn't_ a
header but wikiheader's quick-and-dirty parser thinks is one.
Using a 0 sequence number is always allowed and avoids having to synchronize sequence numbers with the controller (and potentially confusing other things talking to the controller)
Also fixes occasional long running rumble at controller connection.
The xserver will still send EnterNotify events while the pointer is captured, and the grab shouldn't be updated in these cases, as it will cause the capture to be lost.