diff -r 2677cd82ad85 src/video/x11/SDL_x11keyboard.c --- a/src/video/x11/SDL_x11keyboard.c Sun Oct 16 22:47:49 2016 +0200 +++ b/src/video/x11/SDL_x11keyboard.c Sun Oct 16 20:31:10 2016 -0600 @@ -427,15 +427,38 @@ #endif } +static void +X11_ResetXIM(_THIS) +{ +#ifdef X_HAVE_UTF8_STRING + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + int i; + + if (videodata && videodata->windowlist) { + for (i = 0; i < videodata->numwindows; ++i) { + SDL_WindowData *data = videodata->windowlist[i]; + if (data && data->ic) { + /* Clear any partially entered dead keys */ + char *contents = X11_Xutf8ResetIC(data->ic); + if (contents) { + X11_XFree(contents); + } + } + } + } +#endif +} + void X11_StartTextInput(_THIS) { - + X11_ResetXIM(_this); } void X11_StopTextInput(_THIS) { + X11_ResetXIM(_this); #ifdef SDL_USE_IME SDL_IME_Reset(); #endif diff -r 2677cd82ad85 src/video/x11/SDL_x11sym.h --- a/src/video/x11/SDL_x11sym.h Sun Oct 16 22:47:49 2016 +0200 +++ b/src/video/x11/SDL_x11sym.h Sun Oct 16 20:31:10 2016 -0600 @@ -201,6 +201,7 @@ SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) +SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) #endif #ifndef NO_SHARED_MEMORY