summaryrefslogtreecommitdiff
path: root/libgnomekbd
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2022-01-08 11:40:00 -0500
committerCorentin Noël <tintou@noel.tf>2022-06-22 07:22:17 +0000
commitaee49af900b2df48a95dcd7dc8c5dffcbc90d059 (patch)
tree7fe32b53b8f4904e7d510c2556c190d12283cc64 /libgnomekbd
parent826cc95889b0a5bb2507d32a2960d2e4eac7a476 (diff)
downloadlibgnomekbd-aee49af900b2df48a95dcd7dc8c5dffcbc90d059.tar.gz
GkbdKeyboardDrawing: set_key_label_in_layout returns Bidi information
This information (whether a symbol is LTR or RTL) will be useful in figuring out how to align the symbol on the drawing of the key.
Diffstat (limited to 'libgnomekbd')
-rw-r--r--libgnomekbd/gkbd-keyboard-drawing.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 9271c69..199199b 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -666,12 +666,13 @@ set_markup (GkbdKeyboardDrawingRenderContext * context, gchar * txt)
}
}
-static void
+static PangoDirection
set_key_label_in_layout (GkbdKeyboardDrawingRenderContext * context,
guint keyval)
{
gchar buf[5];
gunichar uc;
+ PangoDirection dir = PANGO_DIRECTION_LTR;
switch (keyval) {
case GDK_KEY_Scroll_Lock:
@@ -825,6 +826,7 @@ set_key_label_in_layout (GkbdKeyboardDrawingRenderContext * context,
default:
uc = gdk_keyval_to_unicode (keyval);
if (uc != 0 && g_unichar_isgraph (uc)) {
+ dir = pango_unichar_direction (uc);
buf[g_unichar_to_utf8 (uc, buf)] = '\0';
set_markup (context, buf);
} else {
@@ -846,6 +848,7 @@ set_key_label_in_layout (GkbdKeyboardDrawingRenderContext * context,
set_markup (context, "");
}
}
+ return dir;
}