@@ -12,17 +12,17 @@
typedef enum QKbdModifier QKbdModifier;
enum QKbdModifier {
- QKBD_MOD_NONE = 0,
+ Q_KBD_MODIFIER_NONE = 0,
- QKBD_MOD_SHIFT,
- QKBD_MOD_CTRL,
- QKBD_MOD_ALT,
- QKBD_MOD_ALTGR,
+ Q_KBD_MODIFIER_SHIFT,
+ Q_KBD_MODIFIER_CTRL,
+ Q_KBD_MODIFIER_ALT,
+ Q_KBD_MODIFIER_ALTGR,
- QKBD_MOD_NUMLOCK,
- QKBD_MOD_CAPSLOCK,
+ Q_KBD_MODIFIER_NUMLOCK,
+ Q_KBD_MODIFIER_CAPSLOCK,
- QKBD_MOD__MAX
+ Q_KBD_MODIFIER__MAX
};
typedef struct QKbdState QKbdState;
@@ -840,7 +840,7 @@ - (bool) handleEventLocked:(NSEvent *)event
* this implementation usable enough.
*/
if (!!(modifiers & NSEventModifierFlagCapsLock) !=
- qkbd_state_modifier_get(kbd, QKBD_MOD_CAPSLOCK)) {
+ qkbd_state_modifier_get(kbd, Q_KBD_MODIFIER_CAPSLOCK)) {
qkbd_state_key_event(kbd, Q_KEY_CODE_CAPS_LOCK, true);
qkbd_state_key_event(kbd, Q_KEY_CODE_CAPS_LOCK, false);
}
@@ -13,7 +13,7 @@ struct QKbdState {
QemuConsole *con;
int key_delay_ms;
DECLARE_BITMAP(keys, Q_KEY_CODE__MAX);
- DECLARE_BITMAP(mods, QKBD_MOD__MAX);
+ DECLARE_BITMAP(mods, Q_KBD_MODIFIER__MAX);
};
static void qkbd_state_modifier_update(QKbdState *kbd,
@@ -67,29 +67,29 @@ void qkbd_state_key_event(QKbdState *kbd, QKeyCode qcode, bool down)
case Q_KEY_CODE_SHIFT:
case Q_KEY_CODE_SHIFT_R:
qkbd_state_modifier_update(kbd, Q_KEY_CODE_SHIFT, Q_KEY_CODE_SHIFT_R,
- QKBD_MOD_SHIFT);
+ Q_KBD_MODIFIER_SHIFT);
break;
case Q_KEY_CODE_CTRL:
case Q_KEY_CODE_CTRL_R:
qkbd_state_modifier_update(kbd, Q_KEY_CODE_CTRL, Q_KEY_CODE_CTRL_R,
- QKBD_MOD_CTRL);
+ Q_KBD_MODIFIER_CTRL);
break;
case Q_KEY_CODE_ALT:
qkbd_state_modifier_update(kbd, Q_KEY_CODE_ALT, Q_KEY_CODE_ALT,
- QKBD_MOD_ALT);
+ Q_KBD_MODIFIER_ALT);
break;
case Q_KEY_CODE_ALT_R:
qkbd_state_modifier_update(kbd, Q_KEY_CODE_ALT_R, Q_KEY_CODE_ALT_R,
- QKBD_MOD_ALTGR);
+ Q_KBD_MODIFIER_ALTGR);
break;
case Q_KEY_CODE_CAPS_LOCK:
if (down) {
- change_bit(QKBD_MOD_CAPSLOCK, kbd->mods);
+ change_bit(Q_KBD_MODIFIER_CAPSLOCK, kbd->mods);
}
break;
case Q_KEY_CODE_NUM_LOCK:
if (down) {
- change_bit(QKBD_MOD_NUMLOCK, kbd->mods);
+ change_bit(Q_KBD_MODIFIER_NUMLOCK, kbd->mods);
}
break;
default:
@@ -222,13 +222,13 @@ int keysym2scancode(kbd_layout_t *k, int keysym,
* interface modifier state. If so, prefer that one.
*/
mods = 0;
- if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_SHIFT)) {
+ if (kbd && qkbd_state_modifier_get(kbd, Q_KBD_MODIFIER_SHIFT)) {
mods |= SCANCODE_SHIFT;
}
- if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_ALTGR)) {
+ if (kbd && qkbd_state_modifier_get(kbd, Q_KBD_MODIFIER_ALTGR)) {
mods |= SCANCODE_ALTGR;
}
- if (kbd && qkbd_state_modifier_get(kbd, QKBD_MOD_CTRL)) {
+ if (kbd && qkbd_state_modifier_get(kbd, Q_KBD_MODIFIER_CTRL)) {
mods |= SCANCODE_CTRL;
}
@@ -44,7 +44,7 @@ void sdl2_process_key(struct sdl2_console *scon,
qkbd_state_key_event(scon->kbd, qcode, ev->type == SDL_KEYDOWN);
if (!qemu_console_is_graphic(con)) {
- bool ctrl = qkbd_state_modifier_get(scon->kbd, QKBD_MOD_CTRL);
+ bool ctrl = qkbd_state_modifier_get(scon->kbd, Q_KBD_MODIFIER_CTRL);
if (ev->type == SDL_KEYDOWN) {
switch (qcode) {
case Q_KEY_CODE_RET:
@@ -1877,8 +1877,8 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
switch (qcode) {
case Q_KEY_CODE_1 ... Q_KEY_CODE_9: /* '1' to '9' keys */
if (vs->vd->dcl.con == NULL && down &&
- qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL) &&
- qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_ALT)) {
+ qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_CTRL) &&
+ qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_ALT)) {
/* Reset the modifiers sent to the current console */
qkbd_state_lift_all_keys(vs->vd->kbd);
console_select(qcode - Q_KEY_CODE_1);
@@ -1899,12 +1899,12 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
toggles numlock away from the VNC window.
*/
if (keysym_is_numlock(vs->vd->kbd_layout, sym & 0xFFFF)) {
- if (!qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK)) {
+ if (!qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_NUMLOCK)) {
trace_vnc_key_sync_numlock(true);
press_key(vs, Q_KEY_CODE_NUM_LOCK);
}
} else {
- if (qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK)) {
+ if (qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_NUMLOCK)) {
trace_vnc_key_sync_numlock(false);
press_key(vs, Q_KEY_CODE_NUM_LOCK);
}
@@ -1919,8 +1919,8 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
toggles capslock away from the VNC window.
*/
int uppercase = !!(sym >= 'A' && sym <= 'Z');
- bool shift = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_SHIFT);
- bool capslock = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CAPSLOCK);
+ bool shift = qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_SHIFT);
+ bool capslock = qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_CAPSLOCK);
if (capslock) {
if (uppercase == shift) {
trace_vnc_key_sync_capslock(false);
@@ -1936,8 +1936,8 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
qkbd_state_key_event(vs->vd->kbd, qcode, down);
if (!qemu_console_is_graphic(NULL)) {
- bool numlock = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_NUMLOCK);
- bool control = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL);
+ bool numlock = qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_NUMLOCK);
+ bool control = qkbd_state_modifier_get(vs->vd->kbd, Q_KBD_MODIFIER_CTRL);
/* QEMU console emulation */
if (down) {
switch (keycode) {
In order to QAPI'fy QKbdModifier in the next commit, rename its definitions to a QAPI-ready format. Mechanical change doing: $ sed -i -e s/QKBD_MOD_/Q_KBD_MODIFIER_/g $(git grep -l QKBD_MOD_) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/ui/kbd-state.h | 16 ++++++++-------- ui/cocoa.m | 2 +- ui/kbd-state.c | 14 +++++++------- ui/keymaps.c | 6 +++--- ui/sdl2-input.c | 2 +- ui/vnc.c | 16 ++++++++-------- 6 files changed, 28 insertions(+), 28 deletions(-)