Include qemu-timer.h iff DEBUG is defined.
[qemu/qemu_0_9_1_stable.git] / console.h
blob1ac74fad3f3cf51aade6d913d838502aca04eb94
1 #ifndef CONSOLE_H
2 #define CONSOLE_H
4 #include "qemu-char.h"
6 /* keyboard/mouse support */
8 #define MOUSE_EVENT_LBUTTON 0x01
9 #define MOUSE_EVENT_RBUTTON 0x02
10 #define MOUSE_EVENT_MBUTTON 0x04
12 typedef void QEMUPutKBDEvent(void *opaque, int keycode);
13 typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
15 typedef struct QEMUPutMouseEntry {
16 QEMUPutMouseEvent *qemu_put_mouse_event;
17 void *qemu_put_mouse_event_opaque;
18 int qemu_put_mouse_event_absolute;
19 char *qemu_put_mouse_event_name;
21 /* used internally by qemu for handling mice */
22 struct QEMUPutMouseEntry *next;
23 } QEMUPutMouseEntry;
25 void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque);
26 QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
27 void *opaque, int absolute,
28 const char *name);
29 void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry);
31 void kbd_put_keycode(int keycode);
32 void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
33 int kbd_mouse_is_absolute(void);
35 void do_info_mice(void);
36 void do_mouse_set(int index);
38 /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
39 constants) */
40 #define QEMU_KEY_ESC1(c) ((c) | 0xe100)
41 #define QEMU_KEY_BACKSPACE 0x007f
42 #define QEMU_KEY_UP QEMU_KEY_ESC1('A')
43 #define QEMU_KEY_DOWN QEMU_KEY_ESC1('B')
44 #define QEMU_KEY_RIGHT QEMU_KEY_ESC1('C')
45 #define QEMU_KEY_LEFT QEMU_KEY_ESC1('D')
46 #define QEMU_KEY_HOME QEMU_KEY_ESC1(1)
47 #define QEMU_KEY_END QEMU_KEY_ESC1(4)
48 #define QEMU_KEY_PAGEUP QEMU_KEY_ESC1(5)
49 #define QEMU_KEY_PAGEDOWN QEMU_KEY_ESC1(6)
50 #define QEMU_KEY_DELETE QEMU_KEY_ESC1(3)
52 #define QEMU_KEY_CTRL_UP 0xe400
53 #define QEMU_KEY_CTRL_DOWN 0xe401
54 #define QEMU_KEY_CTRL_LEFT 0xe402
55 #define QEMU_KEY_CTRL_RIGHT 0xe403
56 #define QEMU_KEY_CTRL_HOME 0xe404
57 #define QEMU_KEY_CTRL_END 0xe405
58 #define QEMU_KEY_CTRL_PAGEUP 0xe406
59 #define QEMU_KEY_CTRL_PAGEDOWN 0xe407
61 void kbd_put_keysym(int keysym);
63 /* consoles */
65 struct DisplayState {
66 uint8_t *data;
67 int linesize;
68 int depth;
69 int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */
70 int width;
71 int height;
72 void *opaque;
73 struct QEMUTimer *gui_timer;
75 void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
76 void (*dpy_resize)(struct DisplayState *s, int w, int h);
77 void (*dpy_refresh)(struct DisplayState *s);
78 void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y,
79 int dst_x, int dst_y, int w, int h);
80 void (*dpy_fill)(struct DisplayState *s, int x, int y,
81 int w, int h, uint32_t c);
82 void (*mouse_set)(int x, int y, int on);
83 void (*cursor_define)(int width, int height, int bpp, int hot_x, int hot_y,
84 uint8_t *image, uint8_t *mask);
87 static inline void dpy_update(DisplayState *s, int x, int y, int w, int h)
89 s->dpy_update(s, x, y, w, h);
92 static inline void dpy_resize(DisplayState *s, int w, int h)
94 s->dpy_resize(s, w, h);
97 typedef void (*vga_hw_update_ptr)(void *);
98 typedef void (*vga_hw_invalidate_ptr)(void *);
99 typedef void (*vga_hw_screen_dump_ptr)(void *, const char *);
101 TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update,
102 vga_hw_invalidate_ptr invalidate,
103 vga_hw_screen_dump_ptr screen_dump,
104 void *opaque);
105 void vga_hw_update(void);
106 void vga_hw_invalidate(void);
107 void vga_hw_screen_dump(const char *filename);
109 int is_graphic_console(void);
110 CharDriverState *text_console_init(DisplayState *ds, const char *p);
111 void console_select(unsigned int index);
112 void console_color_init(DisplayState *ds);
114 /* sdl.c */
115 void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
117 /* cocoa.m */
118 void cocoa_display_init(DisplayState *ds, int full_screen);
120 /* vnc.c */
121 void vnc_display_init(DisplayState *ds);
122 void vnc_display_close(DisplayState *ds);
123 int vnc_display_open(DisplayState *ds, const char *display);
124 int vnc_display_password(DisplayState *ds, const char *password);
125 void do_info_vnc(void);
127 /* x_keymap.c */
128 extern uint8_t _translate_keycode(const int key);
130 /* FIXME: term_printf et al should probably go elsewhere so everything
131 does not need to include console.h */
132 /* monitor.c */
133 void monitor_init(CharDriverState *hd, int show_banner);
134 void term_puts(const char *str);
135 void term_vprintf(const char *fmt, va_list ap);
136 void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
137 void term_print_filename(const char *filename);
138 void term_flush(void);
139 void term_print_help(void);
140 void monitor_readline(const char *prompt, int is_password,
141 char *buf, int buf_size);
143 /* readline.c */
144 typedef void ReadLineFunc(void *opaque, const char *str);
146 extern int completion_index;
147 void add_completion(const char *str);
148 void readline_handle_byte(int ch);
149 void readline_find_completion(const char *cmdline);
150 const char *readline_get_history(unsigned int index);
151 void readline_start(const char *prompt, int is_password,
152 ReadLineFunc *readline_func, void *opaque);
154 #endif