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.
Otherwise, the message box thread goes back to blocking, but the app's main
thread progresses to SDL_WaitThread and won't pump the event queue anymore.
On iOS, this means the messagebox won't pop back up (because it uses
SDL_RunOnMainThread, which needs the event loop to pump), but it's just bad
practice on any platform to stop pumping the event queue for indefinite
lengths of time.
If it is known that the window will immediately enter fullscreen upon being shown, set the borderless style when showing the window to hide the borders, or they may linger in the background if the client takes some time to draw the first frame.
Unnecessarily calling ShowWindow with SW_RESTORE when applying the window flags must be suppressed in this case, or the borders can reappear in a weird, partial state.