wayland: Refactor the keymap handling so it is associated with device

Although GDK expects the keymap to be associated with the display under
Wayland this is really associated with the input device so expose this by
finding the first keyboard device.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
This commit is contained in:
José Dapena Paz
2012-07-16 19:02:41 +01:00
committed by Rob Bradford
parent fb76a0a000
commit d2267824b3
4 changed files with 65 additions and 71 deletions

View File

@ -536,15 +536,26 @@ gdk_wayland_display_event_data_free (GdkDisplay *display,
GdkKeymap *
_gdk_wayland_display_get_keymap (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland;
GdkDeviceManager *device_manager;
GList *list, *l;
GdkDevice *core_keyboard = NULL;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
display_wayland = GDK_WAYLAND_DISPLAY (display);
device_manager = gdk_display_get_device_manager (display);
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
if (!display_wayland->keymap)
display_wayland->keymap = _gdk_wayland_keymap_new (display);
for (l = list; l; l = l->next)
{
GdkDevice *device;
device = list->data;
return display_wayland->keymap;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
core_keyboard = device;
break;
}
return core_keyboard?_gdk_wayland_device_get_keymap (core_keyboard):NULL;
}
static void