summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJezerM <amyuki4@icloud.com>2022-03-09 11:04:47 -0600
committerRobert Ancell <robert.ancell@gmail.com>2022-05-24 10:11:45 +1200
commita3f5981b35b19625daf0c67c2a5d999f8ee74222 (patch)
treee6d4a6c0d73052ba24443d153d98f732e1465ec9
parent224b090ed78abbf43ca75f825dba78966c97c082 (diff)
downloadlightdm-git-a3f5981b35b19625daf0c67c2a5d999f8ee74222.tar.gz
Fix inconsistency between lightdm_get_layout and lightdm_set_layout
Use the global xkl_config to set the new layout instead of creating a new one Set the default_layout as dmlayout, allowing to get the new layout with lightdm_get_layout
-rw-r--r--liblightdm-gobject/layout.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/liblightdm-gobject/layout.c b/liblightdm-gobject/layout.c
index ff8d8749..eec8f787 100644
--- a/liblightdm-gobject/layout.c
+++ b/liblightdm-gobject/layout.c
@@ -148,6 +148,7 @@ void
lightdm_set_layout (LightDMLayout *dmlayout)
{
g_return_if_fail (dmlayout != NULL);
+ lightdm_get_layouts();
g_debug ("Setting keyboard layout to '%s'", lightdm_layout_get_name (dmlayout));
@@ -155,17 +156,16 @@ lightdm_set_layout (LightDMLayout *dmlayout)
g_autofree gchar *variant = NULL;
parse_layout_string (lightdm_layout_get_name (dmlayout), &layout, &variant);
- XklConfigRec *config = xkl_config_rec_new ();
- config->layouts = g_malloc (sizeof (gchar *) * 2);
- config->variants = g_malloc (sizeof (gchar *) * 2);
- config->model = g_strdup (xkl_config->model);
- config->layouts[0] = g_steal_pointer (&layout);
- config->layouts[1] = NULL;
- config->variants[0] = g_steal_pointer (&variant);
- config->variants[1] = NULL;
- if (!xkl_config_rec_activate (config, xkl_engine))
+ if (layouts && xkl_config)
+ {
+ xkl_config->layouts[0] = g_steal_pointer(&layout);
+ xkl_config->layouts[1] = NULL;
+ xkl_config->variants[0] = g_steal_pointer(&variant);
+ xkl_config->variants[1] = NULL;
+ default_layout = dmlayout;
+ }
+ if (!xkl_config_rec_activate (xkl_config, xkl_engine))
g_warning ("Failed to activate XKL config");
- g_object_unref (config);
}
/**