Fixed building and using fcitx IME support on Linux

This commit is contained in:
Sam Lantinga
2016-10-08 11:30:07 -07:00
parent 27d4f09929
commit 42f85aa29e
4 changed files with 44 additions and 28 deletions

View File

@@ -397,6 +397,7 @@ X11_VideoInit(_THIS)
char *prev_xmods = X11_XSetLocaleModifiers(NULL);
const char *new_xmods = "";
const char *env_xmods = SDL_getenv("XMODIFIERS");
SDL_bool has_dbus_ime_support = SDL_FALSE;
if (prev_xmods) {
prev_xmods = SDL_strdup(prev_xmods);
@@ -406,7 +407,17 @@ X11_VideoInit(_THIS)
when it is used via XIM which causes issues. Prevent this by forcing
@im=none if XMODIFIERS contains @im=ibus. IBus can still be used via
the DBus implementation, which also has support for pre-editing. */
#ifdef HAVE_IBUS_IBUS_H
if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
has_dbus_ime_support = SDL_TRUE;
}
#endif
#ifdef HAVE_FCITX_FRONTEND_H
if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
has_dbus_ime_support = SDL_TRUE;
}
#endif
if (has_dbus_ime_support) {
new_xmods = "@im=none";
}