wayland-device: Refactor a bit
Delay the keyboard settings creation until we're delivering the key press. This means we don't have to create the settings for a server that sends us repeat information.
This commit is contained in:
@ -1084,6 +1084,26 @@ translate_keyboard_string (GdkEventKey *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GSettings *
|
||||||
|
get_keyboard_settings (GdkWaylandDeviceData *device)
|
||||||
|
{
|
||||||
|
if (!device->keyboard_settings)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return device->keyboard_settings;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
get_key_repeat (GdkWaylandDeviceData *device,
|
get_key_repeat (GdkWaylandDeviceData *device,
|
||||||
guint *delay,
|
guint *delay,
|
||||||
@ -1091,11 +1111,13 @@ get_key_repeat (GdkWaylandDeviceData *device,
|
|||||||
{
|
{
|
||||||
gboolean repeat;
|
gboolean repeat;
|
||||||
|
|
||||||
if (device->keyboard_settings)
|
GSettings *keyboard_settings = get_keyboard_settings (device);
|
||||||
|
|
||||||
|
if (keyboard_settings)
|
||||||
{
|
{
|
||||||
repeat = g_settings_get_boolean (device->keyboard_settings, "repeat");
|
repeat = g_settings_get_boolean (keyboard_settings, "repeat");
|
||||||
*delay = g_settings_get_uint (device->keyboard_settings, "delay");
|
*delay = g_settings_get_uint (keyboard_settings, "delay");
|
||||||
*interval = g_settings_get_uint (device->keyboard_settings, "repeat-interval");
|
*interval = g_settings_get_uint (keyboard_settings, "repeat-interval");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1565,21 +1587,6 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_devices (GdkWaylandDeviceData *device)
|
init_devices (GdkWaylandDeviceData *device)
|
||||||
{
|
{
|
||||||
@ -1657,7 +1664,6 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
|
|||||||
wl_compositor_create_surface (display_wayland->compositor);
|
wl_compositor_create_surface (display_wayland->compositor);
|
||||||
|
|
||||||
init_devices (device);
|
init_devices (device);
|
||||||
init_settings (device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user