5dcafc6da2
Resolves: #1957754
110 lines
4.3 KiB
Diff
110 lines
4.3 KiB
Diff
From 89b5facb7545c0423673c500343794a6c07fabfe Mon Sep 17 00:00:00 2001
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
Date: Wed, 12 May 2021 15:19:26 -0400
|
|
Subject: [PATCH] input-sources-manager: Fail better if localed isn't available
|
|
|
|
At the moment we assumed the localed proxy will always return valid
|
|
strings. If localed exits, though, there's a small window where the
|
|
properties can return NULL.
|
|
|
|
This commit tries to handle that transient failure better.
|
|
---
|
|
compositor/kiosk-input-sources-manager.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/compositor/kiosk-input-sources-manager.c b/compositor/kiosk-input-sources-manager.c
|
|
index 7bb67b0..49973db 100644
|
|
--- a/compositor/kiosk-input-sources-manager.c
|
|
+++ b/compositor/kiosk-input-sources-manager.c
|
|
@@ -807,80 +807,87 @@ kiosk_input_sources_manager_add_layout (KioskInputSourcesManager *self,
|
|
g_debug ("KioskInputSourcesManager: Keyboard mapping full, starting another one");
|
|
|
|
input_source_group = kiosk_input_sources_manager_add_new_input_source_group (self, options);
|
|
|
|
kiosk_input_source_group_add_layout (input_source_group, xkb_layout, xkb_variant);
|
|
}
|
|
}
|
|
|
|
void
|
|
kiosk_input_sources_manager_add_input_engine (KioskInputSourcesManager *self,
|
|
const char *engine_name,
|
|
const char *options)
|
|
{
|
|
KioskInputSourceGroup *input_source_group = NULL;
|
|
|
|
g_debug ("KioskInputSourcesManager: Adding input engine '%s'", engine_name);
|
|
|
|
input_source_group = kiosk_input_sources_manager_add_new_input_source_group (self, options);
|
|
|
|
kiosk_input_source_group_set_input_engine (input_source_group, engine_name);
|
|
kiosk_input_source_group_set_options (input_source_group, options);
|
|
}
|
|
|
|
|
|
gboolean
|
|
kiosk_input_sources_manager_set_input_sources_from_system_configuration (KioskInputSourcesManager *self)
|
|
{
|
|
KioskInputSourceGroup *old_input_source_group;
|
|
g_autofree char *old_input_engine = NULL;
|
|
g_autofree char *old_selected_layout = NULL;
|
|
+ g_autofree char *localed_name_owner = NULL;
|
|
|
|
const char *layouts_string = NULL;
|
|
g_auto (GStrv) layouts = NULL;
|
|
size_t number_of_layouts = 0;
|
|
|
|
const char *variants_string = NULL;
|
|
g_auto (GStrv) variants = NULL;
|
|
size_t number_of_variants = 0;
|
|
|
|
const char *options = NULL;
|
|
size_t i, j;
|
|
|
|
gboolean input_source_group_active;
|
|
|
|
g_return_val_if_fail (KIOSK_IS_INPUT_SOURCES_MANAGER (self), FALSE);
|
|
|
|
if (self->locale_proxy == NULL) {
|
|
return FALSE;
|
|
}
|
|
|
|
+ localed_name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (self->locale_proxy));
|
|
+
|
|
+ if (localed_name_owner == NULL) {
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
g_debug ("KioskInputSourcesManager: Setting keymap from system configuration");
|
|
|
|
layouts_string = sd_locale1_get_x11_layout (self->locale_proxy);
|
|
g_debug ("KioskInputSourcesManager: System layout is '%s'", layouts_string);
|
|
|
|
layouts = g_strsplit (layouts_string, ",", -1);
|
|
number_of_layouts = g_strv_length (layouts);
|
|
|
|
options = sd_locale1_get_x11_options (self->locale_proxy);
|
|
g_debug ("KioskInputSourcesManager: System layout options are '%s'", options);
|
|
|
|
variants_string = sd_locale1_get_x11_variant (self->locale_proxy);
|
|
g_debug ("KioskInputSourcesManager: System layout variant is '%s'", variants_string);
|
|
variants = g_strsplit (variants_string, ",", -1);
|
|
number_of_variants = g_strv_length (variants);
|
|
|
|
if (number_of_layouts < number_of_variants) {
|
|
g_debug ("KioskInputSourcesManager: There is a layout variant mismatch");
|
|
return FALSE;
|
|
}
|
|
|
|
old_input_source_group = kiosk_input_sources_manager_get_selected_input_source_group (self);
|
|
|
|
if (old_input_source_group != NULL) {
|
|
old_input_engine = g_strdup (kiosk_input_source_group_get_input_engine (old_input_source_group));
|
|
old_selected_layout = kiosk_input_source_group_get_selected_layout (old_input_source_group);
|
|
}
|
|
|
|
kiosk_input_sources_manager_clear_input_sources (self);
|
|
|
|
--
|
|
2.31.1
|
|
|