Commit 01a9a51f authored by Peter Maydell's avatar Peter Maydell
Browse files

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: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 1c3d45df 19c1b9fd
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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

+2 −0
Original line number Diff line number Diff line
@@ -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;

include/ui/kbd-state.h

0 → 100644
+101 −0
Original line number Diff line number Diff line
/*
 * 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 */
+2 −1
Original line number Diff line number Diff line
@@ -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);

Loading