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.
This commit is contained in:
Matthias Clasen 2013-03-22 18:26:33 -04:00
parent 659ae5172f
commit 1ea760fbc9

View File

@ -70,6 +70,7 @@ struct _GdkWaylandDeviceData
guint32 repeat_timer; guint32 repeat_timer;
guint32 repeat_key; guint32 repeat_key;
guint32 repeat_count; guint32 repeat_count;
GSettings *keyboard_settings;
DataOffer *drag_offer; DataOffer *drag_offer;
DataOffer *selection_offer; DataOffer *selection_offer;
@ -938,10 +939,22 @@ get_key_repeat (GdkWaylandDeviceData *device,
guint *delay, guint *delay,
guint *interval) guint *interval)
{ {
*delay = 400; gboolean repeat;
*interval = 80;
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 static gboolean
@ -1165,6 +1178,21 @@ static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities, 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 void
_gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager, _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
struct wl_seat *wl_seat) struct wl_seat *wl_seat)
@ -1194,6 +1222,8 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
device->pointer_surface = device->pointer_surface =
wl_compositor_create_surface (display_wayland->compositor); wl_compositor_create_surface (display_wayland->compositor);
init_settings (device);
} }
static void static void