mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180409-pull-request' into staging
sdl2: fix kbd regression (compared to sdl1), cleanups. # gpg: Signature made Mon 09 Apr 2018 10:40:21 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20180409-pull-request: sdl2: drop dead code sdl2: drop QEMU_KEY_BACKSPACE special case sdl2: enable ctrl modifier keys for text consoles sdl2: track kbd modifier state unconditionally ui: add ctrl modifier support to kbd_put_qcode_console() sdl2: Remove unused epoxy include Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -99,7 +99,7 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict);
|
||||
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407
|
||||
|
||||
void kbd_put_keysym_console(QemuConsole *s, int keysym);
|
||||
bool kbd_put_qcode_console(QemuConsole *s, int qcode);
|
||||
bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl);
|
||||
void kbd_put_string_console(QemuConsole *s, const char *str, int len);
|
||||
void kbd_put_keysym(int keysym);
|
||||
|
||||
|
||||
+13
-2
@@ -1191,11 +1191,22 @@ static const int qcode_to_keysym[Q_KEY_CODE__MAX] = {
|
||||
[Q_KEY_CODE_BACKSPACE] = QEMU_KEY_BACKSPACE,
|
||||
};
|
||||
|
||||
bool kbd_put_qcode_console(QemuConsole *s, int qcode)
|
||||
static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX] = {
|
||||
[Q_KEY_CODE_UP] = QEMU_KEY_CTRL_UP,
|
||||
[Q_KEY_CODE_DOWN] = QEMU_KEY_CTRL_DOWN,
|
||||
[Q_KEY_CODE_RIGHT] = QEMU_KEY_CTRL_RIGHT,
|
||||
[Q_KEY_CODE_LEFT] = QEMU_KEY_CTRL_LEFT,
|
||||
[Q_KEY_CODE_HOME] = QEMU_KEY_CTRL_HOME,
|
||||
[Q_KEY_CODE_END] = QEMU_KEY_CTRL_END,
|
||||
[Q_KEY_CODE_PGUP] = QEMU_KEY_CTRL_PAGEUP,
|
||||
[Q_KEY_CODE_PGDN] = QEMU_KEY_CTRL_PAGEDOWN,
|
||||
};
|
||||
|
||||
bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl)
|
||||
{
|
||||
int keysym;
|
||||
|
||||
keysym = qcode_to_keysym[qcode];
|
||||
keysym = ctrl ? ctrl_qcode_to_keysym[qcode] : qcode_to_keysym[qcode];
|
||||
if (keysym == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1197,12 +1197,12 @@ static gboolean gd_text_key_down(GtkWidget *widget,
|
||||
QemuConsole *con = vc->gfx.dcl.con;
|
||||
|
||||
if (key->keyval == GDK_KEY_Delete) {
|
||||
kbd_put_qcode_console(con, Q_KEY_CODE_DELETE);
|
||||
kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false);
|
||||
} else if (key->length) {
|
||||
kbd_put_string_console(con, key->string, key->length);
|
||||
} else {
|
||||
int qcode = gd_map_keycode(key->hardware_keycode);
|
||||
kbd_put_qcode_console(con, qcode);
|
||||
kbd_put_qcode_console(con, qcode, false);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
#include "ui/sdl2.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
static void sdl2_set_scanout_mode(struct sdl2_console *scon, bool scanout)
|
||||
{
|
||||
if (scon->scanout_mode == scanout) {
|
||||
|
||||
+20
-26
@@ -60,32 +60,8 @@ void sdl2_process_key(struct sdl2_console *scon,
|
||||
|
||||
qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
|
||||
|
||||
if (!qemu_console_is_graphic(con)) {
|
||||
if (ev->type == SDL_KEYDOWN) {
|
||||
switch (ev->keysym.scancode) {
|
||||
case SDL_SCANCODE_RETURN:
|
||||
kbd_put_keysym_console(con, '\n');
|
||||
break;
|
||||
case SDL_SCANCODE_BACKSPACE:
|
||||
kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
|
||||
break;
|
||||
default:
|
||||
kbd_put_qcode_console(con, qcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* modifier state tracking */
|
||||
switch (ev->keysym.scancode) {
|
||||
#if 0
|
||||
case SDL_SCANCODE_NUMLOCKCLEAR:
|
||||
case SDL_SCANCODE_CAPSLOCK:
|
||||
/* SDL does not send the key up event, so we generate it */
|
||||
qemu_input_event_send_key_qcode(con, qcode, true);
|
||||
qemu_input_event_send_key_qcode(con, qcode, false);
|
||||
return;
|
||||
#endif
|
||||
case SDL_SCANCODE_LCTRL:
|
||||
case SDL_SCANCODE_LSHIFT:
|
||||
case SDL_SCANCODE_LALT:
|
||||
@@ -99,8 +75,26 @@ void sdl2_process_key(struct sdl2_console *scon,
|
||||
} else {
|
||||
modifiers_state[ev->keysym.scancode] = 1;
|
||||
}
|
||||
/* fall though */
|
||||
break;
|
||||
default:
|
||||
/* nothing */
|
||||
break;
|
||||
}
|
||||
|
||||
if (!qemu_console_is_graphic(con)) {
|
||||
bool ctrl = (modifiers_state[SDL_SCANCODE_LCTRL] ||
|
||||
modifiers_state[SDL_SCANCODE_RCTRL]);
|
||||
if (ev->type == SDL_KEYDOWN) {
|
||||
switch (ev->keysym.scancode) {
|
||||
case SDL_SCANCODE_RETURN:
|
||||
kbd_put_keysym_console(con, '\n');
|
||||
break;
|
||||
default:
|
||||
kbd_put_qcode_console(con, qcode, ctrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qemu_input_event_send_key_qcode(con, qcode,
|
||||
ev->type == SDL_KEYDOWN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user