*** empty log message ***
authorroot <root>
Sun, 21 Nov 2004 19:04:07 +0000 (19:04 +0000)
committerroot <root>
Sun, 21 Nov 2004 19:04:07 +0000 (19:04 +0000)
src/main.C
src/misc.C
src/rxvt.h

index d650d9f..20a4d2f 100644 (file)
@@ -357,7 +357,7 @@ rxvt_term::init (int argc, const char *const *argv)
 
   scr_reset ();         /* initialize screen */
 
-#if 0
+#if 1
   XSynchronize (display->display, True);
 #endif
 
@@ -1301,32 +1301,44 @@ rxvt_term::IM_get_IC (const char *modifiers)
       return false;
     }
 
-  p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root,None";
-  s = rxvt_splitcommastring (p);
+  const char *pet[] = { rs[Rs_preeditType], "OverTheSpot,OffTheSpot,Root,None" };
 
-  for (i = found = 0; !found && s[i]; i++)
+  for (int pi = 0; pi < 2; pi++)
     {
-      if (!strcmp (s[i], "OverTheSpot"))
-        input_style = (XIMPreeditPosition | XIMStatusNothing);
-      else if (!strcmp (s[i], "OffTheSpot"))
-        input_style = (XIMPreeditArea | XIMStatusArea);
-      else if (!strcmp (s[i], "Root"))
-        input_style = (XIMPreeditNothing | XIMStatusNothing);
-      else if (!strcmp (s[i], "None"))
-        input_style = (XIMPreeditNone | XIMStatusNone);
-
-      for (j = 0; j < xim_styles->count_styles; j++)
-        if (input_style == xim_styles->supported_styles[j])
-          {
-            found = 1;
-            break;
-          }
+      p = pet[pi];
+
+      if (!p)
+        continue;
+
+      s = rxvt_splitcommastring (p);
+
+      for (i = found = 0; !found && s[i]; i++)
+        {
+          if (!strcmp (s[i], "OverTheSpot"))
+            input_style = (XIMPreeditPosition | XIMStatusNothing);
+          else if (!strcmp (s[i], "OffTheSpot"))
+            input_style = (XIMPreeditArea | XIMStatusArea);
+          else if (!strcmp (s[i], "Root"))
+            input_style = (XIMPreeditNothing | XIMStatusNothing);
+          else if (!strcmp (s[i], "None"))
+            input_style = (XIMPreeditNone | XIMStatusNone);
+
+          for (j = 0; j < xim_styles->count_styles; j++)
+            if (input_style == xim_styles->supported_styles[j])
+              {
+                rxvt_freecommastring (s);
+
+                found = 1;
+                goto foundpet;
+              }
+
+        }
+
+      rxvt_freecommastring (s);
     }
 
-  for (i = 0; s[i]; i++)
-    free (s[i]);
+foundpet:
 
-  free (s);
   XFree (xim_styles);
 
   if (!found)
@@ -1461,6 +1473,7 @@ rxvt_term::im_cb ()
       bool found = false;
 
       s = rxvt_splitcommastring (p);
+
       for (i = 0; s[i]; i++)
         {
           if (*s[i])
@@ -1474,9 +1487,8 @@ rxvt_term::im_cb ()
                 }
             }
         }
-      for (i = 0; s[i]; i++)
-        free (s[i]);
-      free (s);
+
+      rxvt_freecommastring (s);
 
       if (found)
         goto done;
index fd431e1..440bc08 100644 (file)
@@ -322,6 +322,15 @@ rxvt_splitcommastring (const char *cs)
   return ret;
 }
 
+void
+rxvt_freecommastring (char **cs)
+{
+  for (int i = 0; cs[i]; ++i)
+    free (cs[i]);
+
+  free (cs);
+}
+
 /*----------------------------------------------------------------------*
  * file searching
  */
index a661337..600ce5f 100644 (file)
@@ -101,6 +101,7 @@ const char *     rxvt_Str_skip_space              (const char *str);
 char           * rxvt_Str_trim                    (char *str);
 int              rxvt_Str_escaped                 (char *str);
 char          ** rxvt_splitcommastring            (const char *cs);
+void             rxvt_freecommastring             (char **cs);
 char           * rxvt_File_find                   (const char *file, const char *ext, const char *path);
 void             rxvt_Draw_Shadow                 (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h);
 void             rxvt_Draw_Triangle               (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type);