2007-11-17 18:14:51 +01:00
|
|
|
#ifndef CONSOLE_H
|
|
|
|
#define CONSOLE_H
|
|
|
|
|
|
|
|
#include "qemu-char.h"
|
|
|
|
|
|
|
|
/* keyboard/mouse support */
|
|
|
|
|
|
|
|
#define MOUSE_EVENT_LBUTTON 0x01
|
|
|
|
#define MOUSE_EVENT_RBUTTON 0x02
|
|
|
|
#define MOUSE_EVENT_MBUTTON 0x04
|
|
|
|
|
2008-08-21 22:12:05 +02:00
|
|
|
/* in ms */
|
|
|
|
#define GUI_REFRESH_INTERVAL 30
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
typedef void QEMUPutKBDEvent(void *opaque, int keycode);
|
|
|
|
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
|
|
|
|
|
|
|
|
typedef struct QEMUPutMouseEntry {
|
|
|
|
QEMUPutMouseEvent *qemu_put_mouse_event;
|
|
|
|
void *qemu_put_mouse_event_opaque;
|
|
|
|
int qemu_put_mouse_event_absolute;
|
|
|
|
char *qemu_put_mouse_event_name;
|
|
|
|
|
|
|
|
/* used internally by qemu for handling mice */
|
|
|
|
struct QEMUPutMouseEntry *next;
|
|
|
|
} QEMUPutMouseEntry;
|
|
|
|
|
|
|
|
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
|
|
|
|
QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
|
|
|
|
void *opaque, int absolute,
|
|
|
|
const char *name);
|
|
|
|
void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry);
|
|
|
|
|
|
|
|
void kbd_put_keycode(int keycode);
|
|
|
|
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
|
|
|
|
int kbd_mouse_is_absolute(void);
|
|
|
|
|
2008-04-14 23:28:11 +02:00
|
|
|
struct mouse_transform_info_s {
|
|
|
|
/* Touchscreen resolution */
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
/* Calibration values as used/generated by tslib */
|
|
|
|
int a[7];
|
|
|
|
};
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
void do_info_mice(void);
|
|
|
|
void do_mouse_set(int index);
|
|
|
|
|
|
|
|
/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
|
|
|
constants) */
|
|
|
|
#define QEMU_KEY_ESC1(c) ((c) | 0xe100)
|
|
|
|
#define QEMU_KEY_BACKSPACE 0x007f
|
|
|
|
#define QEMU_KEY_UP QEMU_KEY_ESC1('A')
|
|
|
|
#define QEMU_KEY_DOWN QEMU_KEY_ESC1('B')
|
|
|
|
#define QEMU_KEY_RIGHT QEMU_KEY_ESC1('C')
|
|
|
|
#define QEMU_KEY_LEFT QEMU_KEY_ESC1('D')
|
|
|
|
#define QEMU_KEY_HOME QEMU_KEY_ESC1(1)
|
|
|
|
#define QEMU_KEY_END QEMU_KEY_ESC1(4)
|
|
|
|
#define QEMU_KEY_PAGEUP QEMU_KEY_ESC1(5)
|
|
|
|
#define QEMU_KEY_PAGEDOWN QEMU_KEY_ESC1(6)
|
|
|
|
#define QEMU_KEY_DELETE QEMU_KEY_ESC1(3)
|
|
|
|
|
|
|
|
#define QEMU_KEY_CTRL_UP 0xe400
|
|
|
|
#define QEMU_KEY_CTRL_DOWN 0xe401
|
|
|
|
#define QEMU_KEY_CTRL_LEFT 0xe402
|
|
|
|
#define QEMU_KEY_CTRL_RIGHT 0xe403
|
|
|
|
#define QEMU_KEY_CTRL_HOME 0xe404
|
|
|
|
#define QEMU_KEY_CTRL_END 0xe405
|
|
|
|
#define QEMU_KEY_CTRL_PAGEUP 0xe406
|
|
|
|
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407
|
|
|
|
|
|
|
|
void kbd_put_keysym(int keysym);
|
|
|
|
|
|
|
|
/* consoles */
|
|
|
|
|
|
|
|
struct DisplayState {
|
|
|
|
uint8_t *data;
|
|
|
|
int linesize;
|
|
|
|
int depth;
|
|
|
|
int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
void *opaque;
|
|
|
|
struct QEMUTimer *gui_timer;
|
2008-03-13 20:20:33 +01:00
|
|
|
uint64_t gui_timer_interval;
|
2008-08-21 22:08:55 +02:00
|
|
|
int idle;
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
|
|
|
|
void (*dpy_resize)(struct DisplayState *s, int w, int h);
|
|
|
|
void (*dpy_refresh)(struct DisplayState *s);
|
|
|
|
void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y,
|
|
|
|
int dst_x, int dst_y, int w, int h);
|
|
|
|
void (*dpy_fill)(struct DisplayState *s, int x, int y,
|
|
|
|
int w, int h, uint32_t c);
|
2008-02-10 17:33:14 +01:00
|
|
|
void (*dpy_text_cursor)(struct DisplayState *s, int x, int y);
|
2007-11-17 18:14:51 +01:00
|
|
|
void (*mouse_set)(int x, int y, int on);
|
|
|
|
void (*cursor_define)(int width, int height, int bpp, int hot_x, int hot_y,
|
|
|
|
uint8_t *image, uint8_t *mask);
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
s->dpy_update(s, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void dpy_resize(DisplayState *s, int w, int h)
|
|
|
|
{
|
|
|
|
s->dpy_resize(s, w, h);
|
|
|
|
}
|
|
|
|
|
2008-02-10 17:33:14 +01:00
|
|
|
static inline void dpy_cursor(DisplayState *s, int x, int y)
|
|
|
|
{
|
|
|
|
if (s->dpy_text_cursor)
|
|
|
|
s->dpy_text_cursor(s, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef unsigned long console_ch_t;
|
|
|
|
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
|
|
|
|
{
|
|
|
|
cpu_to_le32wu((uint32_t *) dest, ch);
|
|
|
|
}
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
typedef void (*vga_hw_update_ptr)(void *);
|
|
|
|
typedef void (*vga_hw_invalidate_ptr)(void *);
|
|
|
|
typedef void (*vga_hw_screen_dump_ptr)(void *, const char *);
|
2008-02-10 17:33:14 +01:00
|
|
|
typedef void (*vga_hw_text_update_ptr)(void *, console_ch_t *);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update,
|
|
|
|
vga_hw_invalidate_ptr invalidate,
|
|
|
|
vga_hw_screen_dump_ptr screen_dump,
|
2008-02-10 17:33:14 +01:00
|
|
|
vga_hw_text_update_ptr text_update,
|
2007-11-17 18:14:51 +01:00
|
|
|
void *opaque);
|
|
|
|
void vga_hw_update(void);
|
|
|
|
void vga_hw_invalidate(void);
|
|
|
|
void vga_hw_screen_dump(const char *filename);
|
2008-02-10 17:33:14 +01:00
|
|
|
void vga_hw_text_update(console_ch_t *chardata);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
int is_graphic_console(void);
|
|
|
|
CharDriverState *text_console_init(DisplayState *ds, const char *p);
|
|
|
|
void console_select(unsigned int index);
|
|
|
|
void console_color_init(DisplayState *ds);
|
2008-07-01 18:24:38 +02:00
|
|
|
void qemu_console_resize(QEMUConsole *console, int width, int height);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
/* sdl.c */
|
|
|
|
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
|
|
|
|
|
|
|
|
/* cocoa.m */
|
|
|
|
void cocoa_display_init(DisplayState *ds, int full_screen);
|
|
|
|
|
|
|
|
/* vnc.c */
|
|
|
|
void vnc_display_init(DisplayState *ds);
|
|
|
|
void vnc_display_close(DisplayState *ds);
|
|
|
|
int vnc_display_open(DisplayState *ds, const char *display);
|
|
|
|
int vnc_display_password(DisplayState *ds, const char *password);
|
|
|
|
void do_info_vnc(void);
|
|
|
|
|
2008-02-10 17:33:14 +01:00
|
|
|
/* curses.c */
|
|
|
|
void curses_display_init(DisplayState *ds, int full_screen);
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* x_keymap.c */
|
|
|
|
extern uint8_t _translate_keycode(const int key);
|
|
|
|
|
|
|
|
/* FIXME: term_printf et al should probably go elsewhere so everything
|
|
|
|
does not need to include console.h */
|
|
|
|
/* monitor.c */
|
|
|
|
void monitor_init(CharDriverState *hd, int show_banner);
|
|
|
|
void term_puts(const char *str);
|
|
|
|
void term_vprintf(const char *fmt, va_list ap);
|
|
|
|
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
|
|
|
void term_print_filename(const char *filename);
|
|
|
|
void term_flush(void);
|
|
|
|
void term_print_help(void);
|
|
|
|
void monitor_readline(const char *prompt, int is_password,
|
|
|
|
char *buf, int buf_size);
|
|
|
|
|
|
|
|
/* readline.c */
|
|
|
|
typedef void ReadLineFunc(void *opaque, const char *str);
|
|
|
|
|
|
|
|
extern int completion_index;
|
|
|
|
void add_completion(const char *str);
|
|
|
|
void readline_handle_byte(int ch);
|
|
|
|
void readline_find_completion(const char *cmdline);
|
|
|
|
const char *readline_get_history(unsigned int index);
|
|
|
|
void readline_start(const char *prompt, int is_password,
|
|
|
|
ReadLineFunc *readline_func, void *opaque);
|
|
|
|
|
|
|
|
#endif
|