Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5

wengxt

Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.

The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
This commit is contained in:
Sam Lantinga 2020-05-11 14:31:04 -07:00
parent 33642b47b2
commit eadc8693dd
9 changed files with 160 additions and 113 deletions

View file

@ -43,7 +43,7 @@ static void
InitIME()
{
static SDL_bool inited = SDL_FALSE;
#ifdef HAVE_FCITX_FRONTEND_H
#ifdef HAVE_FCITX
const char *im_module = SDL_getenv("SDL_IM_MODULE");
const char *xmodifiers = SDL_getenv("XMODIFIERS");
#endif
@ -54,7 +54,7 @@ InitIME()
inited = SDL_TRUE;
/* See if fcitx IME support is being requested */
#ifdef HAVE_FCITX_FRONTEND_H
#ifdef HAVE_FCITX
if (!SDL_IME_Init_Real &&
((im_module && SDL_strcmp(im_module, "fcitx") == 0) ||
(!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) {
@ -66,7 +66,7 @@ InitIME()
SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect;
SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents;
}
#endif /* HAVE_FCITX_FRONTEND_H */
#endif /* HAVE_FCITX */
/* default to IBus */
#ifdef HAVE_IBUS_IBUS_H