diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-03-07 18:29:32 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-03-07 18:29:33 +0000 |
commit | 6fc0303b95c873d9e384d7fb51e412ac2e53b9c1 (patch) | |
tree | 7d815af24450845341cb1a703f3e5e6058937abf /include | |
parent | bb2b04503497608cdc5fa4c990d26e936f9d2102 (diff) | |
parent | 47c03744b37c72b8f633b03380d5a323615b9ac4 (diff) | |
download | qemu-6fc0303b95c873d9e384d7fb51e412ac2e53b9c1.tar.gz qemu-6fc0303b95c873d9e384d7fb51e412ac2e53b9c1.tar.bz2 qemu-6fc0303b95c873d9e384d7fb51e412ac2e53b9c1.zip |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-4' into staging
Input handling rewrite.
SDL2 support.
# gpg: Signature made Wed 05 Mar 2014 11:16:08 GMT using RSA key ID D3E87138
# 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>"
* remotes/kraxel/tags/pull-input-4: (38 commits)
ui/sdl2 : initial port to SDL 2.0 (v2.0)
console: add QemuUIInfo
console: add head to index to qemu consoles.
input: remove index_from_keycode (no users)
input: move do_mouse_set to new core
input: move qmp_query_mice to new core
input: add input_mouse_mode tracepoint
input: move mouse mode notifier to new core
input-legacy: remove kbd_mouse_event
input-legacy: remove kbd_mouse_is_absolute
input-legacy: remove kbd_mouse_has_absolute
input-legacy: remove kbd_put_keycode
input: trace events
input: mouse: switch cocoa ui to new core
input: keyboard: switch cocoa ui to new core
input: mouse: switch monitor to new core
input: mouse: switch spice ui to new core
input: mouse: switch vnc ui to new core
input: mouse: switch sdl ui to new core
input: mouse: switch gtk ui to new core
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/ui/console.h | 33 | ||||
-rw-r--r-- | include/ui/input.h | 56 |
2 files changed, 76 insertions, 13 deletions
diff --git a/include/ui/console.h b/include/ui/console.h index 4156a876e1..08a38eab13 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -14,6 +14,8 @@ #define MOUSE_EVENT_LBUTTON 0x01 #define MOUSE_EVENT_RBUTTON 0x02 #define MOUSE_EVENT_MBUTTON 0x04 +#define MOUSE_EVENT_WHEELUP 0x08 +#define MOUSE_EVENT_WHEELDN 0x10 /* identical to the ps/2 keyboard bits */ #define QEMU_SCROLL_LOCK_LED (1 << 0) @@ -44,17 +46,7 @@ void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry); QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func, void *opaque); void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry); -void kbd_put_keycode(int keycode); void kbd_put_ledstate(int ledstate); -void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); - -/* Does the current mouse generate absolute events */ -int kbd_mouse_is_absolute(void); -void qemu_add_mouse_mode_change_notifier(Notifier *notify); -void qemu_remove_mouse_mode_change_notifier(Notifier *notify); - -/* Of all the mice, is there one that generates absolute events */ -int kbd_mouse_has_absolute(void); struct MouseTransformInfo { /* Touchscreen resolution */ @@ -128,6 +120,14 @@ struct DisplaySurface { struct PixelFormat pf; }; +typedef struct QemuUIInfo { + /* geometry */ + int xoff; + int yoff; + uint32_t width; + uint32_t height; +} QemuUIInfo; + /* cursor data format is 32bit RGBA */ typedef struct QEMUCursor { int width, height; @@ -212,6 +212,8 @@ void update_displaychangelistener(DisplayChangeListener *dcl, uint64_t interval); void unregister_displaychangelistener(DisplayChangeListener *dcl); +int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info); + void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h); void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *surface); @@ -274,9 +276,10 @@ typedef struct GraphicHwOps { void (*gfx_update)(void *opaque); void (*text_update)(void *opaque, console_ch_t *text); void (*update_interval)(void *opaque, uint64_t interval); + int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); } GraphicHwOps; -QemuConsole *graphic_console_init(DeviceState *dev, +QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, const GraphicHwOps *ops, void *opaque); @@ -285,10 +288,15 @@ void graphic_hw_invalidate(QemuConsole *con); void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata); QemuConsole *qemu_console_lookup_by_index(unsigned int index); -QemuConsole *qemu_console_lookup_by_device(DeviceState *dev); +QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head); bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); bool qemu_console_is_fixedsize(QemuConsole *con); +int qemu_console_get_index(QemuConsole *con); +uint32_t qemu_console_get_head(QemuConsole *con); +QemuUIInfo *qemu_console_get_ui_info(QemuConsole *con); +int qemu_console_get_width(QemuConsole *con, int fallback); +int qemu_console_get_height(QemuConsole *con, int fallback); void text_consoles_set_display(DisplayState *ds); void console_select(unsigned int index); @@ -334,7 +342,6 @@ void curses_display_init(DisplayState *ds, int full_screen); /* input.c */ int index_from_key(const char *key); -int index_from_keycode(int code); /* gtk.c */ void early_gtk_display_init(void); diff --git a/include/ui/input.h b/include/ui/input.h new file mode 100644 index 0000000000..4976f3da2c --- /dev/null +++ b/include/ui/input.h @@ -0,0 +1,56 @@ +#ifndef INPUT_H +#define INPUT_H + +#include "qapi-types.h" + +#define INPUT_EVENT_MASK_KEY (1<<INPUT_EVENT_KIND_KEY) +#define INPUT_EVENT_MASK_BTN (1<<INPUT_EVENT_KIND_BTN) +#define INPUT_EVENT_MASK_REL (1<<INPUT_EVENT_KIND_REL) +#define INPUT_EVENT_MASK_ABS (1<<INPUT_EVENT_KIND_ABS) + +#define INPUT_EVENT_ABS_SIZE 0x8000 + +typedef struct QemuInputHandler QemuInputHandler; +typedef struct QemuInputHandlerState QemuInputHandlerState; + +typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src, + InputEvent *evt); +typedef void (*QemuInputHandlerSync)(DeviceState *dev); + +struct QemuInputHandler { + const char *name; + uint32_t mask; + QemuInputHandlerEvent event; + QemuInputHandlerSync sync; +}; + +QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev, + QemuInputHandler *handler); +void qemu_input_handler_activate(QemuInputHandlerState *s); +void qemu_input_handler_unregister(QemuInputHandlerState *s); +void qemu_input_event_send(QemuConsole *src, InputEvent *evt); +void qemu_input_event_sync(void); + +InputEvent *qemu_input_event_new_key(KeyValue *key, bool down); +void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down); +void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down); +void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down); + +InputEvent *qemu_input_event_new_btn(InputButton btn, bool down); +void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down); +void qemu_input_update_buttons(QemuConsole *src, uint32_t *button_map, + uint32_t button_old, uint32_t button_new); + +bool qemu_input_is_absolute(void); +int qemu_input_scale_axis(int value, int size_in, int size_out); +InputEvent *qemu_input_event_new_move(InputEventKind kind, + InputAxis axis, int value); +void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); +void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, + int value, int size); + +void qemu_input_check_mode_change(void); +void qemu_add_mouse_mode_change_notifier(Notifier *notify); +void qemu_remove_mouse_mode_change_notifier(Notifier *notify); + +#endif /* INPUT_H */ |