[Sugar-devel] Better workaround for Xephyr keyboard problem seen running sugar-emulator (jhbuild run)

Dan Krejsa dan.krejsa at gmail.com
Wed Jun 24 18:16:50 EDT 2009


Hi,

I've found what I think is a better workaround for the Xephyr problem seen
running sugar-emulator, in which keyboard mappings are not inherited from
the main X server.

One workaround known so far is to go into the Terminal activity
and run

  setxkbmap us

(or whatever keyboard map & options you want).  However, that doesn't fix
all keys,
in particular it doesn't fix the arrow keys (at least for me).  What does
work
is to execute, in a host shell outside of the sugar emulator,

  xkbcomp $DISPLAY :100

replacing :100 with the actual X display of the Xephyr X server;
$DISPLAY is of course the name of the encompassing X display in
which Xephyr runs as a client.   This copies the XKB settings from
the encompassing display to the display under Xephyr.

You have to run xkbcomp after having sent some keyboard events
to Xephyr -- if you do it before that, it seems not to work for some reason
that I don't understand well.

That leads me to a really hackish patch to:

  sugar-jhbuild/source/sugar/bin/sugar-emulator

adding a -k option that does the xkbcomp to copy the XKB settings to
Xephyr before starting sugar.  The most awkward bit is that I had to
add code to put an ugly little window in the Xephyr server waiting for an
initial keystroke before calling xkbcomp.  I know very little about X; maybe
someone can figure out how to avoid that bit.

If you use the patch, start sugar-emulator as follows:

 $ ./sugar-jhbuild run sugar-emulator -k &

Briefly tested only under Fedora 11. Enjoy,

[1] http://dev.sugarlabs.org/ticket/342
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20090624/c217c726/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sugar-emulator.diff
Type: application/octet-stream
Size: 4189 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20090624/c217c726/attachment.obj 


More information about the Sugar-devel mailing list