[gtk+] wayland: Handle the keymap being needed before we know about seats



commit 2d676f32b1043523c31db36f3ccbdefe09c5ad1a
Author: Rob Bradford <rob linux intel com>
Date:   Tue Jan 22 19:08:56 2013 +0000

    wayland: Handle the keymap being needed before we know about seats
    
    In the Wayland backend implementation for gdk_display_get_keymap we enumerate
    the known devices and look for an core keyboard device. These device objects
    are created when we receive the capabilities for the seat. The seat
    capabilities may be received after a request for the keymap so we handle this
    by creating a temporary keymap which we then free later when we have the real
    one.

 gdk/wayland/gdkdisplay-wayland.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index de33525..45e5d5a 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -475,6 +475,7 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
   GdkDeviceManager *device_manager;
   GList *list, *l;
   GdkDevice *core_keyboard = NULL;
+  static GdkKeymap *tmp_keymap = NULL;
 
   device_manager = gdk_display_get_device_manager (display);
   list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
@@ -491,7 +492,18 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
       break;
     }
 
-  return core_keyboard?_gdk_wayland_device_get_keymap (core_keyboard):NULL;
+  if (core_keyboard && tmp_keymap)
+    {
+      g_object_unref (tmp_keymap);
+      tmp_keymap = NULL;
+    }
+
+  if (core_keyboard)
+    return _gdk_wayland_device_get_keymap (core_keyboard);
+
+  tmp_keymap = _gdk_wayland_keymap_new ();
+
+  return tmp_keymap;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]