diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-14 06:54:26 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-07-14 08:59:19 +0300 |
commit | d6fef73ef110eb43756b7b87c2cba80abae3b39f (patch) | |
tree | 5fdc7097a5fabdf5d52027340894433ddadb4ddb /intern/ghost/GHOST_Types.h | |
parent | 816a73891b69e2060c5b99d599e2a99e273db124 (diff) |
WM: Remove ASCII members from wmEvent & GHOST_TEventKeyData
The `ascii` member was only kept for historic reason as some platforms
didn't support utf8 when it was first introduced.
Remove the `ascii` struct members since many checks used this as a
fall-back for utf8_buf not being set which isn't needed.
There are a few cases where it's convenient to access the ASCII value
of an event (or nil) so a function has been added to do that.
*Details*
- WM_event_utf8_to_ascii() has been added for the few cases an events
ASCII value needs to be accessed, this just avoids having to do
multi-byte character checks in-line.
- RNA Event.ascii remains, using utf8_buf[0] for single byte characters.
- GHOST_TEventKeyData.ascii has been removed.
- To avoid regressions non-ASCII Latin1 characters from GHOST are
converted into multi-byte UTF8, when building X11 without
XInput & X_HAVE_UTF8_STRING it seems like could still occur.
Diffstat (limited to 'intern/ghost/GHOST_Types.h')
-rw-r--r-- | intern/ghost/GHOST_Types.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index 2fc84349eb9..fa74bfde866 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -547,17 +547,6 @@ typedef struct { /** The key code. */ GHOST_TKey key; - /* ascii / utf8: both should always be set when possible, - * - ascii may be '\0' however if the user presses a non ascii key - * - unicode may not be set if the system has no unicode support - * - * These values are intended to be used as follows. - * For text input use unicode when available, fallback to ascii. - * For areas where unicode is not needed, number input for example, always - * use ascii, unicode is ignored - campbell. - */ - /** The ascii code for the key event ('\0' if none). */ - char ascii; /** The unicode character. if the length is 6, not NULL terminated if all 6 are set. */ char utf8_buf[6]; |