Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-14 06:54:26 +0300
committerCampbell Barton <campbell@blender.org>2022-07-14 08:59:19 +0300
commitd6fef73ef110eb43756b7b87c2cba80abae3b39f (patch)
tree5fdc7097a5fabdf5d52027340894433ddadb4ddb /source/blender/makesrna/intern/rna_wm_api.c
parent816a73891b69e2060c5b99d599e2a99e273db124 (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 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index b9f36d35ee8..eb5e2549b1d 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -639,16 +639,12 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
}
/* TODO: validate NDOF. */
- char ascii = 0;
if (unicode != NULL) {
int len = BLI_str_utf8_size(unicode);
if (len == -1 || unicode[len] != '\0') {
BKE_report(reports, RPT_ERROR, "Only a single character supported");
return NULL;
}
- if (len == 1 && isascii(unicode[0])) {
- ascii = unicode[0];
- }
}
wmEvent e = *win->eventstate;
@@ -672,10 +668,8 @@ static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
e.modifier |= KM_OSKEY;
}
- e.ascii = '\0';
e.utf8_buf[0] = '\0';
if (unicode != NULL) {
- e.ascii = ascii;
STRNCPY(e.utf8_buf, unicode);
}