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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
From b5cdd12b186f27cee8cfdfb9ff84c15ca8913582 Mon Sep 17 00:00:00 2001
From: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date: Sun, 22 Jun 2025 21:42:43 +0200
Subject: [PATCH 4/7] src/keyboard*: Remember nLayout and nLayoutOSK
separately.
Signed-off-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
---
src/keyboard-lomiri.c | 26 ++++++++++++++++++++------
src/keyboard-x11.c | 3 ++-
src/keyboard.h | 2 +-
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/keyboard-lomiri.c b/src/keyboard-lomiri.c
index d222a06a..ae2f7961 100644
--- a/src/keyboard-lomiri.c
+++ b/src/keyboard-lomiri.c
@@ -61,6 +61,7 @@ struct _KeyboardPrivate
{
GHashTable *lLayouts;
guint nLayout;
+ guint nLayoutOSK;
GSList *lLayoutRec;
GSList *lLayoutRecOSK;
GSList *lUsers;
@@ -220,26 +221,37 @@ guint keyboard_GetNumLayouts(Keyboard *pKeyboard, gboolean bOSK)
return nLayouts;
}
-guint keyboard_GetLayoutIndex (Keyboard *pKeyboard)
+guint keyboard_GetLayoutIndex (Keyboard *pKeyboard, gboolean bOSK)
{
- return pKeyboard->pPrivate->nLayout;
+ if (bOSK)
+ {
+ return pKeyboard->pPrivate->nLayoutOSK;
+ }
+ else
+ {
+ return pKeyboard->pPrivate->nLayout;
+ }
}
void keyboard_GetLayout(Keyboard *pKeyboard, gboolean bOSK, gint nLayout, gchar **pLanguage, gchar **pDescription, gchar **pId)
{
- if (nLayout == -1)
- {
- nLayout = pKeyboard->pPrivate->nLayout;
- }
GSList *lLayoutRec = NULL;
if (bOSK)
{
+ if (nLayout == -1)
+ {
+ nLayout = pKeyboard->pPrivate->nLayoutOSK;
+ }
lLayoutRec = pKeyboard->pPrivate->lLayoutRecOSK;
}
else
{
+ if (nLayout == -1)
+ {
+ nLayout = pKeyboard->pPrivate->nLayout;
+ }
lLayoutRec = pKeyboard->pPrivate->lLayoutRec;
}
@@ -695,6 +707,8 @@ static void keyboard_init(Keyboard *self)
rxkb_context_unref(pContext);
+ self->pPrivate->nLayoutOSK = 0;
+
// Lomiri-specific layouts
const gchar *LAYOUTS[][3] =
{
diff --git a/src/keyboard-x11.c b/src/keyboard-x11.c
index 89e78517..75dabd6d 100644
--- a/src/keyboard-x11.c
+++ b/src/keyboard-x11.c
@@ -42,6 +42,7 @@ struct _KeyboardPrivate
GHashTable *lLayouts;
Display *pDisplay;
guint nLayout;
+ guint nLayoutOSK;
gint nXkbEventType;
XklConfigRec *pConfigRec;
GSList *lLayoutRec;
@@ -385,7 +386,7 @@ guint keyboard_GetNumLayouts(Keyboard *pKeyboard, gboolean bOSK)
return nLayouts;
}
-guint keyboard_GetLayoutIndex (Keyboard *pKeyboard)
+guint keyboard_GetLayoutIndex (Keyboard *pKeyboard, gboolean bOSK)
{
return pKeyboard->pPrivate->nLayout;
}
diff --git a/src/keyboard.h b/src/keyboard.h
index fd30cf6d..206c4bf3 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -47,7 +47,7 @@ GType keyboard_get_type(void);
Keyboard* keyboard_new();
void keyboard_AddSource(Keyboard *pKeyboard);
guint keyboard_GetNumLayouts(Keyboard *pKeyboard, gboolean bOSK);
-guint keyboard_GetLayoutIndex (Keyboard *pKeyboard);
+guint keyboard_GetLayoutIndex (Keyboard *pKeyboard, gboolean bOSK);
void keyboard_GetLayout(Keyboard *pKeyboard, gboolean bOSK, gint nLayout, gchar **pLanguage, gchar **pDescription, gchar **pId);
void keyboard_SetLayout(Keyboard *pKeyboard, gint nLayout, gboolean bOSK);
gboolean keyboard_hasHardwareKeyboard(Keyboard *pKeyboard);
--
2.47.2
|