[gtk/inspector-layouts: 4/5] inspector: Show keyboard layouts
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/inspector-layouts: 4/5] inspector: Show keyboard layouts
- Date: Mon, 3 May 2021 01:02:15 +0000 (UTC)
commit dfecc8fe0271b5381d619dd5fa471cf147f6753c
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 26 00:15:34 2021 -0400
inspector: Show keyboard layouts
gtk/inspector/general.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index 3bc2c5a2cd..fa485ac239 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -51,6 +51,7 @@
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
#include <epoxy/egl.h>
+#include <xkbcommon/xkbcommon.h>
#endif
#ifdef GDK_WINDOWING_BROADWAY
@@ -754,6 +755,26 @@ add_device (GtkInspectorGeneral *gen,
g_free (text);
}
+#ifdef GDK_WINDOWING_WAYLAND
+ if (GDK_IS_WAYLAND_DEVICE (device) &&
+ gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
+ {
+ struct xkb_keymap *keymap = gdk_wayland_device_get_xkb_keymap (device);
+ GString *s;
+
+ s = g_string_new ("");
+ for (int i = 0; i < xkb_keymap_num_layouts (keymap); i++)
+ {
+ if (s->len > 0)
+ g_string_append (s, ", ");
+ g_string_append (s, xkb_keymap_layout_get_name (keymap, i));
+ }
+
+ add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Layouts", s->str, 20);
+ g_string_free (s, TRUE);
+ }
+#endif
+
g_type_class_unref (class);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]