/*--------------------------------*-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>
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;
}
/*--------------------------------*-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>
}
#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
- R->locale = setlocale (LC_CTYPE, "");
+ R->locale = strdup (setlocale (LC_CTYPE, ""));
#endif
/*
/*--------------------------------*-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>
{
scr_release ();
+#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
+ free (locale);
+#endif
#ifndef NO_SETOWNER_TTYDEV
rxvt_privileged_ttydev (this, RESTORE);
#endif
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)
{
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
}
/*
/*
- * $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 */
Rs_cursorBlink,
Rs_pointerBlank,
Rs_pointerBlankDelay,
+ Rs_imLocale,
NUM_RESOURCES
};
/*--------------------------------*-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>
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",