Search
lxdream.org :: lxdream :: r271:2ec052d24881
lxdream 0.9.1
released Jun 29
Download Now
changeset271:2ec052d24881
parent270:1e151174ef51
child272:fb6be85235e8
authornkeynes
dateThu Jan 11 06:51:52 2007 +0000 (13 years ago)
Allow keyspecs to consist of a comma-separated list of keysyms
src/display.c
1.1 --- a/src/display.c Thu Jan 11 06:51:11 2007 +0000
1.2 +++ b/src/display.c Thu Jan 11 06:51:52 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: display.c,v 1.2 2006-06-18 12:01:50 nkeynes Exp $
1.6 + * $Id: display.c,v 1.3 2007-01-11 06:51:52 nkeynes Exp $
1.7 *
1.8 * Generic support for keyboard and other input sources. The active display
1.9 * driver is expected to deliver events here, where they're translated and
1.10 @@ -65,16 +65,23 @@
1.11 gboolean input_register_key( const gchar *keysym, input_key_callback_t callback,
1.12 void *data, uint32_t value )
1.13 {
1.14 + int i;
1.15 if( display_driver == NULL || keysym == NULL )
1.16 return FALSE; /* No display driver */
1.17 - uint16_t keycode = display_driver->resolve_keysym(keysym);
1.18 - if( keycode == 0 )
1.19 - return FALSE; /* Invalid keysym */
1.20 -
1.21 - struct keymap_entry *key = input_create_key( keycode );
1.22 - key->callback = callback;
1.23 - key->data = data;
1.24 - key->value = value;
1.25 + gchar **strv = g_strsplit(keysym, ",", 16);
1.26 + gchar **s = strv;
1.27 + while( *s != NULL ) {
1.28 + uint16_t keycode = display_driver->resolve_keysym(g_strstrip(*s));
1.29 + if( keycode == 0 )
1.30 + return FALSE; /* Invalid keysym */
1.31 +
1.32 + struct keymap_entry *key = input_create_key( keycode );
1.33 + key->callback = callback;
1.34 + key->data = data;
1.35 + key->value = value;
1.36 + s++;
1.37 + }
1.38 + g_strfreev(strv);
1.39 return TRUE;
1.40 }
1.41
.