root / console.h @ a74cdab4
History | View | Annotate | Download (12.3 kB)
1 | 87ecb68b | pbrook | #ifndef CONSOLE_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define CONSOLE_H
|
3 | 87ecb68b | pbrook | |
4 | 87ecb68b | pbrook | #include "qemu-char.h" |
5 | d54908a5 | Luiz Capitulino | #include "qdict.h" |
6 | 7e581fb3 | Anthony Liguori | #include "notify.h" |
7 | 821601ea | Jes Sorensen | #include "qerror.h" |
8 | 821601ea | Jes Sorensen | #include "monitor.h" |
9 | 87ecb68b | pbrook | |
10 | 87ecb68b | pbrook | /* keyboard/mouse support */
|
11 | 87ecb68b | pbrook | |
12 | 87ecb68b | pbrook | #define MOUSE_EVENT_LBUTTON 0x01 |
13 | 87ecb68b | pbrook | #define MOUSE_EVENT_RBUTTON 0x02 |
14 | 87ecb68b | pbrook | #define MOUSE_EVENT_MBUTTON 0x04 |
15 | 87ecb68b | pbrook | |
16 | 03a23a85 | Gerd Hoffmann | /* identical to the ps/2 keyboard bits */
|
17 | 03a23a85 | Gerd Hoffmann | #define QEMU_SCROLL_LOCK_LED (1 << 0) |
18 | 03a23a85 | Gerd Hoffmann | #define QEMU_NUM_LOCK_LED (1 << 1) |
19 | 03a23a85 | Gerd Hoffmann | #define QEMU_CAPS_LOCK_LED (1 << 2) |
20 | 03a23a85 | Gerd Hoffmann | |
21 | 7ed9eba3 | aliguori | /* in ms */
|
22 | 7ed9eba3 | aliguori | #define GUI_REFRESH_INTERVAL 30 |
23 | 7ed9eba3 | aliguori | |
24 | 87ecb68b | pbrook | typedef void QEMUPutKBDEvent(void *opaque, int keycode); |
25 | 03a23a85 | Gerd Hoffmann | typedef void QEMUPutLEDEvent(void *opaque, int ledstate); |
26 | 87ecb68b | pbrook | typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state); |
27 | 87ecb68b | pbrook | |
28 | 87ecb68b | pbrook | typedef struct QEMUPutMouseEntry { |
29 | 87ecb68b | pbrook | QEMUPutMouseEvent *qemu_put_mouse_event; |
30 | 87ecb68b | pbrook | void *qemu_put_mouse_event_opaque;
|
31 | 87ecb68b | pbrook | int qemu_put_mouse_event_absolute;
|
32 | 87ecb68b | pbrook | char *qemu_put_mouse_event_name;
|
33 | 87ecb68b | pbrook | |
34 | 6fef28ee | Anthony Liguori | int index;
|
35 | 6fef28ee | Anthony Liguori | |
36 | 87ecb68b | pbrook | /* used internally by qemu for handling mice */
|
37 | 6fef28ee | Anthony Liguori | QTAILQ_ENTRY(QEMUPutMouseEntry) node; |
38 | 87ecb68b | pbrook | } QEMUPutMouseEntry; |
39 | 87ecb68b | pbrook | |
40 | 03a23a85 | Gerd Hoffmann | typedef struct QEMUPutLEDEntry { |
41 | 03a23a85 | Gerd Hoffmann | QEMUPutLEDEvent *put_led; |
42 | 03a23a85 | Gerd Hoffmann | void *opaque;
|
43 | 03a23a85 | Gerd Hoffmann | QTAILQ_ENTRY(QEMUPutLEDEntry) next; |
44 | 03a23a85 | Gerd Hoffmann | } QEMUPutLEDEntry; |
45 | 03a23a85 | Gerd Hoffmann | |
46 | 87ecb68b | pbrook | void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque); |
47 | 46aaebff | Jes Sorensen | void qemu_remove_kbd_event_handler(void); |
48 | 87ecb68b | pbrook | QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, |
49 | 87ecb68b | pbrook | void *opaque, int absolute, |
50 | 87ecb68b | pbrook | const char *name); |
51 | 87ecb68b | pbrook | void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry);
|
52 | 6fef28ee | Anthony Liguori | void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry);
|
53 | 6fef28ee | Anthony Liguori | |
54 | 03a23a85 | Gerd Hoffmann | QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func, void *opaque);
|
55 | 03a23a85 | Gerd Hoffmann | void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry);
|
56 | 87ecb68b | pbrook | |
57 | 87ecb68b | pbrook | void kbd_put_keycode(int keycode); |
58 | 03a23a85 | Gerd Hoffmann | void kbd_put_ledstate(int ledstate); |
59 | 87ecb68b | pbrook | void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); |
60 | eb2e259d | Anthony Liguori | |
61 | eb2e259d | Anthony Liguori | /* Does the current mouse generate absolute events */
|
62 | 87ecb68b | pbrook | int kbd_mouse_is_absolute(void); |
63 | 7e581fb3 | Anthony Liguori | void qemu_add_mouse_mode_change_notifier(Notifier *notify);
|
64 | 7e581fb3 | Anthony Liguori | void qemu_remove_mouse_mode_change_notifier(Notifier *notify);
|
65 | 87ecb68b | pbrook | |
66 | eb2e259d | Anthony Liguori | /* Of all the mice, is there one that generates absolute events */
|
67 | eb2e259d | Anthony Liguori | int kbd_mouse_has_absolute(void); |
68 | eb2e259d | Anthony Liguori | |
69 | bc24a225 | Paul Brook | struct MouseTransformInfo {
|
70 | a5d7eb65 | balrog | /* Touchscreen resolution */
|
71 | a5d7eb65 | balrog | int x;
|
72 | a5d7eb65 | balrog | int y;
|
73 | a5d7eb65 | balrog | /* Calibration values as used/generated by tslib */
|
74 | a5d7eb65 | balrog | int a[7]; |
75 | a5d7eb65 | balrog | }; |
76 | a5d7eb65 | balrog | |
77 | e78c48ec | Luiz Capitulino | void do_info_mice_print(Monitor *mon, const QObject *data); |
78 | e78c48ec | Luiz Capitulino | void do_info_mice(Monitor *mon, QObject **ret_data);
|
79 | d54908a5 | Luiz Capitulino | void do_mouse_set(Monitor *mon, const QDict *qdict); |
80 | 87ecb68b | pbrook | |
81 | 87ecb68b | pbrook | /* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
82 | 87ecb68b | pbrook | constants) */
|
83 | 87ecb68b | pbrook | #define QEMU_KEY_ESC1(c) ((c) | 0xe100) |
84 | 87ecb68b | pbrook | #define QEMU_KEY_BACKSPACE 0x007f |
85 | 87ecb68b | pbrook | #define QEMU_KEY_UP QEMU_KEY_ESC1('A') |
86 | 87ecb68b | pbrook | #define QEMU_KEY_DOWN QEMU_KEY_ESC1('B') |
87 | 87ecb68b | pbrook | #define QEMU_KEY_RIGHT QEMU_KEY_ESC1('C') |
88 | 87ecb68b | pbrook | #define QEMU_KEY_LEFT QEMU_KEY_ESC1('D') |
89 | 87ecb68b | pbrook | #define QEMU_KEY_HOME QEMU_KEY_ESC1(1) |
90 | 87ecb68b | pbrook | #define QEMU_KEY_END QEMU_KEY_ESC1(4) |
91 | 87ecb68b | pbrook | #define QEMU_KEY_PAGEUP QEMU_KEY_ESC1(5) |
92 | 87ecb68b | pbrook | #define QEMU_KEY_PAGEDOWN QEMU_KEY_ESC1(6) |
93 | 87ecb68b | pbrook | #define QEMU_KEY_DELETE QEMU_KEY_ESC1(3) |
94 | 87ecb68b | pbrook | |
95 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_UP 0xe400 |
96 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_DOWN 0xe401 |
97 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_LEFT 0xe402 |
98 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_RIGHT 0xe403 |
99 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_HOME 0xe404 |
100 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_END 0xe405 |
101 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_PAGEUP 0xe406 |
102 | 87ecb68b | pbrook | #define QEMU_KEY_CTRL_PAGEDOWN 0xe407 |
103 | 87ecb68b | pbrook | |
104 | 87ecb68b | pbrook | void kbd_put_keysym(int keysym); |
105 | 87ecb68b | pbrook | |
106 | 87ecb68b | pbrook | /* consoles */
|
107 | 87ecb68b | pbrook | |
108 | 7d957bd8 | aliguori | #define QEMU_BIG_ENDIAN_FLAG 0x01 |
109 | 7d957bd8 | aliguori | #define QEMU_ALLOCATED_FLAG 0x02 |
110 | c18a2c36 | Stefano Stabellini | #define QEMU_REALPIXELS_FLAG 0x04 |
111 | 7d957bd8 | aliguori | |
112 | 7d957bd8 | aliguori | struct PixelFormat {
|
113 | 7d957bd8 | aliguori | uint8_t bits_per_pixel; |
114 | 7d957bd8 | aliguori | uint8_t bytes_per_pixel; |
115 | 7d957bd8 | aliguori | uint8_t depth; /* color depth in bits */
|
116 | 7d957bd8 | aliguori | uint32_t rmask, gmask, bmask, amask; |
117 | 7d957bd8 | aliguori | uint8_t rshift, gshift, bshift, ashift; |
118 | 7d957bd8 | aliguori | uint8_t rmax, gmax, bmax, amax; |
119 | 90a1e3c0 | aliguori | uint8_t rbits, gbits, bbits, abits; |
120 | 7d957bd8 | aliguori | }; |
121 | 7d957bd8 | aliguori | |
122 | 7d957bd8 | aliguori | struct DisplaySurface {
|
123 | 7d957bd8 | aliguori | uint8_t flags; |
124 | 87ecb68b | pbrook | int width;
|
125 | 87ecb68b | pbrook | int height;
|
126 | 7d957bd8 | aliguori | int linesize; /* bytes per line */ |
127 | 7d957bd8 | aliguori | uint8_t *data; |
128 | 7d957bd8 | aliguori | |
129 | 7d957bd8 | aliguori | struct PixelFormat pf;
|
130 | 7d957bd8 | aliguori | }; |
131 | 7d957bd8 | aliguori | |
132 | 254e5950 | Gerd Hoffmann | /* cursor data format is 32bit RGBA */
|
133 | 254e5950 | Gerd Hoffmann | typedef struct QEMUCursor { |
134 | 254e5950 | Gerd Hoffmann | int width, height;
|
135 | 254e5950 | Gerd Hoffmann | int hot_x, hot_y;
|
136 | 254e5950 | Gerd Hoffmann | int refcount;
|
137 | 254e5950 | Gerd Hoffmann | uint32_t data[]; |
138 | 254e5950 | Gerd Hoffmann | } QEMUCursor; |
139 | 254e5950 | Gerd Hoffmann | |
140 | 254e5950 | Gerd Hoffmann | QEMUCursor *cursor_alloc(int width, int height); |
141 | 254e5950 | Gerd Hoffmann | void cursor_get(QEMUCursor *c);
|
142 | 254e5950 | Gerd Hoffmann | void cursor_put(QEMUCursor *c);
|
143 | 254e5950 | Gerd Hoffmann | QEMUCursor *cursor_builtin_hidden(void);
|
144 | 254e5950 | Gerd Hoffmann | QEMUCursor *cursor_builtin_left_ptr(void);
|
145 | 254e5950 | Gerd Hoffmann | void cursor_print_ascii_art(QEMUCursor *c, const char *prefix); |
146 | 254e5950 | Gerd Hoffmann | int cursor_get_mono_bpl(QEMUCursor *c);
|
147 | 254e5950 | Gerd Hoffmann | void cursor_set_mono(QEMUCursor *c,
|
148 | 254e5950 | Gerd Hoffmann | uint32_t foreground, uint32_t background, uint8_t *image, |
149 | 254e5950 | Gerd Hoffmann | int transparent, uint8_t *mask);
|
150 | 254e5950 | Gerd Hoffmann | void cursor_get_mono_image(QEMUCursor *c, int foreground, uint8_t *mask); |
151 | 254e5950 | Gerd Hoffmann | void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask); |
152 | 254e5950 | Gerd Hoffmann | |
153 | 7d957bd8 | aliguori | struct DisplayChangeListener {
|
154 | 7d957bd8 | aliguori | int idle;
|
155 | f442e08b | aurel32 | uint64_t gui_timer_interval; |
156 | 87ecb68b | pbrook | |
157 | 87ecb68b | pbrook | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
158 | 7d957bd8 | aliguori | void (*dpy_resize)(struct DisplayState *s); |
159 | 7d957bd8 | aliguori | void (*dpy_setdata)(struct DisplayState *s); |
160 | 87ecb68b | pbrook | void (*dpy_refresh)(struct DisplayState *s); |
161 | 87ecb68b | pbrook | void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y, |
162 | 87ecb68b | pbrook | int dst_x, int dst_y, int w, int h); |
163 | 87ecb68b | pbrook | void (*dpy_fill)(struct DisplayState *s, int x, int y, |
164 | 87ecb68b | pbrook | int w, int h, uint32_t c); |
165 | 4d3b6f6e | balrog | void (*dpy_text_cursor)(struct DisplayState *s, int x, int y); |
166 | 7d957bd8 | aliguori | |
167 | 7d957bd8 | aliguori | struct DisplayChangeListener *next;
|
168 | 7d957bd8 | aliguori | }; |
169 | 7d957bd8 | aliguori | |
170 | 7b5d76da | aliguori | struct DisplayAllocator {
|
171 | 7b5d76da | aliguori | DisplaySurface* (*create_displaysurface)(int width, int height); |
172 | 7b5d76da | aliguori | DisplaySurface* (*resize_displaysurface)(DisplaySurface *surface, int width, int height); |
173 | 7b5d76da | aliguori | void (*free_displaysurface)(DisplaySurface *surface);
|
174 | 7b5d76da | aliguori | }; |
175 | 7b5d76da | aliguori | |
176 | 7d957bd8 | aliguori | struct DisplayState {
|
177 | 7d957bd8 | aliguori | struct DisplaySurface *surface;
|
178 | 7d957bd8 | aliguori | void *opaque;
|
179 | 7d957bd8 | aliguori | struct QEMUTimer *gui_timer;
|
180 | 7d957bd8 | aliguori | |
181 | 7b5d76da | aliguori | struct DisplayAllocator* allocator;
|
182 | 7d957bd8 | aliguori | struct DisplayChangeListener* listeners;
|
183 | 7d957bd8 | aliguori | |
184 | 87ecb68b | pbrook | void (*mouse_set)(int x, int y, int on); |
185 | 254e5950 | Gerd Hoffmann | void (*cursor_define)(QEMUCursor *cursor);
|
186 | 3023f332 | aliguori | |
187 | 3023f332 | aliguori | struct DisplayState *next;
|
188 | 87ecb68b | pbrook | }; |
189 | 87ecb68b | pbrook | |
190 | 3023f332 | aliguori | void register_displaystate(DisplayState *ds);
|
191 | 3023f332 | aliguori | DisplayState *get_displaystate(void);
|
192 | 7d957bd8 | aliguori | DisplaySurface* qemu_create_displaysurface_from(int width, int height, int bpp, |
193 | 7d957bd8 | aliguori | int linesize, uint8_t *data);
|
194 | ffe8b821 | Jes Sorensen | void qemu_alloc_display(DisplaySurface *surface, int width, int height, |
195 | ffe8b821 | Jes Sorensen | int linesize, PixelFormat pf, int newflags); |
196 | 0da2ea1b | malc | PixelFormat qemu_different_endianness_pixelformat(int bpp);
|
197 | 0da2ea1b | malc | PixelFormat qemu_default_pixelformat(int bpp);
|
198 | 7d957bd8 | aliguori | |
199 | 7b5d76da | aliguori | DisplayAllocator *register_displayallocator(DisplayState *ds, DisplayAllocator *da); |
200 | 7b5d76da | aliguori | |
201 | 7b5d76da | aliguori | static inline DisplaySurface* qemu_create_displaysurface(DisplayState *ds, int width, int height) |
202 | 7b5d76da | aliguori | { |
203 | 7b5d76da | aliguori | return ds->allocator->create_displaysurface(width, height);
|
204 | 7b5d76da | aliguori | } |
205 | 7b5d76da | aliguori | |
206 | 7b5d76da | aliguori | static inline DisplaySurface* qemu_resize_displaysurface(DisplayState *ds, int width, int height) |
207 | 7b5d76da | aliguori | { |
208 | 7b5d76da | aliguori | return ds->allocator->resize_displaysurface(ds->surface, width, height);
|
209 | 7b5d76da | aliguori | } |
210 | 7b5d76da | aliguori | |
211 | 7b5d76da | aliguori | static inline void qemu_free_displaysurface(DisplayState *ds) |
212 | 7b5d76da | aliguori | { |
213 | 7b5d76da | aliguori | ds->allocator->free_displaysurface(ds->surface); |
214 | 7b5d76da | aliguori | } |
215 | 7b5d76da | aliguori | |
216 | 7b5d76da | aliguori | static inline int is_surface_bgr(DisplaySurface *surface) |
217 | 7b5d76da | aliguori | { |
218 | 7b5d76da | aliguori | if (surface->pf.bits_per_pixel == 32 && surface->pf.rshift == 0) |
219 | 7b5d76da | aliguori | return 1; |
220 | 7b5d76da | aliguori | else
|
221 | 7b5d76da | aliguori | return 0; |
222 | 7b5d76da | aliguori | } |
223 | 7b5d76da | aliguori | |
224 | 7d957bd8 | aliguori | static inline int is_buffer_shared(DisplaySurface *surface) |
225 | 7d957bd8 | aliguori | { |
226 | c18a2c36 | Stefano Stabellini | return (!(surface->flags & QEMU_ALLOCATED_FLAG) &&
|
227 | c18a2c36 | Stefano Stabellini | !(surface->flags & QEMU_REALPIXELS_FLAG)); |
228 | 7d957bd8 | aliguori | } |
229 | 7d957bd8 | aliguori | |
230 | 7d957bd8 | aliguori | static inline void register_displaychangelistener(DisplayState *ds, DisplayChangeListener *dcl) |
231 | 7d957bd8 | aliguori | { |
232 | 7d957bd8 | aliguori | dcl->next = ds->listeners; |
233 | 7d957bd8 | aliguori | ds->listeners = dcl; |
234 | 7d957bd8 | aliguori | } |
235 | 7d957bd8 | aliguori | |
236 | 87ecb68b | pbrook | static inline void dpy_update(DisplayState *s, int x, int y, int w, int h) |
237 | 87ecb68b | pbrook | { |
238 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
239 | 7d957bd8 | aliguori | while (dcl != NULL) { |
240 | 7d957bd8 | aliguori | dcl->dpy_update(s, x, y, w, h); |
241 | 7d957bd8 | aliguori | dcl = dcl->next; |
242 | 7d957bd8 | aliguori | } |
243 | 87ecb68b | pbrook | } |
244 | 87ecb68b | pbrook | |
245 | 7d957bd8 | aliguori | static inline void dpy_resize(DisplayState *s) |
246 | 87ecb68b | pbrook | { |
247 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
248 | 7d957bd8 | aliguori | while (dcl != NULL) { |
249 | 7d957bd8 | aliguori | dcl->dpy_resize(s); |
250 | 7d957bd8 | aliguori | dcl = dcl->next; |
251 | 7d957bd8 | aliguori | } |
252 | 87ecb68b | pbrook | } |
253 | 87ecb68b | pbrook | |
254 | 7d957bd8 | aliguori | static inline void dpy_setdata(DisplayState *s) |
255 | 4d3b6f6e | balrog | { |
256 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
257 | 7d957bd8 | aliguori | while (dcl != NULL) { |
258 | 7d957bd8 | aliguori | if (dcl->dpy_setdata) dcl->dpy_setdata(s);
|
259 | 7d957bd8 | aliguori | dcl = dcl->next; |
260 | 7d957bd8 | aliguori | } |
261 | 7d957bd8 | aliguori | } |
262 | 7d957bd8 | aliguori | |
263 | 7d957bd8 | aliguori | static inline void dpy_refresh(DisplayState *s) |
264 | 7d957bd8 | aliguori | { |
265 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
266 | 7d957bd8 | aliguori | while (dcl != NULL) { |
267 | 7d957bd8 | aliguori | if (dcl->dpy_refresh) dcl->dpy_refresh(s);
|
268 | 7d957bd8 | aliguori | dcl = dcl->next; |
269 | 7d957bd8 | aliguori | } |
270 | 7d957bd8 | aliguori | } |
271 | 7d957bd8 | aliguori | |
272 | 7d957bd8 | aliguori | static inline void dpy_copy(struct DisplayState *s, int src_x, int src_y, |
273 | 7d957bd8 | aliguori | int dst_x, int dst_y, int w, int h) { |
274 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
275 | 7d957bd8 | aliguori | while (dcl != NULL) { |
276 | 7d957bd8 | aliguori | if (dcl->dpy_copy)
|
277 | 7d957bd8 | aliguori | dcl->dpy_copy(s, src_x, src_y, dst_x, dst_y, w, h); |
278 | 7d957bd8 | aliguori | else /* TODO */ |
279 | 7d957bd8 | aliguori | dcl->dpy_update(s, dst_x, dst_y, w, h); |
280 | 7d957bd8 | aliguori | dcl = dcl->next; |
281 | 7d957bd8 | aliguori | } |
282 | 7d957bd8 | aliguori | } |
283 | 7d957bd8 | aliguori | |
284 | 7d957bd8 | aliguori | static inline void dpy_fill(struct DisplayState *s, int x, int y, |
285 | 7d957bd8 | aliguori | int w, int h, uint32_t c) { |
286 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
287 | 7d957bd8 | aliguori | while (dcl != NULL) { |
288 | 7d957bd8 | aliguori | if (dcl->dpy_fill) dcl->dpy_fill(s, x, y, w, h, c);
|
289 | 7d957bd8 | aliguori | dcl = dcl->next; |
290 | 7d957bd8 | aliguori | } |
291 | 7d957bd8 | aliguori | } |
292 | 7d957bd8 | aliguori | |
293 | 7d957bd8 | aliguori | static inline void dpy_cursor(struct DisplayState *s, int x, int y) { |
294 | 7d957bd8 | aliguori | struct DisplayChangeListener *dcl = s->listeners;
|
295 | 7d957bd8 | aliguori | while (dcl != NULL) { |
296 | 7d957bd8 | aliguori | if (dcl->dpy_text_cursor) dcl->dpy_text_cursor(s, x, y);
|
297 | 7d957bd8 | aliguori | dcl = dcl->next; |
298 | 7d957bd8 | aliguori | } |
299 | 4d3b6f6e | balrog | } |
300 | 4d3b6f6e | balrog | |
301 | 0e1f5a0c | aliguori | static inline int ds_get_linesize(DisplayState *ds) |
302 | 0e1f5a0c | aliguori | { |
303 | 7d957bd8 | aliguori | return ds->surface->linesize;
|
304 | 0e1f5a0c | aliguori | } |
305 | 0e1f5a0c | aliguori | |
306 | 0e1f5a0c | aliguori | static inline uint8_t* ds_get_data(DisplayState *ds) |
307 | 0e1f5a0c | aliguori | { |
308 | 7d957bd8 | aliguori | return ds->surface->data;
|
309 | 0e1f5a0c | aliguori | } |
310 | 0e1f5a0c | aliguori | |
311 | 0e1f5a0c | aliguori | static inline int ds_get_width(DisplayState *ds) |
312 | 0e1f5a0c | aliguori | { |
313 | 7d957bd8 | aliguori | return ds->surface->width;
|
314 | 0e1f5a0c | aliguori | } |
315 | 0e1f5a0c | aliguori | |
316 | 0e1f5a0c | aliguori | static inline int ds_get_height(DisplayState *ds) |
317 | 0e1f5a0c | aliguori | { |
318 | 7d957bd8 | aliguori | return ds->surface->height;
|
319 | 0e1f5a0c | aliguori | } |
320 | 0e1f5a0c | aliguori | |
321 | 0e1f5a0c | aliguori | static inline int ds_get_bits_per_pixel(DisplayState *ds) |
322 | 0e1f5a0c | aliguori | { |
323 | 7d957bd8 | aliguori | return ds->surface->pf.bits_per_pixel;
|
324 | 0e1f5a0c | aliguori | } |
325 | 0e1f5a0c | aliguori | |
326 | 8927bcfd | aliguori | static inline int ds_get_bytes_per_pixel(DisplayState *ds) |
327 | 8927bcfd | aliguori | { |
328 | 7d957bd8 | aliguori | return ds->surface->pf.bytes_per_pixel;
|
329 | 8927bcfd | aliguori | } |
330 | 8927bcfd | aliguori | |
331 | c227f099 | Anthony Liguori | typedef unsigned long console_ch_t; |
332 | c227f099 | Anthony Liguori | static inline void console_write_ch(console_ch_t *dest, uint32_t ch) |
333 | 4d3b6f6e | balrog | { |
334 | f6d20d0f | Bernhard Kauer | if (!(ch & 0xff)) |
335 | f6d20d0f | Bernhard Kauer | ch |= ' ';
|
336 | 9ae19b65 | Aurelien Jarno | *dest = ch; |
337 | 4d3b6f6e | balrog | } |
338 | 4d3b6f6e | balrog | |
339 | 87ecb68b | pbrook | typedef void (*vga_hw_update_ptr)(void *); |
340 | 87ecb68b | pbrook | typedef void (*vga_hw_invalidate_ptr)(void *); |
341 | 87ecb68b | pbrook | typedef void (*vga_hw_screen_dump_ptr)(void *, const char *); |
342 | c227f099 | Anthony Liguori | typedef void (*vga_hw_text_update_ptr)(void *, console_ch_t *); |
343 | 87ecb68b | pbrook | |
344 | 3023f332 | aliguori | DisplayState *graphic_console_init(vga_hw_update_ptr update, |
345 | 3023f332 | aliguori | vga_hw_invalidate_ptr invalidate, |
346 | 3023f332 | aliguori | vga_hw_screen_dump_ptr screen_dump, |
347 | 3023f332 | aliguori | vga_hw_text_update_ptr text_update, |
348 | 3023f332 | aliguori | void *opaque);
|
349 | 3023f332 | aliguori | |
350 | 87ecb68b | pbrook | void vga_hw_update(void); |
351 | 87ecb68b | pbrook | void vga_hw_invalidate(void); |
352 | 87ecb68b | pbrook | void vga_hw_screen_dump(const char *filename); |
353 | c227f099 | Anthony Liguori | void vga_hw_text_update(console_ch_t *chardata);
|
354 | 87ecb68b | pbrook | |
355 | 87ecb68b | pbrook | int is_graphic_console(void); |
356 | c21bbcfa | balrog | int is_fixedsize_console(void); |
357 | 6ea314d9 | Gerd Hoffmann | CharDriverState *text_console_init(QemuOpts *opts); |
358 | 2796dae0 | aliguori | void text_consoles_set_display(DisplayState *ds);
|
359 | 87ecb68b | pbrook | void console_select(unsigned int index); |
360 | 87ecb68b | pbrook | void console_color_init(DisplayState *ds);
|
361 | 3023f332 | aliguori | void qemu_console_resize(DisplayState *ds, int width, int height); |
362 | 3023f332 | aliguori | void qemu_console_copy(DisplayState *ds, int src_x, int src_y, |
363 | 3023f332 | aliguori | int dst_x, int dst_y, int w, int h); |
364 | 87ecb68b | pbrook | |
365 | 87ecb68b | pbrook | /* sdl.c */
|
366 | 87ecb68b | pbrook | void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); |
367 | 87ecb68b | pbrook | |
368 | 87ecb68b | pbrook | /* cocoa.m */
|
369 | 87ecb68b | pbrook | void cocoa_display_init(DisplayState *ds, int full_screen); |
370 | 87ecb68b | pbrook | |
371 | 87ecb68b | pbrook | /* vnc.c */
|
372 | 87ecb68b | pbrook | void vnc_display_init(DisplayState *ds);
|
373 | 87ecb68b | pbrook | void vnc_display_close(DisplayState *ds);
|
374 | 87ecb68b | pbrook | int vnc_display_open(DisplayState *ds, const char *display); |
375 | 1cd20f8b | Anthony Liguori | int vnc_display_disable_login(DisplayState *ds);
|
376 | 821601ea | Jes Sorensen | char *vnc_display_local_addr(DisplayState *ds);
|
377 | 821601ea | Jes Sorensen | #ifdef CONFIG_VNC
|
378 | 821601ea | Jes Sorensen | int vnc_display_password(DisplayState *ds, const char *password); |
379 | 3c9405a0 | Gerd Hoffmann | int vnc_display_pw_expire(DisplayState *ds, time_t expires);
|
380 | d96fd29c | Luiz Capitulino | void do_info_vnc_print(Monitor *mon, const QObject *data); |
381 | d96fd29c | Luiz Capitulino | void do_info_vnc(Monitor *mon, QObject **ret_data);
|
382 | 821601ea | Jes Sorensen | #else
|
383 | 821601ea | Jes Sorensen | static inline int vnc_display_password(DisplayState *ds, const char *password) |
384 | 821601ea | Jes Sorensen | { |
385 | 821601ea | Jes Sorensen | qerror_report(QERR_FEATURE_DISABLED, "vnc");
|
386 | 821601ea | Jes Sorensen | return -ENODEV;
|
387 | 821601ea | Jes Sorensen | } |
388 | 821601ea | Jes Sorensen | static inline int vnc_display_pw_expire(DisplayState *ds, time_t expires) |
389 | 821601ea | Jes Sorensen | { |
390 | 821601ea | Jes Sorensen | qerror_report(QERR_FEATURE_DISABLED, "vnc");
|
391 | 821601ea | Jes Sorensen | return -ENODEV;
|
392 | 821601ea | Jes Sorensen | }; |
393 | 821601ea | Jes Sorensen | static inline void do_info_vnc(Monitor *mon, QObject **ret_data) |
394 | 821601ea | Jes Sorensen | { |
395 | 821601ea | Jes Sorensen | }; |
396 | 821601ea | Jes Sorensen | static inline void do_info_vnc_print(Monitor *mon, const QObject *data) |
397 | 821601ea | Jes Sorensen | { |
398 | 821601ea | Jes Sorensen | monitor_printf(mon, "VNC support disabled\n");
|
399 | 821601ea | Jes Sorensen | }; |
400 | 821601ea | Jes Sorensen | #endif
|
401 | 87ecb68b | pbrook | |
402 | 4d3b6f6e | balrog | /* curses.c */
|
403 | 4d3b6f6e | balrog | void curses_display_init(DisplayState *ds, int full_screen); |
404 | 4d3b6f6e | balrog | |
405 | 87ecb68b | pbrook | #endif |