-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to merge KEYDOWN and TEXTINPUT events to prevent duplicates
This change makes all KEYDOWN events be stored temporarily as a "pending keydown event". If a TEXTINPUT event comes in before the next time PumpEvents() is called (or another KEYDOWN or KEYUP event appears), then one of the events generated from the 'text' string is merged with the KEYDOWN event, thus having both a valid 'sym' and 'unicode' value. Also add some basic support for UTF-16 surrogate pairs, as that was annoying me. Note that this doesn't quite match what SDL 1.2 does, which depends pretty heavily on what backend was being used. The closest backend (XIM, I think) does basically the same thing as this, but puts the real keysym on the last character of a mult-character TEXTINPUT, whereas we put it in the first one. (The last one may actually be more sensible, in case there are bugs where a 'last key pressed' is being maintained by an application, and the correct one is being overwritten by SDLK_UNKNOWN, but this was easier to implement for now.)
- Loading branch information
Showing
1 changed file
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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