aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-04-15 16:17:54 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-04-15 16:17:54 +0200
commit168c57b57f2fb4440943d4e672dee4ca34f060b8 (patch)
treedbd07001ebf4927a92a054fd18a613c57173cc4d
parent2c6f46ddb8c2b76558f5145850fd4d339a66ba3a (diff)
downloadfbida-168c57b57f2fb4440943d4e672dee4ca34f060b8.tar.gz
xkb: add xkb_init() to kbd.c
-rw-r--r--fbcon.c15
-rw-r--r--kbd.c18
-rw-r--r--kbd.h1
-rw-r--r--meson.build8
4 files changed, 24 insertions, 18 deletions
diff --git a/fbcon.c b/fbcon.c
index c63c47f..4965472 100644
--- a/fbcon.c
+++ b/fbcon.c
@@ -644,20 +644,7 @@ int main(int argc, char *argv[])
/* init udev + xkbcommon */
xkb_configure();
- xkb_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
- xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
- XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!xkb_map) {
- xkb_layout.variant = NULL;
- xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
- XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!xkb_map) {
- xkb_layout.layout = "us";
- xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
- XKB_KEYMAP_COMPILE_NO_FLAGS);
- }
- }
- xkb_state = xkb_state_new(xkb_map);
+ xkb_init();
/* init terminal emulation */
fbcon_winsize(&win);
diff --git a/kbd.c b/kbd.c
index 7290d46..9398b8f 100644
--- a/kbd.c
+++ b/kbd.c
@@ -54,6 +54,24 @@ void xkb_configure(void)
fclose(fp);
}
+void xkb_init(void)
+{
+ xkb_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+ xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!xkb_map) {
+ xkb_layout.variant = NULL;
+ xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!xkb_map) {
+ xkb_layout.layout = "us";
+ xkb_map = xkb_keymap_new_from_names(xkb_ctx, &xkb_layout,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ }
+ }
+ xkb_state = xkb_state_new(xkb_map);
+}
+
/* ---------------------------------------------------------------------- */
struct termctrl {
diff --git a/kbd.h b/kbd.h
index beb5bfb..f99aa2a 100644
--- a/kbd.h
+++ b/kbd.h
@@ -19,6 +19,7 @@ extern struct xkb_state *xkb_state;
extern struct xkb_rule_names xkb_layout;
void xkb_configure(void);
+void xkb_init(void);
void kbd_init(int use_libinput, dev_t gfx);
int kbd_wait(int timeout);
diff --git a/meson.build b/meson.build
index e8239de..49d29d8 100644
--- a/meson.build
+++ b/meson.build
@@ -93,7 +93,7 @@ fbi_srcs = [ 'fbi.c', 'fb-gui.c', 'desktop.c',
trans_src, read_srcs ]
fbi_deps = [ drm_dep, pixman_dep, cairo_dep,
exif_dep, image_deps,
- math_dep, udev_dep, input_dep ]
+ math_dep, udev_dep, input_dep, xkb_dep ]
executable('fbi',
sources : fbi_srcs,
@@ -125,7 +125,7 @@ fbpdf_srcs = [ 'fbpdf.c', 'parseconfig.c', 'fbiconfig.c',
'vt.c', 'kbd.c', 'fbtools.c', 'drmtools.c', 'gfx.c' ]
fbpdf_deps = [ drm_dep, gbm_dep, epoxy_dep,
pixman_dep, poppler_dep, cairo_dep,
- udev_dep, input_dep ]
+ udev_dep, input_dep, xkb_dep ]
executable('fbpdf',
sources : fbpdf_srcs,
@@ -149,12 +149,12 @@ endif
# build kbdtest
executable('kbdtest',
sources : [ 'kbdtest.c', 'kbd.c' ],
- dependencies : [ udev_dep, input_dep, systemd_dep ] )
+ dependencies : [ udev_dep, input_dep, xkb_dep, systemd_dep ] )
# build vttest
executable('vttest',
sources : [ 'vttest.c', 'kbd.c', 'logind.c' ],
- dependencies : [ udev_dep, input_dep, systemd_dep ] )
+ dependencies : [ udev_dep, input_dep, xkb_dep, systemd_dep ] )
# build ida
mkfallback = find_program('scripts/fallback.pl')