*** empty log message ***
authorpcg <pcg>
Thu, 18 Dec 2003 00:29:29 +0000 (00:29 +0000)
committerpcg <pcg>
Thu, 18 Dec 2003 00:29:29 +0000 (00:29 +0000)
src/command.C
src/init.C
src/main.C
src/rxvt.h
src/xdefaults.C

index ce773a355d25c4c51d18faa21fda44404d0258b5..148ae97bc45b606a36f339d1918316a91c44a0ba 100644 (file)
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:       command.c
  *----------------------------------------------------------------------*
- * $Id: command.C,v 1.16 2003-12-17 09:00:35 pcg Exp $
+ * $Id: command.C,v 1.17 2003-12-18 00:29:29 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -90,19 +90,31 @@ rxvt_lookup_key(pR_ XKeyEvent *ev)
        Status status_return;
 
 #ifdef X_HAVE_UTF8_STRING
-       len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf,
-                             KBUFSZ, &keysym, &status_return);
+       len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf,
+                                KBUFSZ, &keysym, &status_return);
 #else
-       len = XmbLookupString(R->Input_Context, ev, (char *)kbuf,
-                             KBUFSZ, &keysym, &status_return);
+        wchar_t wkbuf[KBUFSZ + 1];
+
+        // assume wchar_t == unicode or better
+       len = XwcLookupString (R->Input_Context, ev, wkbuf,
+                              KBUFSZ, &keysym, &status_return);
+
+        if (status_return == XLookupChars
+            || status_return == XLookupBoth)
+          {
+            wkbuf[len] = 0;
+            len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ);
+          }
+        else
+          len = 0;
 #endif
-       valid_keysym = ((status_return == XLookupKeySym)
-                       || (status_return == XLookupBoth));
+       valid_keysym = status_return == XLookupKeySym
+                      || status_return == XLookupBoth;
       }
     else
 #endif
       {
-       len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose);
+       len = XLookupString (ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose);
        valid_keysym = !len;
       }
 
index c181a8e87a279690e733b580ca8b654db82859f6..d406bc115a3b79f84bf6276e266a564445f39e41 100644 (file)
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:        init.c
  *----------------------------------------------------------------------*
- * $Id: init.C,v 1.11 2003-12-17 09:00:35 pcg Exp $
+ * $Id: init.C,v 1.12 2003-12-18 00:29:29 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -457,7 +457,7 @@ rxvt_init_secondary (pR)
     }
 
 #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
-  R->locale = setlocale (LC_CTYPE, "");
+  R->locale = strdup (setlocale (LC_CTYPE, ""));
 #endif
 
   /*
index 64e61a3618b14c95826998d0639aad97c3b30aa5..87d9987b4ff5ef12717e78cab8b9839605e0bdea 100644 (file)
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:        main.c
  *----------------------------------------------------------------------*
- * $Id: main.C,v 1.13 2003-12-17 09:00:35 pcg Exp $
+ * $Id: main.C,v 1.14 2003-12-18 00:29:29 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -79,6 +79,9 @@ rxvt_term::~rxvt_term ()
 {
   scr_release ();
 
+#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
+  free (locale);
+#endif
 #ifndef NO_SETOWNER_TTYDEV
   rxvt_privileged_ttydev (this, RESTORE);
 #endif
@@ -1133,6 +1136,11 @@ rxvt_IMInstantiateCallback(Display * unused
   if (R->Input_Context)
     return;
 
+#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
+  if (R->rs[Rs_imLocale])
+    setlocale (LC_CTYPE, R->rs[Rs_imLocale]);
+#endif
+
   p = R->rs[Rs_inputMethod];
   if (p && *p)
     {
@@ -1158,18 +1166,24 @@ rxvt_IMInstantiateCallback(Display * unused
       free(s);
 
       if (found)
-        return;
+        goto done;
     }
 
 /* try with XMODIFIERS env. var. */
   if ((p = XSetLocaleModifiers ("")) && *p
       && rxvt_IM_get_IC (aR))
-    return;
+    goto done;
 
 /* try with no modifiers base IF the user didn't specify an IM */
   if ((p = XSetLocaleModifiers ("@im=none")) && *p
       && rxvt_IM_get_IC (aR) == True)
-    return;
+    goto done;
+
+done:
+#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
+  if (R->rs[Rs_imLocale])
+    setlocale (LC_CTYPE, R->locale);
+#endif
 }
 
 /*
index 475eaae9e310be984dd7dfb370fab91b6fae165b..9468e73c181bec42f82e8b42ee55d88816f1647f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rxvt.h,v 1.12 2003-12-17 09:00:35 pcg Exp $
+ * $Id: rxvt.h,v 1.13 2003-12-18 00:29:29 pcg Exp $
  */
 
 #ifndef _RXVT_H_                /* include once only */
@@ -554,6 +554,7 @@ enum {
   Rs_cursorBlink,
   Rs_pointerBlank,
   Rs_pointerBlankDelay,
+  Rs_imLocale,
   NUM_RESOURCES
 };
 
index 44c989e792d9196efd57b8b7c569f59b1198f3ef..07559ede91721ba29f0bfd2ad94a0445063d6944 100644 (file)
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:       xdefaults.c
  *----------------------------------------------------------------------*
- * $Id: xdefaults.C,v 1.4 2003-12-17 09:00:35 pcg Exp $
+ * $Id: xdefaults.C,v 1.5 2003-12-18 00:29:29 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1994      Robert Nation <nation@rocket.sanders.lockheed.com>
@@ -200,6 +200,9 @@ static const struct {
     STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method"),
     STRG(Rs_preeditType, "preeditType", "pt", "style",
         "input style: style = OverTheSpot|OffTheSpot|Root"),
+#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
+    STRG(Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"),
+#endif
 #endif                         /* USE_XIM */
 #ifdef GREEK_SUPPORT
     STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode",