mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-23 07:45:38 +08:00
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:
@@ -849,7 +849,9 @@ enable_video_opengles1
|
||||
enable_video_opengles2
|
||||
enable_libudev
|
||||
enable_dbus
|
||||
enable_ime
|
||||
enable_ibus
|
||||
enable_fcitx
|
||||
enable_input_tslib
|
||||
enable_pthreads
|
||||
enable_pthread_sem
|
||||
@@ -1587,7 +1589,9 @@ Optional Features:
|
||||
include OpenGL ES 2.0 support [[default=yes]]
|
||||
--enable-libudev enable libudev support [[default=yes]]
|
||||
--enable-dbus enable D-Bus support [[default=yes]]
|
||||
--enable-ime enable IME support [[default=yes]]
|
||||
--enable-ibus enable IBus support [[default=yes]]
|
||||
--enable-fcitx enable fcitx support [[default=yes]]
|
||||
--enable-input-tslib use the Touchscreen library for input
|
||||
[[default=yes]]
|
||||
--enable-pthreads use POSIX threads for multi-threading
|
||||
@@ -21650,6 +21654,23 @@ $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h
|
||||
fi
|
||||
}
|
||||
|
||||
CheckIME()
|
||||
{
|
||||
# Check whether --enable-ime was given.
|
||||
if test "${enable_ime+set}" = set; then :
|
||||
enableval=$enable_ime;
|
||||
else
|
||||
enable_ime=yes
|
||||
fi
|
||||
|
||||
if test x$enable_ime = xyes; then
|
||||
|
||||
$as_echo "#define SDL_USE_IME 1" >>confdefs.h
|
||||
|
||||
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
|
||||
fi
|
||||
}
|
||||
|
||||
CheckIBus()
|
||||
{
|
||||
# Check whether --enable-ibus was given.
|
||||
@@ -21723,7 +21744,11 @@ fi
|
||||
|
||||
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
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5
|
||||
$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;}
|
||||
have_ibus_ibus_h_hdr=no
|
||||
elif test x$enable_dbus != xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5
|
||||
$as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;}
|
||||
have_ibus_ibus_h_hdr=no
|
||||
@@ -21743,6 +21768,90 @@ $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h
|
||||
fi
|
||||
}
|
||||
|
||||
CheckFcitx()
|
||||
{
|
||||
# Check whether --enable-fcitx was given.
|
||||
if test "${enable_fcitx+set}" = set; then :
|
||||
enableval=$enable_fcitx;
|
||||
else
|
||||
enable_fcitx=yes
|
||||
fi
|
||||
|
||||
if test x$enable_fcitx = xyes; then
|
||||
# Extract the first word of "pkg-config", so it can be a program name with args.
|
||||
set dummy pkg-config; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PKG_CONFIG+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $PKG_CONFIG in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
|
||||
$as_echo "$PKG_CONFIG" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
if test x$PKG_CONFIG != xno; then
|
||||
FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
|
||||
CFLAGS="$CFLAGS $FCITX_CFLAGS"
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_fcitx_frontend_h" = xyes; then :
|
||||
have_fcitx_frontend_h_hdr=yes
|
||||
else
|
||||
have_fcitx_frontend_h_hdr=no
|
||||
fi
|
||||
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
if test x$have_fcitx_frontend_h_hdr = xyes; then
|
||||
if test x$enable_ime != xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5
|
||||
$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;}
|
||||
have_fcitx_frontend_h_hdr=no
|
||||
elif test x$enable_dbus != xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5
|
||||
$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;}
|
||||
have_fcitx_frontend_h_hdr=no
|
||||
else
|
||||
|
||||
$as_echo "#define HAVE_FCITX_FRONTEND_H 1" >>confdefs.h
|
||||
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
|
||||
SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
CheckTslib()
|
||||
{
|
||||
# Check whether --enable-input-tslib was given.
|
||||
@@ -23031,7 +23140,9 @@ case "$host" in
|
||||
CheckWayland
|
||||
CheckLibUDev
|
||||
CheckDBus
|
||||
CheckIME
|
||||
CheckIBus
|
||||
CheckFcitx
|
||||
case $ARCH in
|
||||
linux)
|
||||
CheckInputEvents
|
||||
@@ -23944,11 +24055,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="$ac_config_commands summary"
|
||||
|
||||
|
||||
|
||||
+60
-1
@@ -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
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
#undef HAVE_LIBUDEV_H
|
||||
#undef HAVE_DBUS_DBUS_H
|
||||
#undef HAVE_IBUS_IBUS_H
|
||||
#undef HAVE_FCITX_FRONTEND_H
|
||||
|
||||
/* C library functions */
|
||||
#undef HAVE_MALLOC
|
||||
@@ -356,4 +357,7 @@
|
||||
#undef SDL_ASSEMBLY_ROUTINES
|
||||
#undef SDL_ALTIVEC_BLITTERS
|
||||
|
||||
/* Enable ime support */
|
||||
#undef SDL_USE_IME
|
||||
|
||||
#endif /* _SDL_config_h */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_fcitx_h
|
||||
#define _SDL_fcitx_h
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_rect.h"
|
||||
|
||||
extern SDL_bool SDL_Fcitx_Init(void);
|
||||
extern void SDL_Fcitx_Quit(void);
|
||||
extern void SDL_Fcitx_SetFocus(SDL_bool focused);
|
||||
extern void SDL_Fcitx_Reset(void);
|
||||
extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
|
||||
extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect);
|
||||
extern void SDL_Fcitx_PumpEvents();
|
||||
|
||||
#endif /* _SDL_fcitx_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "SDL_ime.h"
|
||||
#include "SDL_ibus.h"
|
||||
#include "SDL_fcitx.h"
|
||||
|
||||
typedef SDL_bool (*_SDL_IME_Init)();
|
||||
typedef void (*_SDL_IME_Quit)();
|
||||
typedef void (*_SDL_IME_SetFocus)(SDL_bool);
|
||||
typedef void (*_SDL_IME_Reset)();
|
||||
typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32);
|
||||
typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *);
|
||||
typedef void (*_SDL_IME_PumpEvents)();
|
||||
|
||||
static _SDL_IME_Init SDL_IME_Init_Real = NULL;
|
||||
static _SDL_IME_Quit SDL_IME_Quit_Real = NULL;
|
||||
static _SDL_IME_SetFocus SDL_IME_SetFocus_Real = NULL;
|
||||
static _SDL_IME_Reset SDL_IME_Reset_Real = NULL;
|
||||
static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL;
|
||||
static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL;
|
||||
static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL;
|
||||
|
||||
static void
|
||||
InitIME()
|
||||
{
|
||||
static SDL_bool inited = SDL_FALSE;
|
||||
const char *im_module = NULL;
|
||||
|
||||
if (inited == SDL_TRUE)
|
||||
return ;
|
||||
|
||||
inited = SDL_TRUE;
|
||||
// TODO:
|
||||
// better move every ime implenment to a shared library
|
||||
|
||||
// default to IBus
|
||||
#ifdef HAVE_IBUS_IBUS_H
|
||||
SDL_IME_Init_Real = SDL_IBus_Init;
|
||||
SDL_IME_Quit_Real = SDL_IBus_Quit;
|
||||
SDL_IME_SetFocus_Real = SDL_IBus_SetFocus;
|
||||
SDL_IME_Reset_Real = SDL_IBus_Reset;
|
||||
SDL_IME_ProcessKeyEvent_Real = SDL_IBus_ProcessKeyEvent;
|
||||
SDL_IME_UpdateTextRect_Real = SDL_IBus_UpdateTextRect;
|
||||
SDL_IME_PumpEvents_Real = SDL_IBus_PumpEvents;
|
||||
#endif
|
||||
|
||||
im_module = SDL_getenv("SDL_IM_MODULE");
|
||||
if (im_module) {
|
||||
if (SDL_strcmp(im_module, "fcitx") == 0) {
|
||||
#ifdef HAVE_FCITX_FRONTEND_H
|
||||
SDL_IME_Init_Real = SDL_Fcitx_Init;
|
||||
SDL_IME_Quit_Real = SDL_Fcitx_Quit;
|
||||
SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus;
|
||||
SDL_IME_Reset_Real = SDL_Fcitx_Reset;
|
||||
SDL_IME_ProcessKeyEvent_Real = SDL_Fcitx_ProcessKeyEvent;
|
||||
SDL_IME_UpdateTextRect_Real = SDL_Fcitx_UpdateTextRect;
|
||||
SDL_IME_PumpEvents_Real = SDL_Fcitx_PumpEvents;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IME_Init(void)
|
||||
{
|
||||
InitIME();
|
||||
|
||||
if (SDL_IME_Init_Real)
|
||||
return SDL_IME_Init_Real();
|
||||
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_IME_Quit(void)
|
||||
{
|
||||
if (SDL_IME_Quit_Real)
|
||||
SDL_IME_Quit_Real();
|
||||
}
|
||||
|
||||
void
|
||||
SDL_IME_SetFocus(SDL_bool focused)
|
||||
{
|
||||
if (SDL_IME_SetFocus_Real)
|
||||
SDL_IME_SetFocus_Real(focused);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_IME_Reset(void)
|
||||
{
|
||||
if (SDL_IME_Reset_Real)
|
||||
SDL_IME_Reset_Real();
|
||||
}
|
||||
|
||||
SDL_bool
|
||||
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode)
|
||||
{
|
||||
if (SDL_IME_ProcessKeyEvent_Real)
|
||||
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode);
|
||||
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_IME_UpdateTextRect(SDL_Rect *rect)
|
||||
{
|
||||
if (SDL_IME_UpdateTextRect_Real)
|
||||
SDL_IME_UpdateTextRect_Real(rect);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_IME_PumpEvents()
|
||||
{
|
||||
if (SDL_IME_PumpEvents_Real)
|
||||
SDL_IME_PumpEvents_Real();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _SDL_ime_h
|
||||
#define _SDL_ime_h
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_rect.h"
|
||||
|
||||
extern SDL_bool SDL_IME_Init();
|
||||
extern void SDL_IME_Quit();
|
||||
extern void SDL_IME_SetFocus(SDL_bool focused);
|
||||
extern void SDL_IME_Reset();
|
||||
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
|
||||
extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
|
||||
extern void SDL_IME_PumpEvents();
|
||||
|
||||
#endif /* _SDL_ime_h */
|
||||
@@ -380,8 +380,8 @@ X11_DispatchFocusIn(_THIS, SDL_WindowData *data)
|
||||
X11_XSetICFocus(data->ic);
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_SetFocus(SDL_TRUE);
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_SetFocus(SDL_TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -403,8 +403,8 @@ X11_DispatchFocusOut(_THIS, SDL_WindowData *data)
|
||||
X11_XUnsetICFocus(data->ic);
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_SetFocus(SDL_FALSE);
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_SetFocus(SDL_FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -786,9 +786,9 @@ X11_DispatchEvent(_THIS)
|
||||
X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef SDL_USE_IBUS
|
||||
#ifdef SDL_USE_IME
|
||||
if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
|
||||
handled_by_ime = SDL_IBus_ProcessKeyEvent(keysym, keycode);
|
||||
handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode);
|
||||
}
|
||||
#endif
|
||||
if (!handled_by_ime) {
|
||||
@@ -860,10 +860,10 @@ X11_DispatchEvent(_THIS)
|
||||
xevent.xconfigure.y != data->last_xconfigure.y) {
|
||||
SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
|
||||
xevent.xconfigure.x, xevent.xconfigure.y);
|
||||
#ifdef SDL_USE_IBUS
|
||||
#ifdef SDL_USE_IME
|
||||
if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
|
||||
/* Update IBus candidate list position */
|
||||
SDL_IBus_UpdateTextRect(NULL);
|
||||
/* Update IME candidate list position */
|
||||
SDL_IME_UpdateTextRect(NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1408,9 +1408,9 @@ X11_PumpEvents(_THIS)
|
||||
X11_DispatchEvent(_this);
|
||||
}
|
||||
|
||||
#ifdef SDL_USE_IBUS
|
||||
#ifdef SDL_USE_IME
|
||||
if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
|
||||
SDL_IBus_PumpEvents();
|
||||
SDL_IME_PumpEvents();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -339,8 +339,8 @@ X11_InitKeyboard(_THIS)
|
||||
|
||||
SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu");
|
||||
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_Init();
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_Init();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@@ -422,8 +422,8 @@ X11_QuitKeyboard(_THIS)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_Quit();
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -436,8 +436,8 @@ X11_StartTextInput(_THIS)
|
||||
void
|
||||
X11_StopTextInput(_THIS)
|
||||
{
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_Reset();
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_Reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -449,8 +449,8 @@ X11_SetTextInputRect(_THIS, SDL_Rect *rect)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SDL_USE_IBUS
|
||||
SDL_IBus_UpdateTextRect(rect);
|
||||
#ifdef SDL_USE_IME
|
||||
SDL_IME_UpdateTextRect(rect);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#endif
|
||||
|
||||
#include "../../core/linux/SDL_dbus.h"
|
||||
#include "../../core/linux/SDL_ibus.h"
|
||||
#include "../../core/linux/SDL_ime.h"
|
||||
|
||||
#include "SDL_x11dyn.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user