[broadway] Emulate hardware keycodes in keyboard events

We can't really know the client side keymaps, so we use the keysym
as the hardware keycode (essentially claiming to have a keyboard with
one key for all possible keysyms). This is not ideal, but its hard to
do better with no knowledge of the client side keyboard mappings.
(And html keyboard events suck badly...)
This commit is contained in:
Alexander Larsson 2011-04-14 21:13:28 +02:00
parent 7d37534ee2
commit 01da867dac
2 changed files with 32 additions and 7 deletions

View File

@ -259,6 +259,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event->key.window = g_object_ref (window);
event->key.time = message->base.time;
event->key.keyval = message->key.key;
event->key.hardware_keycode = message->key.key;
event->key.length = 0;
gdk_event_set_device (event, display->core_pointer);

View File

@ -119,8 +119,15 @@ gdk_broadway_keymap_get_entries_for_keyval (GdkKeymap *keymap,
GdkKeymapKey **keys,
gint *n_keys)
{
*n_keys = 0;
return FALSE;
if (n_keys)
*n_keys = 1;
if (keys)
{
*keys = g_new0 (GdkKeymapKey, 1);
(*keys)->keycode = keyval;
}
return TRUE;
}
static gboolean
@ -130,15 +137,26 @@ gdk_broadway_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint **keyvals,
gint *n_entries)
{
*n_entries = 0;
return FALSE;
if (n_entries)
*n_entries = 1;
if (keys)
{
*keys = g_new0 (GdkKeymapKey, 1);
(*keys)->keycode = hardware_keycode;
}
if (keyvals)
{
*keyvals = g_new0 (guint, 1);
(*keyvals)[0] = hardware_keycode;
}
return TRUE;
}
static guint
gdk_broadway_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key)
{
return 0;
return key->keycode;
}
@ -152,7 +170,13 @@ gdk_broadway_keymap_translate_keyboard_state (GdkKeymap *keymap,
gint *level,
GdkModifierType *consumed_modifiers)
{
return FALSE;
if (keyval)
*keyval = hardware_keycode;
if (effective_group)
*effective_group = 0;
if (level)
*level = 0;
return TRUE;
}
static void
@ -165,7 +189,7 @@ static gboolean
gdk_broadway_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
return FALSE;
return TRUE;
}
static void