diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-14 14:55:46 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-07-14 14:55:46 +0300 |
commit | 93f74299f07585d5c922aa048055141e7a487e07 (patch) | |
tree | be8aae08757a3f064cd5b705869ee061c7e7854c /intern | |
parent | cdd8b96e3b476df38847121102c6a267b5522a85 (diff) |
Cleanup: clang-tidy changes to GHOST_SystemX11
Also remove redundant check.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 70a9687672c..00cc5f3af8f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1159,7 +1159,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) /* Setting unicode on key-up events gives #XLookupNone status. */ xic = window->getX11_XIC(); - if (xic && xke->type == KeyPress) { + if (xic) { Status status; /* Use utf8 because its not locale repentant, from XORG docs. */ @@ -1213,20 +1213,21 @@ void GHOST_SystemX11::processEvent(XEvent *xe) if (xke->type == KeyPress && xic) { unsigned char c; int i = 0; - while (1) { - /* search character boundary */ - if ((unsigned char)utf8_buf[i++] > 0x7f) { + while (true) { + /* Search character boundary. */ + if ((uchar)utf8_buf[i++] > 0x7f) { for (; i < len; ++i) { c = utf8_buf[i]; - if (c < 0x80 || c > 0xbf) + if (c < 0x80 || c > 0xbf) { break; + } } } - if (i >= len) + if (i >= len) { break; - - /* enqueue previous character */ + } + /* Enqueue previous character. */ pushEvent(g_event); g_event = new GHOST_EventKey( @@ -1234,8 +1235,9 @@ void GHOST_SystemX11::processEvent(XEvent *xe) } } - if (utf8_buf != utf8_array) + if (utf8_buf != utf8_array) { free(utf8_buf); + } #endif break; |