From d6fef73ef110eb43756b7b87c2cba80abae3b39f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Jul 2022 13:54:26 +1000 Subject: 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. --- source/blender/editors/curve/editfont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/curve') diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 611dbb2e80c..33e3837c9d4 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1639,7 +1639,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) Curve *cu = obedit->data; EditFont *ef = cu->editfont; static int accentcode = 0; - uintptr_t ascii = event->ascii; + uintptr_t ascii = WM_event_utf8_to_ascii(event); const bool alt = event->modifier & KM_ALT; const bool shift = event->modifier & KM_SHIFT; const bool ctrl = event->modifier & KM_CTRL; -- cgit v1.2.3