tags 415451 patch
thanks
Hi,
The problem is the following:
xte needs to convert the user input, e.g. the string '/', to key events.
On a German keyboard this would be the following sequence: press the
shift key, press the '7'-key, release the '7'-key, release the shift
key. The same is the case for a US keyboard with the character '&'.
Therefore xte needs to know the current keyboard layout in order to map
'input string' to 'sequence of key events'.
Currently, this is implemented using a hard-coded table for the US
keyboard layout. So it works for many characters that are generated
using the shift key on a US keyboard (e.g. all capital
letters,':','?','!' etc.), but it does not for other keyboard layouts.
There is also a table for the German keyboard layout, but you have
choose one at compile time, and the Debian package is compiled with the
US layout. This is not very nice.
A workaround would be to send commands with the explicit key sequence.
For example instead of
str http://foo.com/
the following sequence must be sent:
str http:
keydown Shift_L
key 7
keyup Shift_L
keydown Shift_L
key 7
keyup Shift_L
str foo.com
keydown Shift_L
key 7
keyup Shift_L
However, this is quite ugly.
Here I provide a patch to get rid of the hard-coded conversion table.
With this patch, xte queries the current keyboard layout from the
X-server and generates a table with the current mapping at startup. When
processing the 'key' and 'str' commands, it generates the correct key
event sequence for each character.
Additionally, I implemented Unicode support, which means that now you
can send UTF-8 encoded strings with the 'key' and 'str' commands. This
is required, for example, to send the character 'รค', which is frequently
used in German.
PS: Because this package seems the be orphaned, I will try to build a
package with this patch and ask a sponsor to upload it to the archive.
I'm willing to become the maintainer of this package later, if that's in
demand.
Kind regards,
Marco Steinacher
diff -rupN xautomation-0.96/configure.in xautomation-0.96-new/configure.in
--- xautomation-0.96/configure.in 2004-05-13 23:49:02.0 +0200
+++ xautomation-0.96-new/configure.in 2007-09-24 17:34:30.0 +0200
@@ -9,20 +9,6 @@ AC_ARG_ENABLE(debug,
in slower binaries]),
AC_DEFINE(DEBUG_A_LOO))
-AC_ARG_ENABLE(keyboard,
- AC_HELP_STRING([--enable-keyboard=keyboard],
- [Use different keyboard map, default is 'us'. Can be any
- of the kbd_*.h]),
- )
-
-if test "x$enable_keyboard" = "x" ; then
- enable_keyboard=us
-fi
-
-AC_MSG_NOTICE([Using '$enable_keyboard' as keyboard map])
-rm -f kbd.h
-ln -s kbd_$enable_keyboard.h kbd.h
-
# Checks for programs.
AC_PROG_CC
@@ -33,14 +19,14 @@ AC_CHECK_LIB(png, png_read_info)
# Checks for header files.
AC_PATH_X
-AC_CHECK_HEADERS([stdlib.h unistd.h])
+AC_CHECK_HEADERS([stdlib.h unistd.h wchar.h locale.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
# Checks for library functions.
AC_FUNC_MALLOC
-AC_CHECK_FUNCS([bzero])
+AC_CHECK_FUNCS([bzero wmemset mbstowcs])
if test "1$x_libraries" = "1"
then
diff -rupN xautomation-0.96/debian/rules xautomation-0.96-new/debian/rules
--- xautomation-0.96/debian/rules 2007-09-20 18:51:20.0 +0200
+++ xautomation-0.96-new/debian/rules 2007-09-24 17:33:41.0 +0200
@@ -45,7 +45,6 @@ clean:
dh_testdir
dh_testroot
-$(MAKE) distclean
- -rm -f kbd.h
-rm -f *-stamp
dh_clean
diff -rupN xautomation-0.96/kbd_german.h xautomation-0.96-new/kbd_german.h
--- xautomation-0.96/kbd_german.h 2003-02-11 00:54:08.0 +0100
+++ xautomation-0.96-new/kbd_german.h 1970-01-01 01:00:00.0 +0100
@@ -1,65 +0,0 @@
-/* Contributed by Stefan Nickl */
-
-/* Map for German keyboards */
-#define KBDMAP "German"
-
-char *problems[] = { " ", NULL, "space",
- ":", "Shift_L", "colon",
- ";", "Shift_L", "semicolon",
- "<", NULL, "less",
- ">", "Shift_L", "greater",
- "?", "Shift_L", "question",
- "/", "Shift_L", "slash",
- "+", NULL, "plus",
- ",", NULL, "comma",
- "-", NULL, "minus",
- ".", NULL, "period",
- "!", "Shift_L", "exclam",
- "#", NULL, "number",
- "$&