[gtk+] wayland: Make key repeat configurable



commit 1ea760fbc9f8192f4ec6779cd08ea360d3ea07ca
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 22 18:26:33 2013 -0400

    wayland: Make key repeat configurable
    
    These might be candidates for a future settings interface; until
    then, we use GSettings directly. Note again that we are careful
    to avoid a dependency on GNOME schemas.

 gdk/wayland/gdkdevice-wayland.c |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 74cf67c..f512888 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -70,6 +70,7 @@ struct _GdkWaylandDeviceData
   guint32 repeat_timer;
   guint32 repeat_key;
   guint32 repeat_count;
+  GSettings *keyboard_settings;
 
   DataOffer *drag_offer;
   DataOffer *selection_offer;
@@ -938,10 +939,22 @@ get_key_repeat (GdkWaylandDeviceData *device,
                 guint                *delay,
                 guint                *interval)
 {
-  *delay = 400;
-  *interval = 80;
+  gboolean repeat;
 
-  return TRUE;
+  if (device->keyboard_settings)
+    {
+      repeat = g_settings_get_boolean (device->keyboard_settings, "repeat");
+      *delay = g_settings_get_uint (device->keyboard_settings, "delay");
+      *interval = g_settings_get_uint (device->keyboard_settings, "repeat-interval");
+    }
+  else
+    {
+      repeat = TRUE;
+      *delay = 400;
+      *interval = 80;
+    }
+
+  return repeat;
 }
 
 static gboolean
@@ -1165,6 +1178,21 @@ static const struct wl_seat_listener seat_listener = {
     seat_handle_capabilities,
 };
 
+static void
+init_settings (GdkWaylandDeviceData *device)
+{
+  GSettingsSchemaSource *source;
+  GSettingsSchema *schema;
+
+  source = g_settings_schema_source_get_default ();
+  schema = g_settings_schema_source_lookup (source, "org.gnome.settings-daemon.peripherals.keyboard", FALSE);
+  if (schema != NULL)
+    {
+      device->keyboard_settings = g_settings_new_full (schema, NULL, NULL);
+      g_settings_schema_unref (schema);
+    }
+}
+
 void
 _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
                                        struct wl_seat *wl_seat)
@@ -1194,6 +1222,8 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
 
   device->pointer_surface =
     wl_compositor_create_surface (display_wayland->compositor);
+
+  init_settings (device);
 }
 
 static void


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