]> Git Repo - qemu.git/commitdiff
ui: fix keymap file search in input-barrier object
authorLaurent Vivier <[email protected]>
Mon, 23 Sep 2019 22:06:58 +0000 (00:06 +0200)
committerGerd Hoffmann <[email protected]>
Fri, 18 Oct 2019 08:40:46 +0000 (10:40 +0200)
If we try to start QEMU with "-k en-us", qemu prints a message and exits
with:

    qemu-system-i386: could not read keymap file: 'en-us'

It's because this function is called way too early, before
qemu_add_data_dir() is called, and so qemu_find_file() fails.

To fix that, move init_keyboard_layout() from the class init function to the
instance init function.

Reported-by: Anthony PERARD <[email protected]>
Reviewed-by: Anthony PERARD <[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
Message-id: 20190923220658[email protected]
Fixes: 6105683da35b ("ui: add an embedded Barrier client")
Signed-off-by: Laurent Vivier <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
ui/input-barrier.c

index a2c961f285a4674f36791682d546098293c7f8f0..fe35049b83a2ea1c1d39d7222c096f2b04149877 100644 (file)
@@ -682,6 +682,13 @@ static void input_barrier_instance_init(Object *obj)
 {
     InputBarrier *ib = INPUT_BARRIER(obj);
 
+    /* always use generic keymaps */
+    if (keyboard_layout && !kbd_layout) {
+        /* We use X11 key id, so use VNC name2keysym */
+        kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout,
+                                          &error_fatal);
+    }
+
     ib->saddr.type = SOCKET_ADDRESS_TYPE_INET;
     ib->saddr.u.inet.host = g_strdup("localhost");
     ib->saddr.u.inet.port = g_strdup("24800");
@@ -719,13 +726,6 @@ static void input_barrier_class_init(ObjectClass *oc, void *data)
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
 
     ucc->complete = input_barrier_complete;
-
-    /* always use generic keymaps */
-    if (keyboard_layout) {
-        /* We use X11 key id, so use VNC name2keysym */
-        kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout,
-                                          &error_fatal);
-    }
 }
 
 static const TypeInfo input_barrier_info = {
This page took 0.02407 seconds and 4 git commands to generate.