|
@@ -37,6 +37,7 @@
|
|
|
#include "../../events/SDL_mouse_c.h"
|
|
|
#include "../../events/SDL_touch_c.h"
|
|
|
#include "../../core/linux/SDL_system_theme.h"
|
|
|
+#include "../../SDL_utils_c.h"
|
|
|
|
|
|
#include <SDL3/SDL_syswm.h>
|
|
|
|
|
@@ -762,7 +763,7 @@ static Bool isReparentNotify(Display *display, XEvent *ev, XPointer arg)
|
|
|
static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int bytes_buffer, KeySym *keysym_return, XComposeStatus *status_in_out)
|
|
|
{
|
|
|
int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);
|
|
|
- if (result > 0) {
|
|
|
+ if (result > 0 && !SDL_utf8valid(buffer_return, (size_t)result)) {
|
|
|
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result);
|
|
|
if (utf8_text) {
|
|
|
SDL_strlcpy(buffer_return, utf8_text, bytes_buffer);
|