refactor(platform): update ime selection in the linux
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <LCUI_Build.h>
+
+#ifdef LCUI_BUILD_IN_LINUX
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <LCUI_Build.h>
-
-#ifdef LCUI_BUILD_IN_LINUX
#include <LCUI/LCUI.h>
#include <LCUI/input.h>
#include <LCUI/gui/widget.h>
#include <LCUI/platform.h>
#include LCUI_EVENTS_H
+#ifdef LCUI_VIDEO_DRIVER_X11
static LCUI_BOOL X11IME_ProcessKey(int key, int key_state)
{
return LCUIIME_CheckCharKey(key);
@@ -64,18 +65,20 @@ static LCUI_BOOL X11IME_Close( void )
{
return TRUE;
}
+#endif
int LCUI_RegisterLinuxIME(void)
{
LCUI_IMEHandlerRec handler;
- LCUI_BOOL is_x11_mode = TRUE;
- if( is_x11_mode ) {
+#ifdef LCUI_VIDEO_DRIVER_X11
+ if (LCUI_GetAppId() == LCUI_APP_LINUX_X11) {
handler.prockey = X11IME_ProcessKey;
handler.totext = X11IME_ToText;
handler.close = X11IME_Close;
handler.open = X11IME_Open;
- return LCUIIME_Register( "LCUI Input Method", &handler );
+ return LCUIIME_Register("LCUI X11 Input Method", &handler);
}
+#endif
return -1;
}
