From 39b1efc45ef974bd99ab195c155a4e593b038760 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 16 Apr 2021 00:29:00 +0200 Subject: src/keyboard.c: Get languages via lookupLanguage() --- src/keyboard.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/keyboard.c b/src/keyboard.c index e88a3583..11c6d93f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -16,6 +16,7 @@ #include #include +#include "languages.h" #include "keyboard.h" enum @@ -165,13 +166,13 @@ static void onParseLayouts(XklConfigRegistry *pRegistry, const XklConfigItem * p if (pLayoutParser->sLayout) { pLayout->sId = g_strjoin("+", pLayoutParser->sLayout, pItem->name, NULL); - pLayout->sLanguage = g_strdup(pLayoutParser->sLanguage); + pLayout->sLanguage = g_strdup(lookupLanguage(pLayout->sId)); pLayout->sDescription = g_strdup(pItem->description); } else { pLayout->sId = g_strdup(pItem->name); - pLayout->sLanguage = g_strdup(pItem->short_description); + pLayout->sLanguage = g_strdup(lookupLanguage(pLayout->sId)); pLayout->sDescription = g_strdup(pItem->description); } @@ -182,7 +183,7 @@ static void onParseLayouts(XklConfigRegistry *pRegistry, const XklConfigItem * p LayoutParser cLayoutParser; cLayoutParser.sLayout = pItem->name; cLayoutParser.pKeyboard = pLayoutParser->pKeyboard; - cLayoutParser.sLanguage = pItem->short_description; + cLayoutParser.sLanguage = lookupLanguage(cLayoutParser.sLayout); xkl_config_registry_foreach_layout_variant(pRegistry, pItem->name, onParseLayouts, &cLayoutParser); } @@ -237,7 +238,7 @@ void keyboard_GetLayout(Keyboard *pKeyboard, gint nLayout, gchar **pLanguage, gc if (pLanguage != NULL) { - *pLanguage = g_strndup(pLayout->sLanguage, 2); + *pLanguage = g_strdup(pLayout->sLanguage); } if (pDescription != NULL) -- cgit v1.2.3