python-27: make tkinter-27 dependency actually conditional
[unleashed-userland.git] / components / x11 / libX11 / patches / 08.solaris-kbd.patch
blob96cdb2d4c264d4030eb52fcfb0672c3b29db893f
1 ###############################################################################
2 # Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
13 # Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 # DEALINGS IN THE SOFTWARE.
24 --- a/src/KeyBind.c Tue Mar 17 09:26:07 2015
25 +++ b/src/KeyBind.c Tue Mar 17 09:55:54 2015
26 @@ -45,6 +45,7 @@
27 #define XK_VIETNAMESE
28 #define XK_XKB_KEYS
29 #define XK_SINHALA
30 +#define XK_CURRENCY
31 #include <X11/keysymdef.h>
32 #include <stdio.h>
34 @@ -51,6 +52,20 @@
35 #include "Xresource.h"
36 #include "Key.h"
38 +#ifdef SUNSOFT_KBD
39 +/* Sun: compose sequence support
40 + * (state = chars_matched in XComposeStatus)
41 + */
42 +#include "Suncompose.h"
43 +#include <X11/Sunkeysym.h>
44 +#define REJECTED -1
45 +#define START 0
46 +#define ACCEPTED1 1
47 +#define ACCEPTED2 2
48 +#define ACCEPTED3 3
49 +#define COMPOSE_LED 2
50 +#endif /* SUNSOFT_KBD */
52 #ifdef XKB
53 #include "XKBlib.h"
54 #include "XKBlibint.h"
55 @@ -72,6 +87,11 @@
56 Display *dpy,
57 register struct _XKeytrans *p);
59 +#ifdef SUNSOFT_KBD
60 +static int DoCompose(KeySym first_keysym, KeySym second_keysym, KeySym *result_keysym);
61 + void SetLed (Display *dpy, int num, int state);
62 +#endif /* SUNSOFT_KBD */
64 struct _XKeytrans {
65 struct _XKeytrans *next;/* next on list */
66 char *string; /* string to return when the time comes */
67 @@ -93,6 +113,10 @@
68 ((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode))
69 return NoSymbol;
71 +/* Sun comment: We need not protect dpy->keysyms[], because,
72 + * this is * changed only in the initialize routine and
73 + * XOpenDisplay().
74 + */
75 syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per];
76 if (col < 4) {
77 if (col > 1) {
78 @@ -763,6 +787,10 @@
79 register KeySym *syms;
80 KeySym sym, lsym, usym;
82 +#ifdef SUNSOFT_KBD
83 + int i, column, KeypadKey;
84 +#endif /* SUNSOFT_KBD */
86 if ((! dpy->keysyms) && (! _XKeyInitialize(dpy)))
87 return 0;
88 *modifiers_return = ((ShiftMask|LockMask)
89 @@ -776,17 +804,54 @@
90 syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per];
91 while ((per > 2) && (syms[per - 1] == NoSymbol))
92 per--;
94 +#ifdef SUNSOFT_KBD
95 + /* Sun: Japanese keypad support */
96 + KeypadKey = 0;
97 + if (per < 5)
98 + {
99 + /* in case of Hobo keyboards, the keypad would be
100 + * superimposed on the other (qwerty) keys. So by doing
101 + * this * check, we would not get the Japanese keysyms
102 + * on the * Hobo keypad superimposed keys.
103 + */
104 + for (i=0; i < per; i++)
106 + if (IsKeypadKey(syms[i]))
107 + KeypadKey = 1;
110 +#endif /* SUNSOFT_KBD */
112 if ((per > 2) && (modifiers & dpy->mode_switch)) {
113 +#ifdef SUNSOFT_KBD
114 +/* Sun: ModeSwitch does not apply to function keys (Japanese kbd) */
115 + if (!KeypadKey)
117 +#endif /* SUNSOFT_KBD */
118 syms += 2;
119 per -= 2;
120 +#ifdef SUNSOFT_KBD
122 +#endif /* SUNSOFT_KBD */
125 +#ifdef SUNSOFT_KBD
126 if ((modifiers & dpy->num_lock) &&
127 + (per > 1 && (IsKeypadKey(syms[2]) ))) {
128 +#else
129 + if ((modifiers & dpy->num_lock) &&
130 (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) {
131 +#endif /* SUNSOFT_KBD */
132 if ((modifiers & ShiftMask) ||
133 ((modifiers & LockMask) && (dpy->lock_meaning == XK_Shift_Lock)))
134 *keysym_return = syms[0];
135 else
136 +#ifdef SUNSOFT_KBD
137 + *keysym_return = syms[2];
138 +#else
139 *keysym_return = syms[1];
140 +#endif /* SUNSOFT_KBD */
141 } else if (!(modifiers & ShiftMask) &&
142 (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) {
143 if ((per == 1) || (syms[1] == NoSymbol))
144 @@ -814,19 +879,41 @@
147 _XTranslateKeySym(
148 - Display *dpy,
149 - register KeySym symbol,
150 - unsigned int modifiers,
151 - char *buffer,
152 - int nbytes)
153 + Display * dpy,
154 +#ifdef SUNSOFT_KBD
155 + register KeySym * keysym,
156 +#else
157 + register KeySym keysym,
158 +#endif
159 + unsigned int modifiers,
160 + char * buffer,
161 + int nbytes
162 +#ifdef SUNSOFT_KBD
164 + XKeyEvent * event,
165 + XComposeStatus * status
166 +#endif
169 register struct _XKeytrans *p;
170 int length;
171 unsigned long hiBytes;
172 register unsigned char c;
173 + KeySym symbol;
175 +#ifdef SUNSOFT_KBD
176 + int return_val;
177 +#endif /* SUNSOFT_KBD */
179 +#ifdef SUNSOFT_KBD
180 + if (!keysym)
181 + return 0;
182 + else
183 + symbol = *keysym;
184 +#else
185 if (!symbol)
186 return 0;
187 +#endif /* SUNSOFT_KBD */
188 /* see if symbol rebound, if so, return that string. */
189 for (p = dpy->key_bindings; p; p = p->next) {
190 if (((modifiers & AllMods) == p->state) && (symbol == p->key)) {
191 @@ -840,8 +927,29 @@
192 hiBytes = symbol >> 8;
193 if (!(nbytes &&
194 ((hiBytes == 0) ||
195 +#ifdef SUNSOFT_KBD
196 +/* The check for 0x100500 <= hiBytes < 0x100600 is Sun-specific.
197 + * This represents Sun's registered range of vendor-specific
198 + * keysyms. We need the check so that Sun specific keysyms will
199 + * pass through this check and onto to be handled by
200 + * HandleComposeSequence.
201 + */
202 + ((0x100500 <= hiBytes) && (hiBytes < 0x100600)) ||
204 + * The following hard-coded line is to support the euro sign for legacy apps
205 + * and single byte codeset locale apps with the euro sign at 0xa4.
206 + * For any other codeset locales with properly internationalized apps,
207 + * one must have an entry in the Compose file of the locale that will map
208 + * the XK_EuroSign keysym to the correct character code value of the locale's
209 + * codeset.
210 + */
211 + (symbol == XK_EuroSign) ||
212 +#endif /* SUNSOFT_KBD */
213 ((hiBytes == 0xFF) &&
214 (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) ||
215 +#ifdef SUNSOFT_KBD
216 + (symbol == XK_Multi_key) ||
217 +#endif /* SUNSOFT_KBD */
218 (symbol == XK_Return) ||
219 (symbol == XK_Escape) ||
220 (symbol == XK_KP_Space) ||
221 @@ -852,15 +960,34 @@
222 (symbol == XK_Delete))))))
223 return 0;
225 +#ifdef SUNSOFT_KBD
226 + /* if this is a compose sequence, then HandleComposeSequence
227 + * already deals w/ this. This is Sun-specific.
228 + */
229 + if (HandleComposeSequence(symbol, buffer, keysym, status, &return_val, event)) {
230 + return return_val;
232 +#endif /* SUNSOFT_KBD */
234 /* if X keysym, convert to ascii by grabbing low 7 bits */
235 if (symbol == XK_KP_Space)
236 c = XK_space & 0x7F; /* patch encoding botch */
237 else if (hiBytes == 0xFF)
238 c = symbol & 0x7F;
239 +#ifdef SUNSOFT_KBD
240 + else if (symbol == XK_EuroSign)
241 + c = (unsigned char)0xa4; /* Latin-9 euro symbol code for legacy apps. */
242 +#endif /* SUNSOFT_KBD */
243 else
244 c = symbol & 0xFF;
245 /* only apply Control key if it makes sense, else ignore it */
246 if (modifiers & ControlMask) {
247 +#ifdef SUNSOFT_KBD
248 + /* Sun: map control characters with high bit set */
249 + if ((c >= (unsigned char)'\300' && c <= (unsigned char)'\377')) c &= 0x9F;
250 +#endif /* SUNSOFT_KBD */
252 + /* MIT "standard" control character handling */
253 if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
254 else if (c == '2') c = '\000';
255 else if (c >= '3' && c <= '7') c -= ('3' - '\033');
256 @@ -887,11 +1014,22 @@
257 &modifiers, &symbol))
258 return 0;
260 +#ifdef SUNSOFT_KBD
261 + if (keysym) {
262 + *keysym = symbol;
263 + return _XTranslateKeySym(event->display, keysym, event->state,
264 + buffer, nbytes, event, status);
265 + } else {
266 + return _XTranslateKeySym(event->display, &symbol, event->state,
267 + buffer, nbytes, event, status);
269 +#else
270 if (keysym)
271 *keysym = symbol;
272 /* arguable whether to use (event->state & ~modifiers) here */
273 return _XTranslateKeySym(event->display, symbol, event->state,
274 buffer, nbytes);
275 +#endif /* SUNSOFT_KBD */
278 static void
279 @@ -1003,3 +1141,282 @@
281 p->state &= AllMods;
284 +#ifdef SUNSOFT_KBD
285 +/* added 2 functions:
286 + * HandleComposeSequence and DoCompose;
287 + */
289 +/* Called from XTranslateKeySym & XkbTranslateKeySymExt
290 + * Look at compose sequence and dead key sequence and try to get
291 + * a Latin-1 character out of it. Return 1 if it is able to
292 + * resolve the lookup based on the info it has, return 0 if it
293 + * can't, then XTranslateKeySym needs to do further processing.
294 + */
296 +Bool compose_led_is_on = False;
297 +int compose_state = START;
299 +int
300 +HandleComposeSequence(
301 + KeySym symbol,
302 + char *buffer,
303 + KeySym *keysym,
304 + XComposeStatus *status,
305 + int *return_val,
306 + XKeyEvent *event)
308 + static char compose_sequence[5]; /* initialized to NULL */
309 + static KeyCode last_composed_keycode; /* initialized to NULL */
310 + static KeySym last_composed_keysym; /* initialized to NULL */
311 + static char watching_keypresses = 0;
312 + static int initialized = 0;
313 + int ret_val;
315 + /*
316 + * Even if the caller doesn't pass us a compose structure, we'll still
317 + * support compose sequence processing. Note that the client won't be able
318 + * to support multiple compose sequence clients within a single application.
319 + */
321 + /* must come first */
322 + if (status != (XComposeStatus *) NULL) {
323 + /*
324 + * The caller provided a structure so we'll track his state * (if reasonable) and we'll point him at our private
325 + * compose_sequence (at bottom). This allows him to implement
326 + * multiple compose sequence clients within a single application.
327 + */
328 + if (! initialized) { /* start him out right */
329 + compose_state = START;
330 + initialized = 1;
332 + /* bug 4247009, vivekp, set the compose LED off very first
333 + time, initialization time */
334 + if (compose_led_is_on)
335 + SetLed (event->display,COMPOSE_LED, LedModeOff);
337 + } else { /* then track him */
338 + compose_state = status->chars_matched;
339 + if (compose_state < START || compose_state > ACCEPTED3) compose_state = START;
343 + /* must come second */
344 + if (event->type == KeyPress) {
345 + /* if we've ever seen a KeyPress, we're watching KeyPresses */
346 + watching_keypresses = 1;
347 + } else if (event->type == KeyRelease && watching_keypresses) {
348 + /*
349 + * don't let someone watching both KeyPresses and KeyReleases
350 + * screw us unwittingly. Try to return the right thing.
351 + */
352 + *return_val = 0;
353 + if (compose_state > START) {
354 + if (compose_state == ACCEPTED3 && event->keycode == last_composed_keycode) {
355 + buffer[0] = last_composed_keysym;
356 + *keysym = last_composed_keysym;
357 + *return_val = 1;
359 + return(1);
361 + if ((*keysym == XK_Multi_key) ||
362 + (*keysym == SunXK_FA_Circum) ||
363 + (*keysym == SunXK_FA_Tilde) ||
364 + (*keysym == SunXK_FA_Grave) ||
365 + (*keysym == SunXK_FA_Acute) ||
366 + (*keysym == SunXK_FA_Cedilla) ||
367 + (*keysym == SunXK_FA_Diaeresis))
368 + return(1);
369 + return(0);
372 + /* XTranslateKeysym filters these out before we get here, but the
373 + * XKB version doesn't so we need to punt these here to avoid breaking
374 + * compose sequences when modifiers like the shift key are pressed.
375 + */
376 + if (IsModifierKey(*keysym)) {
377 + return (0);
380 + if (compose_state == ACCEPTED3)
381 + compose_state = START;
383 + /* now we're ready */
384 + switch (compose_state) {
385 + case START:
386 + if (*keysym == XK_Multi_key) {
387 + /* bug 4247009, vivekp, set the compose LED when the
388 + compose key is pressed first time. */
389 + SetLed (event->display,COMPOSE_LED, LedModeOn);
390 + compose_state = ACCEPTED1;
391 + compose_led_is_on = True;
393 + else if (*keysym == SunXK_FA_Circum) {
394 + compose_sequence[0] = '^';
395 + compose_state = ACCEPTED2;
397 + else if (*keysym == SunXK_FA_Tilde) {
398 + compose_sequence[0] = '~';
399 + compose_state = ACCEPTED2;
401 + else if (*keysym == SunXK_FA_Cedilla) {
402 + compose_sequence[0] = ',';
403 + compose_state = ACCEPTED2;
405 + else if (*keysym == SunXK_FA_Diaeresis){
406 + compose_sequence[0] = '"';
407 + compose_state = ACCEPTED2;
409 + /* else don't change state */
410 + break;
412 + case ACCEPTED1: /* Got Compose last time */
413 + if (*keysym < ASCII_SET_SIZE) {
414 + if (compose_map[*keysym] >= 0) {
415 + compose_sequence[0] = *keysym;
416 + compose_state = ACCEPTED2;
418 + else
419 + compose_state = REJECTED;
421 + else
422 + compose_state = REJECTED;
423 + break;
425 + case ACCEPTED2: /* Got Compose + composable char */
427 + /* bug 4247009, vivekp, set the compose LED off after
428 + compose+composable char is pressed. */
429 + SetLed (event->display,COMPOSE_LED, LedModeOff);
430 + compose_led_is_on = False;
431 + if (*keysym < ASCII_SET_SIZE) {
432 + if (compose_map[*keysym] >= 0) {
433 + compose_sequence[1] = *keysym;
435 + * If the second character is space, compose sequence should return * the first character. See TBITS/NCTTI-5, Section 2.1
436 + * Note: <Compose>+<space>+<space> = non-breaking space
437 + */
438 + if (compose_sequence[1] == XK_space &&
439 + compose_sequence[0] != XK_space) {
440 + *keysym = compose_sequence[0];
441 + compose_state = ACCEPTED3;
442 + } else {
443 + if (compose_sequence[0] <= compose_sequence[1])
444 + ret_val = DoCompose(compose_sequence[0],
445 + compose_sequence[1], keysym);
446 + else
447 + ret_val = DoCompose(compose_sequence[1],
448 + compose_sequence[0], keysym);
449 + if (ret_val == 1) {
450 + compose_state = ACCEPTED3;
451 + compose_sequence[2] = *keysym;
453 + else
454 + compose_state = REJECTED;
457 + else
458 + compose_state = REJECTED;
460 + else
461 + compose_state = REJECTED;
462 + break;
464 + default:
465 + compose_state = START;
466 + break;
469 + if (compose_state == REJECTED)
471 + /* bug 4247009, vivekp, set the compose LED off after the
472 + compose key pressed second time or composable + 1st char +
473 + 2nd char. */
474 + SetLed (event->display,COMPOSE_LED, LedModeOff);
475 + compose_led_is_on = False;
476 + compose_state = START;
478 + if (status != (XComposeStatus *) NULL) {
479 + /*
480 + * Ok, since the caller provided a compose structure,
481 + * we need to point him at our private compose_sequence
482 + * and copy the new state back to him.
483 + */
484 + status->compose_ptr = compose_sequence;
485 + status->chars_matched = compose_state;
488 + if (compose_state == START) {
489 + compose_sequence[0] = '\0';
490 + last_composed_keycode = 0;
491 + last_composed_keysym = 0;
492 + if ((*keysym == XK_Multi_key) ||
493 + (*keysym == SunXK_FA_Circum) ||
494 + (*keysym == SunXK_FA_Tilde) ||
495 + (*keysym == SunXK_FA_Grave) ||
496 + (*keysym == SunXK_FA_Acute) ||
497 + (*keysym == SunXK_FA_Cedilla) ||
498 + (*keysym == SunXK_FA_Diaeresis)) {
499 + *return_val = 0;
500 + return(1);
502 + return(0);
505 + compose_sequence[compose_state-1] = '\0';
506 + last_composed_keycode = event->keycode;
507 + last_composed_keysym = *keysym;
509 + if (compose_state == ACCEPTED3) {
510 + buffer[0] = *keysym;
511 + *return_val = 1;
513 + else {
514 + if (compose_state == ACCEPTED2) {
515 + buffer[0] = '\0';
517 + *return_val = 0;
520 + return(1);
524 + * DoCompose - put result in keysym
525 + */
526 +static int
527 +DoCompose(KeySym first_keysym, KeySym second_keysym, KeySym *result_keysym)
529 + const ComposeTableEntry *ptr;
531 + /* Note: this code presumes first_keysym rangecheck has
532 + * been done in invoking routine.
533 + */
534 + ptr = &compose_table[compose_map[first_keysym]];
535 + while (ptr->first == first_keysym) {
536 + if (ptr->second == second_keysym) {
537 + *result_keysym = ptr->result;
538 + return (1);
540 + ptr++;
542 + return (0);
545 +_X_HIDDEN void
546 +SetLed (Display *dpy, int num, int state)
548 + XKeyboardControl led_control;
550 +#ifdef XKB
551 + if ((dpy->xkb_info == NULL) || (num != COMPOSE_LED) ||
552 + XkbSetNamedIndicator(dpy,dpy->xkb_info->composeLED,
553 + True,state,False,NULL) == False)
554 +#endif
556 + led_control.led_mode = state;
557 + led_control.led = num;
558 + XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control);
561 +#endif /* SUNSOFT_KBD */
562 --- a/src/imConv.c Tue Mar 17 09:56:27 2015
563 +++ b/src/imConv.c Tue Mar 17 10:00:06 2015
564 @@ -214,7 +214,9 @@
565 args, 1 ) != 0) {
566 count = 0;
567 } else {
568 - count = nbytes - to_len;
569 + if (count != 0){
570 + count = nbytes - to_len;
575 @@ -284,7 +286,9 @@
576 args, 1 ) != 0) {
577 count = 0;
578 } else {
579 - count = nbytes - to_len;
580 + if (count != 0){
581 + count = nbytes - to_len;
585 } else
586 @@ -345,7 +349,9 @@
587 NULL, 0) != 0) {
588 count = 0;
589 } else {
590 - count = nbytes - to_len;
591 + if (count != 0){
592 + count = nbytes - to_len;
596 /* FIXME:
597 --- a/src/xkb/XKBBind.c Tue Mar 17 10:00:31 2015
598 +++ b/src/xkb/XKBBind.c Tue Mar 17 10:09:59 2015
599 @@ -46,6 +46,12 @@
601 static int _XkbLoadDpy(Display *dpy);
603 +static int XkbTranslateKeySymExt(
604 + register Display * dpy, register KeySym *sym_rtrn, unsigned int mods,
605 + char *buffer, int nbytes, int *extra_rtrn, XKeyEvent *event,
606 + XComposeStatus *status
609 struct _XKeytrans {
610 struct _XKeytrans *next; /* next on list */
611 char *string; /* string to return when the time comes */
612 @@ -594,6 +600,20 @@
613 int nbytes,
614 int *extra_rtrn)
616 + /* Call the new extended function but put in NULL for the extra params */
617 + return XkbTranslateKeySymExt(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn, NULL, NULL);
620 +static int
621 +XkbTranslateKeySymExt(register Display *dpy,
622 + register KeySym *sym_rtrn,
623 + unsigned int mods,
624 + char *buffer,
625 + int nbytes,
626 + int *extra_rtrn,
627 + XKeyEvent *event,
628 + XComposeStatus *status)
630 register XkbInfoPtr xkb;
631 XkbKSToMBFunc cvtr;
632 XPointer priv;
633 @@ -636,6 +656,17 @@
635 n = (*cvtr) (priv, *sym_rtrn, buffer, nbytes, extra_rtrn);
637 + /* Add Suns specific compose key handler here. Be sure the special
638 + * globals are set before calling this function.
639 + */
641 + int return_val;
643 + if (event && HandleComposeSequence(*sym_rtrn, buffer, sym_rtrn,
644 + status, &return_val, event))
645 + return return_val;
648 if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) {
649 register int i;
650 int change;
651 @@ -731,7 +762,8 @@
652 if (rtrnLen > 0)
653 return rtrnLen;
655 - return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL);
656 + return XkbTranslateKeySymExt(dpy ,keysym, new_mods, buffer, nbytes, NULL,
657 + event, status);
661 --- a/src/xkb/XKBlibint.h Tue Mar 17 10:10:40 2015
662 +++ b/src/xkb/XKBlibint.h Tue Mar 17 10:11:56 2015
663 @@ -169,10 +169,19 @@
665 extern int _XTranslateKeySym(
666 Display * /* dpy */,
667 - register KeySym /* symbol */,
668 - unsigned int /* modifiers */,
669 - char * /* buffer */,
670 - int /* nbytes */
671 +#ifdef SUNSOFT_KBD
672 + register KeySym * /* symbol */,
673 +#else
674 + register KeySym /* symbol */,
675 +#endif
676 + unsigned int /* modifiers */,
677 + char * /* buffer */,
678 + int /* nbytes */
679 +#ifdef SUNSOFT_KBD
681 + XKeyEvent * /* event */,
682 + XComposeStatus * /* status */
683 +#endif
686 extern int _XLookupString(
687 @@ -332,6 +341,16 @@
689 #endif
691 +#ifdef SUNSOFT_KBD
692 +extern int HandleComposeSequence(
693 + KeySym symbol,
694 + char *buffer,
695 + KeySym *keysym,
696 + XComposeStatus *status,
697 + int *return_val,
698 + XKeyEvent *event);
699 +#endif /* SUNSOFT_KBD */
701 _XFUNCPROTOEND
703 #endif /* _XKBLIBINT_H_ */
704 --- a/src/xlibi18n/ICWrap.c Tue Mar 17 10:12:23 2015
705 +++ b/src/xlibi18n/ICWrap.c Tue Mar 17 10:14:56 2015
706 @@ -67,6 +67,12 @@
707 #include "Xlibint.h"
708 #include "Xlcint.h"
710 +#ifdef SUNSOFT_KBD
711 +#define COMPOSE_LED 2
712 +extern void SetLed (Display *dpy, int num, int state);
713 +extern int compose_state, compose_led_is_on;
714 +#endif
716 static int
717 _XIMNestedListToNestedList(
718 XIMArg *nlist, /* This is the new list */
719 @@ -397,9 +403,23 @@
720 XmbLookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes,
721 KeySym *keysym, Status *status)
723 - if (ic->core.im)
724 - return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
725 - keysym, status);
726 + if (ic->core.im) {
727 + int ret;
728 + KeySym keysym_temp = NoSymbol;
730 + ret = (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
731 + &keysym_temp, status);
732 +#ifdef SUNSOFT_KBD
733 + if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
734 + compose_led_is_on && compose_state != 0) {
735 + SetLed (ev->display, COMPOSE_LED, LedModeOff);
736 + compose_led_is_on = False;
738 +#endif
739 + if (keysym)
740 + *keysym = keysym_temp;
741 + return ret;
743 return XLookupNone;
746 @@ -407,9 +427,23 @@
747 XwcLookupString(XIC ic, XKeyEvent *ev, wchar_t *buffer, int nchars,
748 KeySym *keysym, Status *status)
750 - if (ic->core.im)
751 - return (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars,
752 - keysym, status);
753 + if (ic->core.im) {
754 + int ret;
755 + KeySym keysym_temp = NoSymbol;
757 + ret = (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars,
758 + &keysym_temp, status);
759 +#ifdef SUNSOFT_KBD
760 + if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
761 + compose_led_is_on && compose_state != 0) {
762 + SetLed (ev->display, COMPOSE_LED, LedModeOff);
763 + compose_led_is_on = False;
765 +#endif
766 + if (keysym)
767 + *keysym = keysym_temp;
768 + return ret;
770 return XLookupNone;
773 @@ -418,12 +452,25 @@
774 KeySym *keysym, Status *status)
776 if (ic->core.im) {
777 + int ret;
778 + KeySym keysym_temp = NoSymbol;
780 if (ic->methods->utf8_lookup_string)
781 - return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
782 - keysym, status);
783 + ret = (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
784 + &keysym_temp, status);
785 else if (ic->methods->mb_lookup_string)
786 - return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
787 - keysym, status);
788 + ret = (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
789 + &keysym_temp, status);
790 +#ifdef SUNSOFT_KBD
791 + if (ev->display->im_filters && !IsModifierKey(keysym_temp) &&
792 + compose_led_is_on && compose_state != 0){
793 + SetLed (ev->display, COMPOSE_LED, LedModeOff);
794 + compose_led_is_on = False;
796 +#endif
797 + if (keysym)
798 + *keysym = keysym_temp;
799 + return ret;
801 return XLookupNone;