1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
From cad4f9b0712b7816624636d56feebcfebd3d6025 Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Mon, 23 Jun 2025 09:59:14 +0200
Subject: [PATCH 5/7] src/keyboard-lomiri.c: For OSK layouts, update
'enabled-languages' gsettings and move the newly selected 'active-language'
to the top.
Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
src/keyboard-lomiri.c | 51 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/keyboard-lomiri.c b/src/keyboard-lomiri.c
index ae2f7961..176d576b 100644
--- a/src/keyboard-lomiri.c
+++ b/src/keyboard-lomiri.c
@@ -373,7 +373,7 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
{
gchar *sId = g_slist_nth_data (pKeyboard->pPrivate->lLayoutRecOSK, nLayout);
guint nId = 0;
- gchar *sLayout = NULL;
+ gchar *sLayoutOSK = NULL;
while (LOMIRI_TO_ISO[nId][0] != NULL)
{
@@ -381,7 +381,7 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
if (bEqual)
{
- sLayout = LOMIRI_TO_ISO[nId][0];
+ sLayoutOSK = LOMIRI_TO_ISO[nId][0];
break;
}
@@ -389,12 +389,53 @@ void keyboard_SetLayoutSoftware(Keyboard *pKeyboard, gint nLayout)
nId++;
}
- if (!sLayout)
+ if (!sLayoutOSK)
{
- sLayout = sId;
+ sLayoutOSK = sId;
+ }
+
+ guint nEnabledLayoutsOSK = g_slist_length (pKeyboard->pPrivate->lLayoutRecOSK);
+
+ GVariantBuilder cLayoutsOSKBuilder;
+ g_variant_builder_init (&cLayoutsOSKBuilder, G_VARIANT_TYPE ("as"));
+ if (sLayoutOSK)
+ {
+ g_variant_builder_add (&cLayoutsOSKBuilder, "s", sLayoutOSK);
+ }
+
+ for (guint nLayout = 0; nLayout < nEnabledLayoutsOSK; nLayout++)
+ {
+ gchar *sIdIso = g_slist_nth_data (pKeyboard->pPrivate->lLayoutRecOSK, nLayout);
+
+ nId = 0;
+ gchar *sIdLomiri = NULL;
+ while (LOMIRI_TO_ISO[nId][0] != NULL)
+ {
+ gboolean bEqual = g_str_equal (LOMIRI_TO_ISO[nId][1], sIdIso);
+
+ if (bEqual)
+ {
+ sIdLomiri = LOMIRI_TO_ISO[nId][0];
+
+ break;
+ }
+
+ nId++;
+ }
+ if (!sIdLomiri)
+ {
+ sIdLomiri = sIdIso;
+ }
+
+ if (strcmp(sIdLomiri, sLayoutOSK))
+ {
+ g_variant_builder_add (&cLayoutsOSKBuilder, "s", sIdLomiri);
+ }
}
+ GVariant *pEnabledLayoutsOSK = g_variant_builder_end (&cLayoutsOSKBuilder);
- g_settings_set_string (pKeyboard->pPrivate->pMaliitSettings, "active-language", sLayout);
+ g_settings_set_string (pKeyboard->pPrivate->pMaliitSettings, "active-language", sLayoutOSK);
+ g_settings_set_value (pKeyboard->pPrivate->pMaliitSettings, "enabled-languages", pEnabledLayoutsOSK);
}
else
{
--
2.47.2
|