solaris-kbd.patch revision 1294
03831d35f7499c87d51205817c93e9a8d42c4baestevel###############################################################################
03831d35f7499c87d51205817c93e9a8d42c4baestevel# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel# Permission is hereby granted, free of charge, to any person obtaining a
03831d35f7499c87d51205817c93e9a8d42c4baestevel# copy of this software and associated documentation files (the "Software"),
03831d35f7499c87d51205817c93e9a8d42c4baestevel# to deal in the Software without restriction, including without limitation
03831d35f7499c87d51205817c93e9a8d42c4baestevel# the rights to use, copy, modify, merge, publish, distribute, sublicense,
03831d35f7499c87d51205817c93e9a8d42c4baestevel# and/or sell copies of the Software, and to permit persons to whom the
03831d35f7499c87d51205817c93e9a8d42c4baestevel# Software is furnished to do so, subject to the following conditions:
03831d35f7499c87d51205817c93e9a8d42c4baestevel# The above copyright notice and this permission notice (including the next
03831d35f7499c87d51205817c93e9a8d42c4baestevel# paragraph) shall be included in all copies or substantial portions of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
03831d35f7499c87d51205817c93e9a8d42c4baestevel# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
03831d35f7499c87d51205817c93e9a8d42c4baestevel# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
03831d35f7499c87d51205817c93e9a8d42c4baestevel# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
03831d35f7499c87d51205817c93e9a8d42c4baestevel# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
03831d35f7499c87d51205817c93e9a8d42c4baestevel# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
03831d35f7499c87d51205817c93e9a8d42c4baestevel# DEALINGS IN THE SOFTWARE.
03831d35f7499c87d51205817c93e9a8d42c4baestevelindex 221cedd..732c0cf 100644
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
03831d35f7499c87d51205817c93e9a8d42c4baestevel #define XK_VIETNAMESE
03831d35f7499c87d51205817c93e9a8d42c4baestevel #define XK_XKB_KEYS
03831d35f7499c87d51205817c93e9a8d42c4baestevel #define XK_SINHALA
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define XK_CURRENCY
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -56,6 +57,20 @@ in this Software without prior written authorization from The Open Group.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* Sun: compose sequence support
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * (state = chars_matched in XComposeStatus)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define REJECTED -1
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define START 0
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define ACCEPTED1 1
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define ACCEPTED2 2
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define ACCEPTED3 3
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define COMPOSE_LED 2
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -77,6 +92,11 @@ ComputeMaskFromKeytrans(
03831d35f7499c87d51205817c93e9a8d42c4baestevel Display *dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel register struct _XKeytrans *p);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+static int DoCompose();
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ void SetLed (Display *dpy, int num, int state);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct _XKeytrans {
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct _XKeytrans *next;/* next on list */
03831d35f7499c87d51205817c93e9a8d42c4baestevel char *string; /* string to return when the time comes */
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -98,6 +118,10 @@ KeyCodetoKeySym(register Display *dpy, KeyCode keycode, int col)
03831d35f7499c87d51205817c93e9a8d42c4baestevel ((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode))
03831d35f7499c87d51205817c93e9a8d42c4baestevel return NoSymbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* Sun comment: We need not protect dpy->keysyms[], because,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * this is * changed only in the initialize routine and
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * XOpenDisplay().
03831d35f7499c87d51205817c93e9a8d42c4baestevel syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per];
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (col < 4) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (col > 1) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -766,6 +790,9 @@ _XTranslateKey( register Display *dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel register KeySym *syms;
03831d35f7499c87d51205817c93e9a8d42c4baestevel KeySym sym, lsym, usym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int i, column, KeypadKey;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((! dpy->keysyms) && (! _XKeyInitialize(dpy)))
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -780,17 +807,54 @@ _XTranslateKey( register Display *dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per];
03831d35f7499c87d51205817c93e9a8d42c4baestevel while ((per > 2) && (syms[per - 1] == NoSymbol))
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* Sun: Japanese keypad support */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeypadKey = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (per < 5)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* in case of Hobo keyboards, the keypad would be
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * superimposed on the other (qwerty) keys. So by doing
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * this * check, we would not get the Japanese keysyms
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * on the * Hobo keypad superimposed keys.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ for (i=0; i < per; i++)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (IsKeypadKey(syms[i]))
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeypadKey = 1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((per > 2) && (modifiers & dpy->mode_switch)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* Sun: ModeSwitch does not apply to function keys (Japanese kbd) */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (!KeypadKey)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if ((modifiers & dpy->num_lock) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (per > 1 && (IsKeypadKey(syms[2]) ))) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((modifiers & dpy->num_lock) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((modifiers & ShiftMask) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel ((modifiers & LockMask) && (dpy->lock_meaning == XK_Shift_Lock)))
03831d35f7499c87d51205817c93e9a8d42c4baestevel *keysym_return = syms[0];
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym_return = syms[2];
03831d35f7499c87d51205817c93e9a8d42c4baestevel *keysym_return = syms[1];
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel } else if (!(modifiers & ShiftMask) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((per == 1) || (syms[1] == NoSymbol))
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -818,19 +882,41 @@ _XTranslateKey( register Display *dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel _XTranslateKeySym(
03831d35f7499c87d51205817c93e9a8d42c4baestevel- Display *dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- register KeySym symbol,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- unsigned int modifiers,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- char *buffer,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- int nbytes)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ Display * dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ register KeySym * keysym,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ register KeySym keysym,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ unsigned int modifiers,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ char * buffer,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int nbytes
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyEvent * event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus * status
03831d35f7499c87d51205817c93e9a8d42c4baestevel register struct _XKeytrans *p;
03831d35f7499c87d51205817c93e9a8d42c4baestevel int length;
03831d35f7499c87d51205817c93e9a8d42c4baestevel unsigned long hiBytes;
03831d35f7499c87d51205817c93e9a8d42c4baestevel register unsigned char c;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym symbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int return_val;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (!keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ symbol = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (!symbol)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* see if symbol rebound, if so, return that string. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (p = dpy->key_bindings; p; p = p->next) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (((modifiers & AllMods) == p->state) && (symbol == p->key)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -844,8 +930,29 @@ _XTranslateKeySym(
03831d35f7499c87d51205817c93e9a8d42c4baestevel hiBytes = symbol >> 8;
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (!(nbytes &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel ((hiBytes == 0) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* The check for 0x100500 <= hiBytes < 0x100600 is Sun-specific.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * This represents Sun's registered range of vendor-specific
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * keysyms. We need the check so that Sun specific keysyms will
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * pass through this check and onto to be handled by
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * HandleComposeSequence.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ((0x100500 <= hiBytes) && (hiBytes < 0x100600)) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * The following hard-coded line is to support the euro sign for legacy apps
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * and single byte codeset locale apps with the euro sign at 0xa4.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * For any other codeset locales with properly internationalized apps,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * one must have an entry in the Compose file of the locale that will map
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * the XK_EuroSign keysym to the correct character code value of the locale's
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * codeset.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (symbol == XK_EuroSign) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel ((hiBytes == 0xFF) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (symbol == XK_Multi_key) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel (symbol == XK_Return) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel (symbol == XK_Escape) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel (symbol == XK_KP_Space) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -856,15 +963,35 @@ _XTranslateKeySym(
03831d35f7499c87d51205817c93e9a8d42c4baestevel (symbol == XK_Delete))))))
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* if this is a compose sequence, then HandleComposeSequence
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * already deals w/ this. This is Sun-specific.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (HandleComposeSequence(symbol, buffer, keysym, status, &return_val, event)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return return_val;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* if X keysym, convert to ascii by grabbing low 7 bits */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (symbol == XK_KP_Space)
03831d35f7499c87d51205817c93e9a8d42c4baestevel c = XK_space & 0x7F; /* patch encoding botch */
03831d35f7499c87d51205817c93e9a8d42c4baestevel else if (hiBytes == 0xFF)
03831d35f7499c87d51205817c93e9a8d42c4baestevel c = symbol & 0x7F;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (symbol == XK_EuroSign)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ c = (unsigned char)0xa4; /* Latin-9 euro symbol code for legacy apps. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel c = symbol & 0xFF;
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* only apply Control key if it makes sense, else ignore it */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (modifiers & ControlMask) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* Sun: map control characters with high bit set */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if ((c >= (unsigned char)'\300' && c <= (unsigned char)'\377')) c &= 0x9F;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* MIT "standard" control character handling */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
03831d35f7499c87d51205817c93e9a8d42c4baestevel else if (c == '2') c = '\000';
03831d35f7499c87d51205817c93e9a8d42c4baestevel else if (c >= '3' && c <= '7') c -= ('3' - '\033');
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -958,11 +1085,22 @@ XLookupString (
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (keysym) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = symbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return _XTranslateKeySym(event->display, keysym, event->state,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ buffer, nbytes, event, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return _XTranslateKeySym(event->display, &symbol, event->state,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ buffer, nbytes, event, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel *keysym = symbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* arguable whether to use (event->state & ~modifiers) here */
03831d35f7499c87d51205817c93e9a8d42c4baestevel return _XTranslateKeySym(event->display, symbol, event->state,
03831d35f7499c87d51205817c93e9a8d42c4baestevel buffer, nbytes);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel static void
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -1076,3 +1214,290 @@ ComputeMaskFromKeytrans(
03831d35f7499c87d51205817c93e9a8d42c4baestevel p->state &= AllMods;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* added 2 functions:
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * HandleComposeSequence and DoCompose;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+/* Called from XTranslateKeySym & XkbTranslateKeySymExt
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * Look at compose sequence and dead key sequence and try to get
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * a Latin-1 character out of it. Return 1 if it is able to
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * resolve the lookup based on the info it has, return 0 if it
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * can't, then XTranslateKeySym needs to do further processing.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+Bool compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+int compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+HandleComposeSequence(
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym symbol,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ char *buffer,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym *keysym,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus *status,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int *return_val,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyEvent *event)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ static char compose_sequence[5]; /* initialized to NULL */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ static KeyCode last_composed_keycode; /* initialized to NULL */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ static KeySym last_composed_keysym; /* initialized to NULL */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ static char watching_keypresses = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ static int initialized = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int ret_val;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * Even if the caller doesn't pass us a compose structure, we'll still
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * support compose sequence processing. Note that the client won't be able
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * to support multiple compose sequence clients within a single application.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* must come first */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (status != (XComposeStatus *) NULL) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * The caller provided a structure so we'll track his state * (if reasonable) and we'll point him at our private
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * compose_sequence (at bottom). This allows him to implement
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * multiple compose sequence clients within a single application.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (! initialized) { /* start him out right */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ initialized = 1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* bug 4247009, vivekp, set the compose LED off very first
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ time, initialization time */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_led_is_on)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (event->display,COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ } else { /* then track him */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = status->chars_matched;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state < START || compose_state > ACCEPTED3) compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* must come second */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (event->type == KeyPress) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* if we've ever seen a KeyPress, we're watching KeyPresses */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ watching_keypresses = 1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ } else if (event->type == KeyRelease && watching_keypresses) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * don't let someone watching both KeyPresses and KeyReleases
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * screw us unwittingly. Try to return the right thing.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *return_val = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state > START) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == ACCEPTED3 && event->keycode == last_composed_keycode) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ buffer[0] = last_composed_keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = last_composed_keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *return_val = 1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(1);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if ((*keysym == XK_Multi_key) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Circum) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Tilde) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Grave) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Acute) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Cedilla) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Diaeresis))
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(1);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* XTranslateKeysym filters these out before we get here, but the
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * XKB version doesn't so we need to punt these here to avoid breaking
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * compose sequences when modifiers like the shift key are pressed.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (IsModifierKey(*keysym)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return (0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == ACCEPTED3)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* now we're ready */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ switch (compose_state) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ case START:
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (*keysym == XK_Multi_key) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* bug 4247009, vivekp, set the compose LED when the
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose key is pressed first time. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (event->display,COMPOSE_LED, LedModeOn);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = True;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Circum) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '^';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Tilde) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '~';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Grave) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '`';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Acute) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '\'';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Cedilla) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = ',';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ else if (*keysym == SunXK_FA_Diaeresis){
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '"';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* else don't change state */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ case ACCEPTED1: /* Got Compose last time */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (*keysym < ASCII_SET_SIZE) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_map[*keysym] >= 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED2;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = REJECTED;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = REJECTED;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ case ACCEPTED2: /* Got Compose + composable char */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* bug 4247009, vivekp, set the compose LED off after
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose+composable char is pressed. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (event->display,COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (*keysym < ASCII_SET_SIZE) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_map[*keysym] >= 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[1] = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * If the second character is space, compose sequence should return * the first character. See TBITS/NCTTI-5, Section 2.1
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * Note: <Compose>+<space>+<space> = non-breaking space
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_sequence[1] == XK_space &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] != XK_space) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = compose_sequence[0];
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED3;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_sequence[0] <= compose_sequence[1])
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret_val = DoCompose(compose_sequence[0],
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[1], keysym);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret_val = DoCompose(compose_sequence[1],
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0], keysym);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (ret_val == 1) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = ACCEPTED3;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[2] = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = REJECTED;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = REJECTED;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = REJECTED;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == REJECTED)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* bug 4247009, vivekp, set the compose LED off after the
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose key pressed second time or composable + 1st char +
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ 2nd char. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (event->display,COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_state = START;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (status != (XComposeStatus *) NULL) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * Ok, since the caller provided a compose structure,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * we need to point him at our private compose_sequence
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * and copy the new state back to him.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ status->compose_ptr = compose_sequence;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ status->chars_matched = compose_state;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == START) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[0] = '\0';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ last_composed_keycode = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ last_composed_keysym = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if ((*keysym == XK_Multi_key) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Circum) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Tilde) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Grave) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Acute) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Cedilla) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ (*keysym == SunXK_FA_Diaeresis)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *return_val = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(1);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_sequence[compose_state-1] = '\0';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ last_composed_keycode = event->keycode;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ last_composed_keysym = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == ACCEPTED3) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ buffer[0] = *keysym;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *return_val = 1;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (compose_state == ACCEPTED2) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ buffer[0] = '\0';
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *return_val = 0;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return(1);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * DoCompose - put result in keysym
03831d35f7499c87d51205817c93e9a8d42c4baestevel+DoCompose(KeySym first_keysym, KeySym second_keysym, KeySym *result_keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ComposeTableEntry *ptr;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* Note: this code presumes first_keysym rangecheck has
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * been done in invoking routine.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ptr = &compose_table[compose_map[first_keysym]];
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ while (ptr->first == first_keysym) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (ptr->second == second_keysym) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *result_keysym = ptr->result;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return (1);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return (0);
055d7c804dc8f1263f0b3166ba459c65996b8697carlsonj+_X_HIDDEN void
055d7c804dc8f1263f0b3166ba459c65996b8697carlsonj+SetLed (Display *dpy, int num, int state)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyboardControl led_control;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if ((dpy->xkb_info == NULL) || (num != COMPOSE_LED) ||
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XkbSetNamedIndicator(dpy,dpy->xkb_info->composeLED,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ True,state,False,NULL) == False)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevelindex e212049..35e58a3 100644
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -214,7 +214,9 @@ _XimLookupMBText(
03831d35f7499c87d51205817c93e9a8d42c4baestevel args, 1 ) != 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel- count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if(count != 0){
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -284,7 +286,9 @@ _XimLookupWCText(
03831d35f7499c87d51205817c93e9a8d42c4baestevel args, 1 ) != 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel- count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if(count != 0){
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -345,7 +349,9 @@ _XimLookupUTF8Text(
03831d35f7499c87d51205817c93e9a8d42c4baestevel NULL, 0) != 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel- count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if(count != 0){
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ count = nbytes - to_len;
03831d35f7499c87d51205817c93e9a8d42c4baestevelindex 1c16adc..3370896 100644
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -53,6 +53,12 @@ static int _XkbLoadDpy(
03831d35f7499c87d51205817c93e9a8d42c4baestevel Display *dpy
03831d35f7499c87d51205817c93e9a8d42c4baestevel+static int XkbTranslateKeySymExt(
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ register Display * dpy, register KeySym *sym_rtrn, unsigned int mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ char *buffer, int nbytes, int *extra_rtrn, XKeyEvent *event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus *status
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct _XKeytrans {
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct _XKeytrans *next;/* next on list */
03831d35f7499c87d51205817c93e9a8d42c4baestevel char *string; /* string to return when the time comes */
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -577,6 +583,20 @@ XkbTranslateKeySym( register Display * dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel int nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel int * extra_rtrn)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* Call the new extended function but put in NULL for the extra params */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return XkbTranslateKeySymExt(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn, NULL, NULL);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+XkbTranslateKeySymExt( register Display * dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ register KeySym * sym_rtrn,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ unsigned int mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ char * buffer,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int * extra_rtrn,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyEvent * event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus * status)
03831d35f7499c87d51205817c93e9a8d42c4baestevel register XkbInfoPtr xkb;
03831d35f7499c87d51205817c93e9a8d42c4baestevel XkbKSToMBFunc cvtr;
03831d35f7499c87d51205817c93e9a8d42c4baestevel XPointer priv;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -618,6 +638,17 @@ XkbTranslateKeySym( register Display * dpy,
03831d35f7499c87d51205817c93e9a8d42c4baestevel n = (*cvtr)(priv,*sym_rtrn,buffer,nbytes,extra_rtrn);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ /* Add Suns specific compose key handler here. Be sure the special
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ * globals are set before calling this function.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int return_val;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (event && HandleComposeSequence(*sym_rtrn, buffer, sym_rtrn,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ status, &return_val, event))
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return return_val;
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((!xkb->cvt.KSToUpper)&&( mods&LockMask )) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel register int i;
03831d35f7499c87d51205817c93e9a8d42c4baestevel int change;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -744,9 +775,9 @@ XLookupString ( register XKeyEvent * event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (n=len=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ( nbytes-len > 0 ) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel- len+= XkbTranslateKeySym(dpy,&rtrn.sym[n],new_mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ len+= XkbTranslateKeySymExt(dpy,&rtrn.sym[n],new_mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel buffer+len,nbytes-len,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ NULL, event, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ( keysym!=NULL ) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -772,16 +803,16 @@ XLookupString ( register XKeyEvent * event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel len = (int)strlen(buffer);
03831d35f7499c87d51205817c93e9a8d42c4baestevel- len = XkbTranslateKeySym(dpy,keysym,new_mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ len = XkbTranslateKeySymExt(dpy,keysym,new_mods,
03831d35f7499c87d51205817c93e9a8d42c4baestevel buffer,nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ NULL, event, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (n=0;rtrn.sym[n]!=XK_VoidSymbol;n++) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ( nbytes-len > 0 ) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel- len+= XkbTranslateKeySym(dpy,&rtrn.sym[n],
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ len+= XkbTranslateKeySymExt(dpy,&rtrn.sym[n],
03831d35f7499c87d51205817c93e9a8d42c4baestevel event->state,
03831d35f7499c87d51205817c93e9a8d42c4baestevel buffer+len,nbytes-len,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ NULL, event, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel return len;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -802,7 +833,8 @@ XLookupString ( register XKeyEvent * event,
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (rtrnLen>0)
03831d35f7499c87d51205817c93e9a8d42c4baestevel return rtrnLen;
03831d35f7499c87d51205817c93e9a8d42c4baestevel- return XkbTranslateKeySym(dpy,keysym,new_mods,buffer,nbytes,NULL);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return XkbTranslateKeySymExt(dpy,keysym,new_mods,buffer,nbytes,NULL,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ event,status);
03831d35f7499c87d51205817c93e9a8d42c4baesteveldiff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h
03831d35f7499c87d51205817c93e9a8d42c4baestevelindex ce14527..9945321 100644
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -175,10 +175,19 @@ extern int _XTranslateKey(
03831d35f7499c87d51205817c93e9a8d42c4baestevel extern int _XTranslateKeySym(
03831d35f7499c87d51205817c93e9a8d42c4baestevel Display * /* dpy */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ register KeySym * /* symbol */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel register KeySym /* symbol */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel unsigned int /* modifiers */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel char * /* buffer */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel int /* nbytes */
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyEvent * /* event */,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus * /* status */
03831d35f7499c87d51205817c93e9a8d42c4baestevel extern int _XLookupString(
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -338,6 +347,17 @@ extern Status _XkbReadGetGeometryReply(
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+extern int HandleComposeSequence(
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym symbol,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ char *buffer,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym *keysym,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XComposeStatus *status,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ int *return_val,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ XKeyEvent *event);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#endif /* SUNSOFT_KBD */
03831d35f7499c87d51205817c93e9a8d42c4baestevel _XFUNCPROTOEND
03831d35f7499c87d51205817c93e9a8d42c4baestevel #endif /* _XKBLIBINT_H_ */
03831d35f7499c87d51205817c93e9a8d42c4baesteveldiff --git a/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c
03831d35f7499c87d51205817c93e9a8d42c4baestevelindex 1eacfa5..72f6b9d 100644
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -67,6 +67,12 @@ from The Open Group.
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#define COMPOSE_LED 2
03831d35f7499c87d51205817c93e9a8d42c4baestevel+extern void SetLed (Display *dpy, int num, int state);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+extern int compose_state, compose_led_is_on;
03831d35f7499c87d51205817c93e9a8d42c4baestevel _XIMNestedListToNestedList(
03831d35f7499c87d51205817c93e9a8d42c4baestevel XIMArg *nlist, /* This is the new list */
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -397,9 +403,23 @@ int
03831d35f7499c87d51205817c93e9a8d42c4baestevel XmbLookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel KeySym *keysym, Status *status)
03831d35f7499c87d51205817c93e9a8d42c4baestevel- return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- keysym, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym keysym_temp = NoSymbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret = (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ &keysym_temp, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on && compose_state != 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (ev->display, COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = keysym_temp;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return ret;
03831d35f7499c87d51205817c93e9a8d42c4baestevel return XLookupNone;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -407,9 +427,23 @@ int
03831d35f7499c87d51205817c93e9a8d42c4baestevel XwcLookupString(XIC ic, XKeyEvent *ev, wchar_t *buffer, int nchars,
03831d35f7499c87d51205817c93e9a8d42c4baestevel KeySym *keysym, Status *status)
03831d35f7499c87d51205817c93e9a8d42c4baestevel- return (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- keysym, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym keysym_temp = NoSymbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret = (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ &keysym_temp, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on && compose_state != 0) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (ev->display, COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = keysym_temp;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return ret;
03831d35f7499c87d51205817c93e9a8d42c4baestevel return XLookupNone;
03831d35f7499c87d51205817c93e9a8d42c4baestevel@@ -418,12 +452,25 @@ Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel KeySym *keysym, Status *status)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ KeySym keysym_temp = NoSymbol;
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (ic->methods->utf8_lookup_string)
03831d35f7499c87d51205817c93e9a8d42c4baestevel- return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- keysym, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret = (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ &keysym_temp, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel else if (ic->methods->mb_lookup_string)
03831d35f7499c87d51205817c93e9a8d42c4baestevel- return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel- keysym, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ ret = (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ &keysym_temp, status);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+#ifdef SUNSOFT_KBD
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on && compose_state != 0){
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ SetLed (ev->display, COMPOSE_LED, LedModeOff);
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ compose_led_is_on = False;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ if (keysym)
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ *keysym = keysym_temp;
03831d35f7499c87d51205817c93e9a8d42c4baestevel+ return ret;
03831d35f7499c87d51205817c93e9a8d42c4baestevel return XLookupNone;