Search
lxdream.org :: lxdream/src/drivers/video_gtk.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_gtk.c
changeset 449:21440948c684
prev443:1163eb5c0590
next477:9a373f2ff009
author nkeynes
date Tue Oct 16 12:38:01 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Modify keyboard input to use unmodified key values only
file annotate diff log raw
1.1 --- a/src/drivers/video_gtk.c Sat Oct 13 04:01:02 2007 +0000
1.2 +++ b/src/drivers/video_gtk.c Tue Oct 16 12:38:01 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: video_gtk.c,v 1.15 2007-10-13 04:01:02 nkeynes Exp $
1.6 + * $Id: video_gtk.c,v 1.16 2007-10-16 12:38:01 nkeynes Exp $
1.7 *
1.8 * The PC side of the video support (responsible for actually displaying /
1.9 * rendering frames)
1.10 @@ -36,13 +36,36 @@
1.11 struct display_driver display_gtk_driver = { "gtk", video_gtk_init, video_gtk_shutdown,
1.12 video_gtk_resolve_keysym,
1.13 NULL, NULL, NULL, NULL, NULL, NULL, NULL };
1.14 -
1.15 +
1.16 +/**
1.17 + * Extract the keyval of the key event if no modifier keys were pressed -
1.18 + * in other words get the keyval of the key by itself. The other way around
1.19 + * would be to use the hardware keysyms directly rather than the keyvals,
1.20 + * but the mapping looks to be messier.
1.21 + */
1.22 +uint16_t video_gtk_unmodified_keyval( GdkEventKey *event )
1.23 +{
1.24 + GdkKeymap *keymap = gdk_keymap_get_default();
1.25 + guint keyval;
1.26 +
1.27 + gdk_keymap_translate_keyboard_state( keymap, event->hardware_keycode, 0, 0, &keyval,
1.28 + NULL, NULL, NULL );
1.29 + return keyval;
1.30 +}
1.31
1.32 gboolean video_gtk_keydown_callback(GtkWidget *widget,
1.33 GdkEventKey *event,
1.34 gpointer user_data)
1.35 {
1.36 - input_event_keydown( event->keyval );
1.37 + input_event_keydown( video_gtk_unmodified_keyval(event) );
1.38 + return TRUE;
1.39 +}
1.40 +
1.41 +gboolean video_gtk_keyup_callback(GtkWidget *widget,
1.42 + GdkEventKey *event,
1.43 + gpointer user_data)
1.44 +{
1.45 + input_event_keyup( video_gtk_unmodified_keyval(event) );
1.46 return TRUE;
1.47 }
1.48
1.49 @@ -54,14 +77,6 @@
1.50 return (uint16_t)val;
1.51 }
1.52
1.53 -gboolean video_gtk_keyup_callback(GtkWidget *widget,
1.54 - GdkEventKey *event,
1.55 - gpointer user_data)
1.56 -{
1.57 - input_event_keyup( event->keyval );
1.58 - return TRUE;
1.59 -}
1.60 -
1.61 gboolean video_gtk_expose_callback(GtkWidget *widget, GdkEventExpose *event, gpointer data )
1.62 {
1.63 gl_redisplay_last();
.