aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/curses.c2
-rw-r--r--ui/keymaps.c8
-rw-r--r--ui/keymaps.h3
-rw-r--r--ui/vnc.c5
4 files changed, 8 insertions, 10 deletions
diff --git a/ui/curses.c b/ui/curses.c
index f4e7a12..5468758 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -273,7 +273,7 @@ static void curses_refresh(DisplayChangeListener *dcl)
}
keycode = keysym2scancode(kbd_layout, keysym & KEYSYM_MASK,
- false, false, false);
+ NULL);
if (keycode == 0)
continue;
diff --git a/ui/keymaps.c b/ui/keymaps.c
index 6e44f73..c8b2135 100644
--- a/ui/keymaps.c
+++ b/ui/keymaps.c
@@ -188,7 +188,7 @@ kbd_layout_t *init_keyboard_layout(const name2keysym_t *table,
int keysym2scancode(kbd_layout_t *k, int keysym,
- bool shift, bool altgr, bool ctrl)
+ QKbdState *kbd)
{
static const uint32_t mask =
SCANCODE_SHIFT | SCANCODE_ALTGR | SCANCODE_CTRL;
@@ -220,13 +220,13 @@ int keysym2scancode(kbd_layout_t *k, int keysym,
* If so, prefer that one.
*/
mods = 0;
- if (shift) {
+ if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_SHIFT)) {
mods |= SCANCODE_SHIFT;
}
- if (altgr) {
+ if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_ALTGR)) {
mods |= SCANCODE_ALTGR;
}
- if (ctrl) {
+ if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_CTRL)) {
mods |= SCANCODE_CTRL;
}
diff --git a/ui/keymaps.h b/ui/keymaps.h
index 4e9c87f..d8652b8 100644
--- a/ui/keymaps.h
+++ b/ui/keymaps.h
@@ -26,6 +26,7 @@
#define QEMU_KEYMAPS_H
#include "qemu-common.h"
+#include "ui/kbd-state.h"
typedef struct {
const char* name;
@@ -55,7 +56,7 @@ typedef struct kbd_layout_t kbd_layout_t;
kbd_layout_t *init_keyboard_layout(const name2keysym_t *table,
const char *language, Error **errp);
int keysym2scancode(kbd_layout_t *k, int keysym,
- bool shift, bool altgr, bool ctrl);
+ QKbdState *kbd);
int keycode_is_keypad(kbd_layout_t *k, int keycode);
int keysym_is_numlock(kbd_layout_t *k, int keysym);
diff --git a/ui/vnc.c b/ui/vnc.c
index 8e52b99..f66ed53 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1973,9 +1973,6 @@ static const char *code2name(int keycode)
static void key_event(VncState *vs, int down, uint32_t sym)
{
- bool shift = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_SHIFT);
- bool altgr = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_ALTGR);
- bool ctrl = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL);
int keycode;
int lsym = sym;
@@ -1984,7 +1981,7 @@ static void key_event(VncState *vs, int down, uint32_t sym)
}
keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF,
- shift, altgr, ctrl) & SCANCODE_KEYMASK;
+ vs->vd->kbd) & SCANCODE_KEYMASK;
trace_vnc_key_event_map(down, sym, keycode, code2name(keycode));
do_key_event(vs, down, keycode, sym);
}