*/}}
1
0
فهرست منبع

IME modifier handling (hopefully ic!=0 now)

YimingWu 11 ماه پیش
والد
کامیت
85a510700f
1فایلهای تغییر یافته به همراه20 افزوده شده و 3 حذف شده
  1. 20 3
      la_kernel.c

+ 20 - 3
la_kernel.c

@@ -210,9 +210,27 @@ SYSWINDOW la_CreateWindowX11(int x, int y, int w, int h, char *title, int SyncTo
     int sync=SyncToVBlank?1:0; glXSwapIntervalEXTF(MAIN.dpy, win, sync);
 #endif
 
+    XSetLocaleModifiers("");
     MAIN.im = XOpenIM(MAIN.dpy, NULL, NULL, NULL);
-    MAIN.ic = XCreateIC(MAIN.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, NULL);
-    XSetICFocus(MAIN.ic);
+    if(!MAIN.im){
+        XSetLocaleModifiers("@im=local");
+        MAIN.im = XOpenIM(MAIN.dpy, NULL, NULL, NULL);
+    }
+    if(!MAIN.im){
+        XSetLocaleModifiers("@im=none");
+        MAIN.im = XOpenIM(MAIN.dpy, NULL, NULL, NULL);
+    }
+    if(!MAIN.im){
+        XSetLocaleModifiers("@im=");
+        MAIN.im = XOpenIM(MAIN.dpy, NULL, NULL, NULL);
+    }
+    if(!MAIN.im){
+        logPrint("Can't open a input method.\n");
+    }
+    if(MAIN.im){
+        MAIN.ic = XCreateIC(MAIN.im, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, NULL);
+        XSetICFocus(MAIN.ic);
+    }
 
     XClassHint ch; ch.res_name = "LAGUI_WINDOW"; ch.res_class = "LAGUI_WINDOW";
     XSetClassHint(MAIN.dpy, win, &ch);
@@ -865,7 +883,6 @@ int laGetReadyWith(laInitArguments* ia){
     logPrintNew("Initializing LaGUI...\n");
 
     setlocale(LC_CTYPE, "zh_CN.utf8");
-    XSetLocaleModifiers("");
 
     XSetErrorHandler(la_XErrorHandler);