Fixed bug 2824 - Add Fcitx Input Method Support

Weitian Leung

Just moved ibus direct call to SDL_IME_* related functions, and adds fcitx IME support (uses DBus, too),
enable with env: SDL_IM_MODULE=fcitx (ibus still the default one)
This commit is contained in:
Sam Lantinga
2016-10-07 18:57:40 -07:00
parent 89abbbfe9e
commit 808c75d1cf
10 changed files with 967 additions and 22 deletions

View File

@@ -2260,6 +2260,18 @@ AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
fi
}
dnl See if the platform wanna IME support.
CheckIME()
{
AC_ARG_ENABLE(ime,
AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
, enable_ime=yes)
if test x$enable_ime = xyes; then
AC_DEFINE(SDL_USE_IME, 1, [ ])
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
fi
}
dnl See if the platform has libibus IME support.
CheckIBus()
{
@@ -2280,7 +2292,10 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
have_inotify_inotify_h_hdr=no)
CFLAGS="$save_CFLAGS"
if test x$have_ibus_ibus_h_hdr = xyes; then
if test x$enable_dbus != xyes; then
if test x$enable_ime != xyes; then
AC_MSG_WARN([IME support is required for IBus.])
have_ibus_ibus_h_hdr=no
elif test x$enable_dbus != xyes; then
AC_MSG_WARN([DBus support is required for IBus.])
have_ibus_ibus_h_hdr=no
elif test x$have_inotify_inotify_h_hdr != xyes; then
@@ -2296,6 +2311,38 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
fi
}
dnl See if the platform has fcitx IME support.
CheckFcitx()
{
AC_ARG_ENABLE(fcitx,
AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
, enable_fcitx=yes)
if test x$enable_fcitx = xyes; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x$PKG_CONFIG != xno; then
FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
CFLAGS="$CFLAGS $FCITX_CFLAGS"
AC_CHECK_HEADER(fcitx/frontend.h,
have_fcitx_frontend_h_hdr=yes,
have_fcitx_frontend_h_hdr=no)
CFLAGS="$save_CFLAGS"
if test x$have_fcitx_frontend_h_hdr = xyes; then
if test x$enable_ime != xyes; then
AC_MSG_WARN([IME support is required for fcitx.])
have_fcitx_frontend_h_hdr=no
elif test x$enable_dbus != xyes; then
AC_MSG_WARN([DBus support is required for fcitx.])
have_fcitx_frontend_h_hdr=no
else
AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
fi
fi
fi
fi
}
dnl See if we can use the Touchscreen input library
CheckTslib()
{
@@ -2924,7 +2971,9 @@ case "$host" in
CheckWayland
CheckLibUDev
CheckDBus
CheckIME
CheckIBus
CheckFcitx
case $ARCH in
linux)
CheckInputEvents
@@ -3679,11 +3728,21 @@ if test x$have_dbus_dbus_h_hdr = xyes; then
else
SUMMARY="${SUMMARY}Using dbus : NO\n"
fi
if test x$enable_ime = xyes; then
SUMMARY="${SUMMARY}Using ime : YES\n"
else
SUMMARY="${SUMMARY}Using ime : NO\n"
fi
if test x$have_ibus_ibus_h_hdr = xyes; then
SUMMARY="${SUMMARY}Using ibus : YES\n"
else
SUMMARY="${SUMMARY}Using ibus : NO\n"
fi
if test x$have_fcitx_frontend_h_hdr = xyes; then
SUMMARY="${SUMMARY}Using fcitx : YES\n"
else
SUMMARY="${SUMMARY}Using fcitx : NO\n"
fi
AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
AC_OUTPUT