Avoid XCreateIC failures
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 7 Jun 2015 20:24:47 +0000 (16:24 -0400)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 7 Jun 2015 20:24:47 +0000 (16:24 -0400)
      * src/mule/input-method-xlib.c(XIM_init_frame): Do not specify
        XNStatusAttributes unless there is a XIMStatusArea.  Some XIM
        implementations are very sensitive to this (ibus is one
        example).

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/mule/input-method-xlib.c

index e522627..788ec95 100644 (file)
@@ -377,23 +377,32 @@ XIM_init_frame (struct frame *f)
                                      XNFontSet,      xic_vars.fontset,
                                      NULL);
 
-       s_list = XVaCreateNestedList (0,
-                                     XNArea,         &s_area,
-                                     XNForeground,   xic_vars.fg,
-                                     XNBackground,   xic_vars.bg,
-                                     XNFontSet,      xic_vars.fontset,
-                                     NULL);
-
-       FRAME_X_XIC (f) = xic =
-               XCreateIC (xim,
-                          XNInputStyle, style,
-                          XNClientWindow, win,
-                          XNFocusWindow, win,
-                          XNPreeditAttributes, p_list,
-                          XNStatusAttributes, s_list,
-                          NULL);
-       XFree (p_list);
-       XFree (s_list);
+        if (style & XIMStatusArea) {
+                s_list = XVaCreateNestedList (0,
+                                              XNArea,         &s_area,
+                                              XNForeground,   xic_vars.fg,
+                                              XNBackground,   xic_vars.bg,
+                                              XNFontSet,      xic_vars.fontset,
+                                              NULL);
+                FRAME_X_XIC (f) = xic =
+                        XCreateIC (xim,
+                                   XNInputStyle, style,
+                                   XNClientWindow, win,
+                                   XNFocusWindow, win,
+                                   XNPreeditAttributes, p_list,
+                                   XNStatusAttributes, s_list,
+                                   NULL);
+                XFree (s_list);
+        } else {
+                FRAME_X_XIC (f) = xic =
+                        XCreateIC (xim,
+                                   XNInputStyle, style,
+                                   XNClientWindow, win,
+                                   XNFocusWindow, win,
+                                   XNPreeditAttributes, p_list,
+                                   NULL);
+        }
+        XFree (p_list);
 
        if (!xic) {
                char *lang = getenv("LANG");