[libgnomekbd] GkbdKeyboardDrawing: set_key_label_in_layout returns Bidi information



commit aee49af900b2df48a95dcd7dc8c5dffcbc90d059
Author: Daniel Kahn Gillmor <dkg fifthhorseman net>
Date:   Sat Jan 8 11:40:00 2022 -0500

    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.

 libgnomekbd/gkbd-keyboard-drawing.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
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;
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]