diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-02-05 14:01:29 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-02-05 14:01:29 +0000 |
commit | 01a9a51ffaf4699827ea6425cb2b834a356e159d (patch) | |
tree | 9e068156b4102402649fcbceb8c3a2e462cfae25 /include | |
parent | 1c3d45df5e94042d5fb2bb31416072563ab30e49 (diff) | |
parent | 19c1b9fd3dd5955893c0d3c187a4180313e9a0f1 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190205-pull-request' into staging
ui: add kbd stats tracker.
ui: gtk scroll fixes.
ui: egl cursor scale fix.
ui: more sdl1 cleanup.
# gpg: Signature made Tue 05 Feb 2019 10:57:42 GMT
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20190205-pull-request:
keymap: fix keyup mappings
keymap: pass full keyboard state to keysym2scancode
kbd-state: use state tracker for vnc
kbd-state: use state tracker for gtk
sdl2: use only QKeyCode in sdl2_process_key()
kbd-state: use state tracker for sdl2
sdl2: remove sdl2_reset_keys() function
kbd-state: add keyboard state tracker
ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport
ui/cocoa.m: Fix macOS 10.14 deprecation warnings
ui/sdl_keysym: Remove obsolete SDL1.2 related code
ui: listen for GDK_SMOOTH_SCROLL events
ui: don't send any event if delta_y == 0
Remove deprecated -no-frame option
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/sysemu/sysemu.h | 1 | ||||
-rw-r--r-- | include/ui/egl-helpers.h | 2 | ||||
-rw-r--r-- | include/ui/gtk.h | 2 | ||||
-rw-r--r-- | include/ui/kbd-state.h | 101 | ||||
-rw-r--r-- | include/ui/sdl2.h | 3 |
5 files changed, 106 insertions, 3 deletions
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 85877b7e43..4b5a6b77f9 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -102,7 +102,6 @@ extern const char *keyboard_layout; extern int win2k_install_hack; extern int alt_grab; extern int ctrl_grab; -extern int no_frame; extern int smp_cpus; extern unsigned int max_cpus; extern int cursor_hide; diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index 3fc656a7ba..b976cb8728 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -27,7 +27,7 @@ void egl_fb_read(void *dst, egl_fb *src); void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip); void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip, - int x, int y); + int x, int y, double scale_x, double scale_y); #ifdef CONFIG_OPENGL_DMABUF diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 99edd3c085..d9eedad976 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -22,6 +22,7 @@ #include <gdk/gdkwayland.h> #endif +#include "ui/kbd-state.h" #if defined(CONFIG_OPENGL) #include "ui/egl-helpers.h" #include "ui/egl-context.h" @@ -32,6 +33,7 @@ typedef struct GtkDisplayState GtkDisplayState; typedef struct VirtualGfxConsole { GtkWidget *drawing_area; DisplayChangeListener dcl; + QKbdState *kbd; DisplaySurface *ds; pixman_image_t *convert; cairo_surface_t *surface; diff --git a/include/ui/kbd-state.h b/include/ui/kbd-state.h new file mode 100644 index 0000000000..d87833553a --- /dev/null +++ b/include/ui/kbd-state.h @@ -0,0 +1,101 @@ +/* + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. See the COPYING file in the + * top-level directory. + */ +#ifndef QEMU_UI_KBD_STATE_H +#define QEMU_UI_KBD_STATE_H 1 + +#include "qapi/qapi-types-ui.h" + +typedef enum QKbdModifier QKbdModifier; + +enum QKbdModifier { + QKBD_MOD_NONE = 0, + + QKBD_MOD_SHIFT, + QKBD_MOD_CTRL, + QKBD_MOD_ALT, + QKBD_MOD_ALTGR, + + QKBD_MOD_NUMLOCK, + QKBD_MOD_CAPSLOCK, + + QKBD_MOD__MAX +}; + +typedef struct QKbdState QKbdState; + +/** + * qkbd_state_init: init keyboard state tracker. + * + * Allocates and initializes keyboard state struct. + * + * @con: QemuConsole for this state tracker. Gets passed down to + * qemu_input_*() functions when sending key events to the guest. + */ +QKbdState *qkbd_state_init(QemuConsole *con); + +/** + * qkbd_state_free: free keyboard tracker state. + * + * @kbd: state tracker state. + */ +void qkbd_state_free(QKbdState *kbd); + +/** + * qkbd_state_key_event: process key event. + * + * Update keyboard state, send event to the guest. + * + * This function takes care to not send suspious events (keyup event + * for a key not pressed for example). + * + * @kbd: state tracker state. + * @qcode: the key pressed or released. + * @down: true for key down events, false otherwise. + */ +void qkbd_state_key_event(QKbdState *kbd, QKeyCode qcode, bool down); + +/** + * qkbd_state_set_delay: set key press delay. + * + * When set the specified delay will be added after each key event, + * using qemu_input_event_send_key_delay(). + * + * @kbd: state tracker state. + * @delay_ms: the delay in miliseconds. + */ +void qkbd_state_set_delay(QKbdState *kbd, int delay_ms); + +/** + * qkbd_state_key_get: get key state. + * + * Returns true when the key is down. + * + * @kbd: state tracker state. + * @qcode: the key to query. + */ +bool qkbd_state_key_get(QKbdState *kbd, QKeyCode qcode); + +/** + * qkbd_state_modifier_get: get modifier state. + * + * Returns true when the modifier is active. + * + * @kbd: state tracker state. + * @mod: the modifier to query. + */ +bool qkbd_state_modifier_get(QKbdState *kbd, QKbdModifier mod); + +/** + * qkbd_state_lift_all_keys: lift all pressed keys. + * + * This sends key up events to the guest for all keys which are in + * down state. + * + * @kbd: state tracker state. + */ +void qkbd_state_lift_all_keys(QKbdState *kbd); + +#endif /* QEMU_UI_KBD_STATE_H */ diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index f6db642b65..0875b8d56b 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -10,6 +10,7 @@ # include <SDL_image.h> #endif +#include "ui/kbd-state.h" #ifdef CONFIG_OPENGL # include "ui/egl-helpers.h" #endif @@ -30,6 +31,7 @@ struct sdl2_console { int idle_counter; int ignore_hotkeys; SDL_GLContext winctx; + QKbdState *kbd; #ifdef CONFIG_OPENGL QemuGLShader *gls; egl_fb guest_fb; @@ -44,7 +46,6 @@ void sdl2_window_destroy(struct sdl2_console *scon); void sdl2_window_resize(struct sdl2_console *scon); void sdl2_poll_events(struct sdl2_console *scon); -void sdl2_reset_keys(struct sdl2_console *scon); void sdl2_process_key(struct sdl2_console *scon, SDL_KeyboardEvent *ev); |