Character Composition problem on X

Hi,

here is a patch (against current CVS) for the test program ‘checkeys.c’ that
displays the unicode field in hex:

Index: checkkeys.c===================================================================
RCS file: /home/sdlweb/libsdl.org/cvs/SDL12/test/checkkeys.c,v
retrieving revision 1.5
diff -c -r1.5 checkkeys.c
*** checkkeys.c 19 Jan 2006 09:09:32 -0000 1.5
— checkkeys.c 1 Feb 2006 12:40:58 -0000


*** 10,15 ****
— 10,17 ----

#include “SDL.h”

  • #define UNICODE
  • /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
    static void quit(int rc)
    {

*** 68,74 ****
printf(" (^%c)", sym->unicode+’@’);
} else {
#ifdef UNICODE
! printf(" (%c)", sym->unicode);
#else
/* This is a Latin-1 program, so only show 8-bits /
if ( !(sym->unicode & 0xFF00) )
— 70,76 ----
printf(" (^%c)", sym->unicode+’@’);
} else {
#ifdef UNICODE
! printf(" (0x%04X)", sym->unicode);
#else
/
This is a Latin-1 program, so only show 8-bits */
if ( !(sym->unicode & 0xFF00) )

Not very interesting, but helps demonstrate the problem I’m having with
SDL and X. The CVS version of SDL on Windows and the modified version
of checkkeys do this on XP with a ‘Spanish (Traditional Sort)’ keyboard
mapping:

Key pressed: 47-/ (0x00E7) modifiers: NUM
Key released: 47-/ modifiers: NUM
Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 47-/ (0x00C7) modifiers: RSHIFT NUM
Key released: 47-/ modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM

This is lower-c cedilla and upper-c cedilla (on my UK keyboard this is the

and ~ key, on my US laptop keyboard it is the \ and | key) which is fine.

Key pressed: 96-(0x00F1) modifiers: NUM Key released: 96- modifiers: NUM
Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 96-(0x00D1) modifiers: RSHIFT NUM Key released: 96- modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM

This is lower-n tilde and upper-n tilde (on my UK and US keyboard this
is the ; and : key) which is also fine.

The equivalent on X is similar and also fine:

Key pressed: 231-world 71 (0x00E7) modifiers: NUM
Key released: 231-world 71 (0x00E7) modifiers: NUM
Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 231-world 71 (0x00C7) modifiers: RSHIFT NUM
Key released: 231-world 71 (0x00C7) modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM

Key pressed: 241-world 81 (0x00F1) modifiers: NUM
Key released: 241-world 81 (0x00F1) modifiers: NUM
Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 241-world 81 (0x00D1) modifiers: RSHIFT NUM
Key released: 241-world 81 (0x00D1) modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM

The key names are different, but equivalent, and the unicode field is
valid when the key is released which isn’t portable.

The problem comes when trying to enter ‘composed’ characters. On Windows
I get this:

Key pressed: 39-’ modifiers: NUM
Key released: 39-’ modifiers: NUM
Key pressed: 97-a (0x00E1) modifiers: NUM
Key released: 97-a modifiers: NUM

The first press/release (on my UK keyboard this is the ’ and @ key, on
my US laptop keyboard this the ’ and " key) has an empty unicode field,
but it affects the following ‘a’ key which generates a lower-a acute. On
X I get this:

Unknown Key (scancode = 48) pressed modifiers: NUM
Unknown Key (scancode = 48) released (0x00B4) modifiers: NUM
Key pressed: 97-a (0x0061) modifiers: NUM
Key released: 97-a (0x0061) modifiers: NUM

which is not fine.

Another example on Windows:

Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 39-’ modifiers: RSHIFT NUM
Key released: 39-’ modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM
Key pressed: 97-a (0x00E4) modifiers: NUM
Key released: 97-a modifiers: NUM

which is the previous ‘dead’ key shifted, followed by a, resulting in
lower-a diaeresis (two dots). On X I get this:

Key pressed: 303-right shift modifiers: RSHIFT NUM
Unknown Key (scancode = 48) pressed modifiers: RSHIFT NUM
Unknown Key (scancode = 48) released (0x00A8) modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM
Key pressed: 97-a (0x0061) modifiers: NUM
Key released: 97-a (0x0061) modifiers: NUM

which is also not fine.

The other ‘dead’ key on my UK (and US) keyboard when using the Spanish
mapping is the [ and { key, which can be used to produce this:

Key pressed: 59-; modifiers: NUM
Key released: 59-; modifiers: NUM
Key pressed: 97-a (0x00E0) modifiers: NUM
Key released: 97-a modifiers: NUM

which is lower-a grave, and this:

Key pressed: 303-right shift modifiers: RSHIFT NUM
Key pressed: 59-; modifiers: RSHIFT NUM
Key released: 59-; modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM
Key pressed: 97-a (0x00E2) modifiers: NUM
Key released: 97-a modifiers: NUM

which is lower-a circumflex. On X, the equivalent is this:

Unknown Key (scancode = 34) pressed modifiers: NUM
Unknown Key (scancode = 34) released (0x0060) modifiers: NUM
Key pressed: 97-a (0x0061) modifiers: NUM
Key released: 97-a (0x0061) modifiers: NUM

Key pressed: 303-right shift modifiers: RSHIFT NUM
Unknown Key (scancode = 34) pressed modifiers: RSHIFT NUM
Unknown Key (scancode = 34) released (0x005E) modifiers: RSHIFT NUM
Key released: 303-right shift modifiers: NUM
Key pressed: 97-a (0x0061) modifiers: NUM
Key released: 97-a (0x0061) modifiers: NUM

which are not fine either.

Note that in an xterm (or konsole) these characters are correctly
generated.

I tested with Xorg 6.8.2 release, a 6.8.2 CVS version, and 6.9.0 release
(Gentoo) and also XFree86 4.3.0.1 (Debian).

Can anyone confirm this bug?

cheers,
John Popplewell.
PS or try the text-tool in a CVS version of Tux Paint: much more fun :slight_smile:

I’ve enter this in Bugzilla:
https://bugzilla.libsdl.org/show_bug.cgi?id=130

I’ve enter this in Bugzilla:
https://bugzilla.libsdl.org/show_bug.cgi?id=130

This is fixed in CVS. Thanks for the help!

Can people who have international input under X11 please make sure it
works correctly? How well does it work with Russian and Asian input?

Also please check to make sure DGA input is still working correctly
(but only supports Latin-1)

Thanks,
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

I’ve enter this in Bugzilla:
https://bugzilla.libsdl.org/show_bug.cgi?id=130

Can people who have international input under X11 please make
sure it works correctly? How well does it work with Russian and
Asian input?

Russian keyboards do not have dead keys, because there are only 2 composed
chars in Russian alphabet (but 4 in Ukrainian). As such, it should not be
effected by the patch.

-Alex.

The compilation fails.
cc: Error: SDL_x11events.c, line 717: In this statement, "XK_dead_hook"
is not declared. (undeclared)
ODD_keymap[XK_dead_hook&0xFF] = SDLK_COMPOSE;
-------------------^
cc: Error: SDL_x11events.c, line 718: In this statement, "XK_dead_horn"
is not declared. (undeclared)
ODD_keymap[XK_dead_horn&0xFF] = SDLK_COMPOSE;

Neither XK_dead_hook nor XK_dead_horn are defined on Tru64.

Sam Lantinga wrote:>> I’ve enter this in Bugzilla:

https://bugzilla.libsdl.org/show_bug.cgi?id=130

This is fixed in CVS. Thanks for the help!

Can people who have international input under X11 please make sure it
works correctly? How well does it work with Russian and Asian input?

Also please check to make sure DGA input is still working correctly
(but only supports Latin-1)

Thanks,
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Hayashi Naoyuki <@Hayashi_Naoyuki>
Key fingerprint = 60A0 D5D3 F58B 3633 2E52 0147 D17F 5578 3FDF F5B6
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: SDL_x11events.c.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060204/4da0919d/attachment.asc

The patch that had been sent ahead was not perfect.

If building with --enable-x11-shared=no, a program using SDL fails.
resolve_symbols: loader error: dlopen: libSDL-1.2.so.0: symbol
"pXUnsetICFocus" unresolved

In SDL_x11sym.h XSetICFocus and XUnsetICFocus are defined if
X_HAVE_UTF8_STRING is defined.

but in SDL_x11events.c these are used independent of X_HAVE_UTF8_STRING.–
Hayashi Naoyuki <@Hayashi_Naoyuki>
Key fingerprint = 60A0 D5D3 F58B 3633 2E52 0147 D17F 5578 3FDF F5B6
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: SDL_x11events.c.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060204/f013d04a/attachment.txt

Thanks, your patch is in CVS.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment