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

@@ -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

View File

@@ -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
}

View File

@@ -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"