mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
Merge remote-tracking branch 'bonzini/header-dirs' into staging
* bonzini/header-dirs: (45 commits) janitor: move remaining public headers to include/ hw: move executable format header files to hw/ fpu: move public header file to include/fpu softmmu: move remaining include files to include/ subdirectories softmmu: move include files to include/sysemu/ misc: move include files to include/qemu/ qom: move include files to include/qom/ migration: move include files to include/migration/ monitor: move include files to include/monitor/ exec: move include files to include/exec/ block: move include files to include/block/ qapi: move include files to include/qobject/ janitor: add guards to headers qapi: make struct Visitor opaque qapi: remove qapi/qapi-types-core.h qapi: move inclusions of qemu-common.h from headers to .c files ui: move files to ui/ and include/ui/ qemu-ga: move qemu-ga files to qga/ net: reorganize headers net: move net.c to net/ ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
commit
27dd773058
1124 changed files with 3156 additions and 3429 deletions
|
@ -6,9 +6,14 @@ vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o
|
|||
vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
|
||||
vnc-obj-y += vnc-jobs.o
|
||||
|
||||
common-obj-y += keymaps.o
|
||||
common-obj-y += keymaps.o console.o cursor.o input.o qemu-pixman.o
|
||||
common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
|
||||
common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o
|
||||
common-obj-$(CONFIG_COCOA) += cocoa.o
|
||||
common-obj-$(CONFIG_CURSES) += curses.o
|
||||
common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
|
||||
|
||||
$(obj)/sdl.o $(obj)/sdl_zoom.o: QEMU_CFLAGS += $(SDL_CFLAGS)
|
||||
$(obj)/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
|
||||
|
||||
$(obj)/cocoa.o: $(SRC_PATH)/$(obj)/cocoa.m
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include <crt_externs.h>
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "console.h"
|
||||
#include "sysemu.h"
|
||||
#include "ui/console.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_4
|
||||
#define MAC_OS_X_VERSION_10_4 1040
|
||||
|
|
1724
ui/console.c
Normal file
1724
ui/console.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -29,8 +29,8 @@
|
|||
#endif
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "console.h"
|
||||
#include "sysemu.h"
|
||||
#include "ui/console.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#define FONT_HEIGHT 16
|
||||
#define FONT_WIDTH 8
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_CURSES_KEYS_H
|
||||
#define QEMU_CURSES_KEYS_H 1
|
||||
|
||||
#include <curses.h>
|
||||
#include "keymaps.h"
|
||||
|
||||
|
@ -507,3 +510,5 @@ static const name2keysym_t name2keysym[] = {
|
|||
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
211
ui/cursor.c
Normal file
211
ui/cursor.c
Normal file
|
@ -0,0 +1,211 @@
|
|||
#include "qemu-common.h"
|
||||
#include "ui/console.h"
|
||||
|
||||
#include "cursor_hidden.xpm"
|
||||
#include "cursor_left_ptr.xpm"
|
||||
|
||||
/* for creating built-in cursors */
|
||||
static QEMUCursor *cursor_parse_xpm(const char *xpm[])
|
||||
{
|
||||
QEMUCursor *c;
|
||||
uint32_t ctab[128];
|
||||
unsigned int width, height, colors, chars;
|
||||
unsigned int line = 0, i, r, g, b, x, y, pixel;
|
||||
char name[16];
|
||||
uint8_t idx;
|
||||
|
||||
/* parse header line: width, height, #colors, #chars */
|
||||
if (sscanf(xpm[line], "%u %u %u %u",
|
||||
&width, &height, &colors, &chars) != 4) {
|
||||
fprintf(stderr, "%s: header parse error: \"%s\"\n",
|
||||
__FUNCTION__, xpm[line]);
|
||||
return NULL;
|
||||
}
|
||||
if (chars != 1) {
|
||||
fprintf(stderr, "%s: chars != 1 not supported\n", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
line++;
|
||||
|
||||
/* parse color table */
|
||||
for (i = 0; i < colors; i++, line++) {
|
||||
if (sscanf(xpm[line], "%c c %15s", &idx, name) == 2) {
|
||||
if (sscanf(name, "#%02x%02x%02x", &r, &g, &b) == 3) {
|
||||
ctab[idx] = (0xff << 24) | (b << 16) | (g << 8) | r;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(name, "None") == 0) {
|
||||
ctab[idx] = 0x00000000;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s: color parse error: \"%s\"\n",
|
||||
__FUNCTION__, xpm[line]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* parse pixel data */
|
||||
c = cursor_alloc(width, height);
|
||||
for (pixel = 0, y = 0; y < height; y++, line++) {
|
||||
for (x = 0; x < height; x++, pixel++) {
|
||||
idx = xpm[line][x];
|
||||
c->data[pixel] = ctab[idx];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/* nice for debugging */
|
||||
void cursor_print_ascii_art(QEMUCursor *c, const char *prefix)
|
||||
{
|
||||
uint32_t *data = c->data;
|
||||
int x,y;
|
||||
|
||||
for (y = 0; y < c->height; y++) {
|
||||
fprintf(stderr, "%s: %2d: |", prefix, y);
|
||||
for (x = 0; x < c->width; x++, data++) {
|
||||
if ((*data & 0xff000000) != 0xff000000) {
|
||||
fprintf(stderr, " "); /* transparent */
|
||||
} else if ((*data & 0x00ffffff) == 0x00ffffff) {
|
||||
fprintf(stderr, "."); /* white */
|
||||
} else if ((*data & 0x00ffffff) == 0x00000000) {
|
||||
fprintf(stderr, "X"); /* black */
|
||||
} else {
|
||||
fprintf(stderr, "o"); /* other */
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "|\n");
|
||||
}
|
||||
}
|
||||
|
||||
QEMUCursor *cursor_builtin_hidden(void)
|
||||
{
|
||||
QEMUCursor *c;
|
||||
|
||||
c = cursor_parse_xpm(cursor_hidden_xpm);
|
||||
return c;
|
||||
}
|
||||
|
||||
QEMUCursor *cursor_builtin_left_ptr(void)
|
||||
{
|
||||
QEMUCursor *c;
|
||||
|
||||
c = cursor_parse_xpm(cursor_left_ptr_xpm);
|
||||
return c;
|
||||
}
|
||||
|
||||
QEMUCursor *cursor_alloc(int width, int height)
|
||||
{
|
||||
QEMUCursor *c;
|
||||
int datasize = width * height * sizeof(uint32_t);
|
||||
|
||||
c = g_malloc0(sizeof(QEMUCursor) + datasize);
|
||||
c->width = width;
|
||||
c->height = height;
|
||||
c->refcount = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
void cursor_get(QEMUCursor *c)
|
||||
{
|
||||
c->refcount++;
|
||||
}
|
||||
|
||||
void cursor_put(QEMUCursor *c)
|
||||
{
|
||||
if (c == NULL)
|
||||
return;
|
||||
c->refcount--;
|
||||
if (c->refcount)
|
||||
return;
|
||||
g_free(c);
|
||||
}
|
||||
|
||||
int cursor_get_mono_bpl(QEMUCursor *c)
|
||||
{
|
||||
return (c->width + 7) / 8;
|
||||
}
|
||||
|
||||
void cursor_set_mono(QEMUCursor *c,
|
||||
uint32_t foreground, uint32_t background, uint8_t *image,
|
||||
int transparent, uint8_t *mask)
|
||||
{
|
||||
uint32_t *data = c->data;
|
||||
uint8_t bit;
|
||||
int x,y,bpl;
|
||||
|
||||
bpl = cursor_get_mono_bpl(c);
|
||||
for (y = 0; y < c->height; y++) {
|
||||
bit = 0x80;
|
||||
for (x = 0; x < c->width; x++, data++) {
|
||||
if (transparent && mask[x/8] & bit) {
|
||||
*data = 0x00000000;
|
||||
} else if (!transparent && !(mask[x/8] & bit)) {
|
||||
*data = 0x00000000;
|
||||
} else if (image[x/8] & bit) {
|
||||
*data = 0xff000000 | foreground;
|
||||
} else {
|
||||
*data = 0xff000000 | background;
|
||||
}
|
||||
bit >>= 1;
|
||||
if (bit == 0) {
|
||||
bit = 0x80;
|
||||
}
|
||||
}
|
||||
mask += bpl;
|
||||
image += bpl;
|
||||
}
|
||||
}
|
||||
|
||||
void cursor_get_mono_image(QEMUCursor *c, int foreground, uint8_t *image)
|
||||
{
|
||||
uint32_t *data = c->data;
|
||||
uint8_t bit;
|
||||
int x,y,bpl;
|
||||
|
||||
bpl = cursor_get_mono_bpl(c);
|
||||
memset(image, 0, bpl * c->height);
|
||||
for (y = 0; y < c->height; y++) {
|
||||
bit = 0x80;
|
||||
for (x = 0; x < c->width; x++, data++) {
|
||||
if (((*data & 0xff000000) == 0xff000000) &&
|
||||
((*data & 0x00ffffff) == foreground)) {
|
||||
image[x/8] |= bit;
|
||||
}
|
||||
bit >>= 1;
|
||||
if (bit == 0) {
|
||||
bit = 0x80;
|
||||
}
|
||||
}
|
||||
image += bpl;
|
||||
}
|
||||
}
|
||||
|
||||
void cursor_get_mono_mask(QEMUCursor *c, int transparent, uint8_t *mask)
|
||||
{
|
||||
uint32_t *data = c->data;
|
||||
uint8_t bit;
|
||||
int x,y,bpl;
|
||||
|
||||
bpl = cursor_get_mono_bpl(c);
|
||||
memset(mask, 0, bpl * c->height);
|
||||
for (y = 0; y < c->height; y++) {
|
||||
bit = 0x80;
|
||||
for (x = 0; x < c->width; x++, data++) {
|
||||
if ((*data & 0xff000000) != 0xff000000) {
|
||||
if (transparent != 0) {
|
||||
mask[x/8] |= bit;
|
||||
}
|
||||
} else {
|
||||
if (transparent == 0) {
|
||||
mask[x/8] |= bit;
|
||||
}
|
||||
}
|
||||
bit >>= 1;
|
||||
if (bit == 0) {
|
||||
bit = 0x80;
|
||||
}
|
||||
}
|
||||
mask += bpl;
|
||||
}
|
||||
}
|
37
ui/cursor_hidden.xpm
Normal file
37
ui/cursor_hidden.xpm
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* XPM */
|
||||
static const char *cursor_hidden_xpm[] = {
|
||||
"32 32 1 1",
|
||||
" c None",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
};
|
39
ui/cursor_left_ptr.xpm
Normal file
39
ui/cursor_left_ptr.xpm
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* XPM */
|
||||
static const char *cursor_left_ptr_xpm[] = {
|
||||
"32 32 3 1",
|
||||
"X c #000000",
|
||||
". c #ffffff",
|
||||
" c None",
|
||||
"X ",
|
||||
"XX ",
|
||||
"X.X ",
|
||||
"X..X ",
|
||||
"X...X ",
|
||||
"X....X ",
|
||||
"X.....X ",
|
||||
"X......X ",
|
||||
"X.......X ",
|
||||
"X........X ",
|
||||
"X.....XXXXX ",
|
||||
"X..X..X ",
|
||||
"X.X X..X ",
|
||||
"XX X..X ",
|
||||
"X X..X ",
|
||||
" X..X ",
|
||||
" X..X ",
|
||||
" X..X ",
|
||||
" XX ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
};
|
|
@ -9,6 +9,8 @@
|
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef D3DES_H
|
||||
#define D3DES_H 1
|
||||
|
||||
/* d3des.h -
|
||||
*
|
||||
|
@ -49,3 +51,5 @@ void des(unsigned char *, unsigned char *);
|
|||
|
||||
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
|
||||
********************************************************************/
|
||||
|
||||
#endif
|
||||
|
|
529
ui/input.c
Normal file
529
ui/input.c
Normal file
|
@ -0,0 +1,529 @@
|
|||
/*
|
||||
* QEMU System Emulator
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "ui/console.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
static QEMUPutKBDEvent *qemu_put_kbd_event;
|
||||
static void *qemu_put_kbd_event_opaque;
|
||||
static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers);
|
||||
static QTAILQ_HEAD(, QEMUPutMouseEntry) mouse_handlers =
|
||||
QTAILQ_HEAD_INITIALIZER(mouse_handlers);
|
||||
static NotifierList mouse_mode_notifiers =
|
||||
NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers);
|
||||
|
||||
static const int key_defs[] = {
|
||||
[Q_KEY_CODE_SHIFT] = 0x2a,
|
||||
[Q_KEY_CODE_SHIFT_R] = 0x36,
|
||||
|
||||
[Q_KEY_CODE_ALT] = 0x38,
|
||||
[Q_KEY_CODE_ALT_R] = 0xb8,
|
||||
[Q_KEY_CODE_ALTGR] = 0x64,
|
||||
[Q_KEY_CODE_ALTGR_R] = 0xe4,
|
||||
[Q_KEY_CODE_CTRL] = 0x1d,
|
||||
[Q_KEY_CODE_CTRL_R] = 0x9d,
|
||||
|
||||
[Q_KEY_CODE_MENU] = 0xdd,
|
||||
|
||||
[Q_KEY_CODE_ESC] = 0x01,
|
||||
|
||||
[Q_KEY_CODE_1] = 0x02,
|
||||
[Q_KEY_CODE_2] = 0x03,
|
||||
[Q_KEY_CODE_3] = 0x04,
|
||||
[Q_KEY_CODE_4] = 0x05,
|
||||
[Q_KEY_CODE_5] = 0x06,
|
||||
[Q_KEY_CODE_6] = 0x07,
|
||||
[Q_KEY_CODE_7] = 0x08,
|
||||
[Q_KEY_CODE_8] = 0x09,
|
||||
[Q_KEY_CODE_9] = 0x0a,
|
||||
[Q_KEY_CODE_0] = 0x0b,
|
||||
[Q_KEY_CODE_MINUS] = 0x0c,
|
||||
[Q_KEY_CODE_EQUAL] = 0x0d,
|
||||
[Q_KEY_CODE_BACKSPACE] = 0x0e,
|
||||
|
||||
[Q_KEY_CODE_TAB] = 0x0f,
|
||||
[Q_KEY_CODE_Q] = 0x10,
|
||||
[Q_KEY_CODE_W] = 0x11,
|
||||
[Q_KEY_CODE_E] = 0x12,
|
||||
[Q_KEY_CODE_R] = 0x13,
|
||||
[Q_KEY_CODE_T] = 0x14,
|
||||
[Q_KEY_CODE_Y] = 0x15,
|
||||
[Q_KEY_CODE_U] = 0x16,
|
||||
[Q_KEY_CODE_I] = 0x17,
|
||||
[Q_KEY_CODE_O] = 0x18,
|
||||
[Q_KEY_CODE_P] = 0x19,
|
||||
[Q_KEY_CODE_BRACKET_LEFT] = 0x1a,
|
||||
[Q_KEY_CODE_BRACKET_RIGHT] = 0x1b,
|
||||
[Q_KEY_CODE_RET] = 0x1c,
|
||||
|
||||
[Q_KEY_CODE_A] = 0x1e,
|
||||
[Q_KEY_CODE_S] = 0x1f,
|
||||
[Q_KEY_CODE_D] = 0x20,
|
||||
[Q_KEY_CODE_F] = 0x21,
|
||||
[Q_KEY_CODE_G] = 0x22,
|
||||
[Q_KEY_CODE_H] = 0x23,
|
||||
[Q_KEY_CODE_J] = 0x24,
|
||||
[Q_KEY_CODE_K] = 0x25,
|
||||
[Q_KEY_CODE_L] = 0x26,
|
||||
[Q_KEY_CODE_SEMICOLON] = 0x27,
|
||||
[Q_KEY_CODE_APOSTROPHE] = 0x28,
|
||||
[Q_KEY_CODE_GRAVE_ACCENT] = 0x29,
|
||||
|
||||
[Q_KEY_CODE_BACKSLASH] = 0x2b,
|
||||
[Q_KEY_CODE_Z] = 0x2c,
|
||||
[Q_KEY_CODE_X] = 0x2d,
|
||||
[Q_KEY_CODE_C] = 0x2e,
|
||||
[Q_KEY_CODE_V] = 0x2f,
|
||||
[Q_KEY_CODE_B] = 0x30,
|
||||
[Q_KEY_CODE_N] = 0x31,
|
||||
[Q_KEY_CODE_M] = 0x32,
|
||||
[Q_KEY_CODE_COMMA] = 0x33,
|
||||
[Q_KEY_CODE_DOT] = 0x34,
|
||||
[Q_KEY_CODE_SLASH] = 0x35,
|
||||
|
||||
[Q_KEY_CODE_ASTERISK] = 0x37,
|
||||
|
||||
[Q_KEY_CODE_SPC] = 0x39,
|
||||
[Q_KEY_CODE_CAPS_LOCK] = 0x3a,
|
||||
[Q_KEY_CODE_F1] = 0x3b,
|
||||
[Q_KEY_CODE_F2] = 0x3c,
|
||||
[Q_KEY_CODE_F3] = 0x3d,
|
||||
[Q_KEY_CODE_F4] = 0x3e,
|
||||
[Q_KEY_CODE_F5] = 0x3f,
|
||||
[Q_KEY_CODE_F6] = 0x40,
|
||||
[Q_KEY_CODE_F7] = 0x41,
|
||||
[Q_KEY_CODE_F8] = 0x42,
|
||||
[Q_KEY_CODE_F9] = 0x43,
|
||||
[Q_KEY_CODE_F10] = 0x44,
|
||||
[Q_KEY_CODE_NUM_LOCK] = 0x45,
|
||||
[Q_KEY_CODE_SCROLL_LOCK] = 0x46,
|
||||
|
||||
[Q_KEY_CODE_KP_DIVIDE] = 0xb5,
|
||||
[Q_KEY_CODE_KP_MULTIPLY] = 0x37,
|
||||
[Q_KEY_CODE_KP_SUBTRACT] = 0x4a,
|
||||
[Q_KEY_CODE_KP_ADD] = 0x4e,
|
||||
[Q_KEY_CODE_KP_ENTER] = 0x9c,
|
||||
[Q_KEY_CODE_KP_DECIMAL] = 0x53,
|
||||
[Q_KEY_CODE_SYSRQ] = 0x54,
|
||||
|
||||
[Q_KEY_CODE_KP_0] = 0x52,
|
||||
[Q_KEY_CODE_KP_1] = 0x4f,
|
||||
[Q_KEY_CODE_KP_2] = 0x50,
|
||||
[Q_KEY_CODE_KP_3] = 0x51,
|
||||
[Q_KEY_CODE_KP_4] = 0x4b,
|
||||
[Q_KEY_CODE_KP_5] = 0x4c,
|
||||
[Q_KEY_CODE_KP_6] = 0x4d,
|
||||
[Q_KEY_CODE_KP_7] = 0x47,
|
||||
[Q_KEY_CODE_KP_8] = 0x48,
|
||||
[Q_KEY_CODE_KP_9] = 0x49,
|
||||
|
||||
[Q_KEY_CODE_LESS] = 0x56,
|
||||
|
||||
[Q_KEY_CODE_F11] = 0x57,
|
||||
[Q_KEY_CODE_F12] = 0x58,
|
||||
|
||||
[Q_KEY_CODE_PRINT] = 0xb7,
|
||||
|
||||
[Q_KEY_CODE_HOME] = 0xc7,
|
||||
[Q_KEY_CODE_PGUP] = 0xc9,
|
||||
[Q_KEY_CODE_PGDN] = 0xd1,
|
||||
[Q_KEY_CODE_END] = 0xcf,
|
||||
|
||||
[Q_KEY_CODE_LEFT] = 0xcb,
|
||||
[Q_KEY_CODE_UP] = 0xc8,
|
||||
[Q_KEY_CODE_DOWN] = 0xd0,
|
||||
[Q_KEY_CODE_RIGHT] = 0xcd,
|
||||
|
||||
[Q_KEY_CODE_INSERT] = 0xd2,
|
||||
[Q_KEY_CODE_DELETE] = 0xd3,
|
||||
#ifdef NEED_CPU_H
|
||||
#if defined(TARGET_SPARC) && !defined(TARGET_SPARC64)
|
||||
[Q_KEY_CODE_STOP] = 0xf0,
|
||||
[Q_KEY_CODE_AGAIN] = 0xf1,
|
||||
[Q_KEY_CODE_PROPS] = 0xf2,
|
||||
[Q_KEY_CODE_UNDO] = 0xf3,
|
||||
[Q_KEY_CODE_FRONT] = 0xf4,
|
||||
[Q_KEY_CODE_COPY] = 0xf5,
|
||||
[Q_KEY_CODE_OPEN] = 0xf6,
|
||||
[Q_KEY_CODE_PASTE] = 0xf7,
|
||||
[Q_KEY_CODE_FIND] = 0xf8,
|
||||
[Q_KEY_CODE_CUT] = 0xf9,
|
||||
[Q_KEY_CODE_LF] = 0xfa,
|
||||
[Q_KEY_CODE_HELP] = 0xfb,
|
||||
[Q_KEY_CODE_META_L] = 0xfc,
|
||||
[Q_KEY_CODE_META_R] = 0xfd,
|
||||
[Q_KEY_CODE_COMPOSE] = 0xfe,
|
||||
#endif
|
||||
#endif
|
||||
[Q_KEY_CODE_MAX] = 0,
|
||||
};
|
||||
|
||||
int index_from_key(const char *key)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; QKeyCode_lookup[i] != NULL; i++) {
|
||||
if (!strcmp(key, QKeyCode_lookup[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return Q_KEY_CODE_MAX if the key is invalid */
|
||||
return i;
|
||||
}
|
||||
|
||||
int index_from_keycode(int code)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Q_KEY_CODE_MAX; i++) {
|
||||
if (key_defs[i] == code) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return Q_KEY_CODE_MAX if the code is invalid */
|
||||
return i;
|
||||
}
|
||||
|
||||
static int *keycodes;
|
||||
static int keycodes_size;
|
||||
static QEMUTimer *key_timer;
|
||||
|
||||
static int keycode_from_keyvalue(const KeyValue *value)
|
||||
{
|
||||
if (value->kind == KEY_VALUE_KIND_QCODE) {
|
||||
return key_defs[value->qcode];
|
||||
} else {
|
||||
assert(value->kind == KEY_VALUE_KIND_NUMBER);
|
||||
return value->number;
|
||||
}
|
||||
}
|
||||
|
||||
static void free_keycodes(void)
|
||||
{
|
||||
g_free(keycodes);
|
||||
keycodes = NULL;
|
||||
keycodes_size = 0;
|
||||
}
|
||||
|
||||
static void release_keys(void *opaque)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < keycodes_size; i++) {
|
||||
if (keycodes[i] & 0x80) {
|
||||
kbd_put_keycode(0xe0);
|
||||
}
|
||||
kbd_put_keycode(keycodes[i]| 0x80);
|
||||
}
|
||||
|
||||
free_keycodes();
|
||||
}
|
||||
|
||||
void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
|
||||
Error **errp)
|
||||
{
|
||||
int keycode;
|
||||
KeyValueList *p;
|
||||
|
||||
if (!key_timer) {
|
||||
key_timer = qemu_new_timer_ns(vm_clock, release_keys, NULL);
|
||||
}
|
||||
|
||||
if (keycodes != NULL) {
|
||||
qemu_del_timer(key_timer);
|
||||
release_keys(NULL);
|
||||
}
|
||||
|
||||
if (!has_hold_time) {
|
||||
hold_time = 100;
|
||||
}
|
||||
|
||||
for (p = keys; p != NULL; p = p->next) {
|
||||
/* key down events */
|
||||
keycode = keycode_from_keyvalue(p->value);
|
||||
if (keycode < 0x01 || keycode > 0xff) {
|
||||
error_setg(errp, "invalid hex keycode 0x%x\n", keycode);
|
||||
free_keycodes();
|
||||
return;
|
||||
}
|
||||
|
||||
if (keycode & 0x80) {
|
||||
kbd_put_keycode(0xe0);
|
||||
}
|
||||
kbd_put_keycode(keycode & 0x7f);
|
||||
|
||||
keycodes = g_realloc(keycodes, sizeof(int) * (keycodes_size + 1));
|
||||
keycodes[keycodes_size++] = keycode;
|
||||
}
|
||||
|
||||
/* delayed key up events */
|
||||
qemu_mod_timer(key_timer, qemu_get_clock_ns(vm_clock) +
|
||||
muldiv64(get_ticks_per_sec(), hold_time, 1000));
|
||||
}
|
||||
|
||||
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
|
||||
{
|
||||
qemu_put_kbd_event_opaque = opaque;
|
||||
qemu_put_kbd_event = func;
|
||||
}
|
||||
|
||||
void qemu_remove_kbd_event_handler(void)
|
||||
{
|
||||
qemu_put_kbd_event_opaque = NULL;
|
||||
qemu_put_kbd_event = NULL;
|
||||
}
|
||||
|
||||
static void check_mode_change(void)
|
||||
{
|
||||
static int current_is_absolute, current_has_absolute;
|
||||
int is_absolute;
|
||||
int has_absolute;
|
||||
|
||||
is_absolute = kbd_mouse_is_absolute();
|
||||
has_absolute = kbd_mouse_has_absolute();
|
||||
|
||||
if (is_absolute != current_is_absolute ||
|
||||
has_absolute != current_has_absolute) {
|
||||
notifier_list_notify(&mouse_mode_notifiers, NULL);
|
||||
}
|
||||
|
||||
current_is_absolute = is_absolute;
|
||||
current_has_absolute = has_absolute;
|
||||
}
|
||||
|
||||
QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
|
||||
void *opaque, int absolute,
|
||||
const char *name)
|
||||
{
|
||||
QEMUPutMouseEntry *s;
|
||||
static int mouse_index = 0;
|
||||
|
||||
s = g_malloc0(sizeof(QEMUPutMouseEntry));
|
||||
|
||||
s->qemu_put_mouse_event = func;
|
||||
s->qemu_put_mouse_event_opaque = opaque;
|
||||
s->qemu_put_mouse_event_absolute = absolute;
|
||||
s->qemu_put_mouse_event_name = g_strdup(name);
|
||||
s->index = mouse_index++;
|
||||
|
||||
QTAILQ_INSERT_TAIL(&mouse_handlers, s, node);
|
||||
|
||||
check_mode_change();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry)
|
||||
{
|
||||
QTAILQ_REMOVE(&mouse_handlers, entry, node);
|
||||
QTAILQ_INSERT_HEAD(&mouse_handlers, entry, node);
|
||||
|
||||
check_mode_change();
|
||||
}
|
||||
|
||||
void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry)
|
||||
{
|
||||
QTAILQ_REMOVE(&mouse_handlers, entry, node);
|
||||
|
||||
g_free(entry->qemu_put_mouse_event_name);
|
||||
g_free(entry);
|
||||
|
||||
check_mode_change();
|
||||
}
|
||||
|
||||
QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func,
|
||||
void *opaque)
|
||||
{
|
||||
QEMUPutLEDEntry *s;
|
||||
|
||||
s = g_malloc0(sizeof(QEMUPutLEDEntry));
|
||||
|
||||
s->put_led = func;
|
||||
s->opaque = opaque;
|
||||
QTAILQ_INSERT_TAIL(&led_handlers, s, next);
|
||||
return s;
|
||||
}
|
||||
|
||||
void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
|
||||
{
|
||||
if (entry == NULL)
|
||||
return;
|
||||
QTAILQ_REMOVE(&led_handlers, entry, next);
|
||||
g_free(entry);
|
||||
}
|
||||
|
||||
void kbd_put_keycode(int keycode)
|
||||
{
|
||||
if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
|
||||
return;
|
||||
}
|
||||
if (qemu_put_kbd_event) {
|
||||
qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode);
|
||||
}
|
||||
}
|
||||
|
||||
void kbd_put_ledstate(int ledstate)
|
||||
{
|
||||
QEMUPutLEDEntry *cursor;
|
||||
|
||||
QTAILQ_FOREACH(cursor, &led_handlers, next) {
|
||||
cursor->put_led(cursor->opaque, ledstate);
|
||||
}
|
||||
}
|
||||
|
||||
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
|
||||
{
|
||||
QEMUPutMouseEntry *entry;
|
||||
QEMUPutMouseEvent *mouse_event;
|
||||
void *mouse_event_opaque;
|
||||
int width, height;
|
||||
|
||||
if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
|
||||
return;
|
||||
}
|
||||
if (QTAILQ_EMPTY(&mouse_handlers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
entry = QTAILQ_FIRST(&mouse_handlers);
|
||||
|
||||
mouse_event = entry->qemu_put_mouse_event;
|
||||
mouse_event_opaque = entry->qemu_put_mouse_event_opaque;
|
||||
|
||||
if (mouse_event) {
|
||||
if (entry->qemu_put_mouse_event_absolute) {
|
||||
width = 0x7fff;
|
||||
height = 0x7fff;
|
||||
} else {
|
||||
width = graphic_width - 1;
|
||||
height = graphic_height - 1;
|
||||
}
|
||||
|
||||
switch (graphic_rotate) {
|
||||
case 0:
|
||||
mouse_event(mouse_event_opaque,
|
||||
dx, dy, dz, buttons_state);
|
||||
break;
|
||||
case 90:
|
||||
mouse_event(mouse_event_opaque,
|
||||
width - dy, dx, dz, buttons_state);
|
||||
break;
|
||||
case 180:
|
||||
mouse_event(mouse_event_opaque,
|
||||
width - dx, height - dy, dz, buttons_state);
|
||||
break;
|
||||
case 270:
|
||||
mouse_event(mouse_event_opaque,
|
||||
dy, height - dx, dz, buttons_state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int kbd_mouse_is_absolute(void)
|
||||
{
|
||||
if (QTAILQ_EMPTY(&mouse_handlers)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QTAILQ_FIRST(&mouse_handlers)->qemu_put_mouse_event_absolute;
|
||||
}
|
||||
|
||||
int kbd_mouse_has_absolute(void)
|
||||
{
|
||||
QEMUPutMouseEntry *entry;
|
||||
|
||||
QTAILQ_FOREACH(entry, &mouse_handlers, node) {
|
||||
if (entry->qemu_put_mouse_event_absolute) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MouseInfoList *qmp_query_mice(Error **errp)
|
||||
{
|
||||
MouseInfoList *mice_list = NULL;
|
||||
QEMUPutMouseEntry *cursor;
|
||||
bool current = true;
|
||||
|
||||
QTAILQ_FOREACH(cursor, &mouse_handlers, node) {
|
||||
MouseInfoList *info = g_malloc0(sizeof(*info));
|
||||
info->value = g_malloc0(sizeof(*info->value));
|
||||
info->value->name = g_strdup(cursor->qemu_put_mouse_event_name);
|
||||
info->value->index = cursor->index;
|
||||
info->value->absolute = !!cursor->qemu_put_mouse_event_absolute;
|
||||
info->value->current = current;
|
||||
|
||||
current = false;
|
||||
|
||||
info->next = mice_list;
|
||||
mice_list = info;
|
||||
}
|
||||
|
||||
return mice_list;
|
||||
}
|
||||
|
||||
void do_mouse_set(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
QEMUPutMouseEntry *cursor;
|
||||
int index = qdict_get_int(qdict, "index");
|
||||
int found = 0;
|
||||
|
||||
if (QTAILQ_EMPTY(&mouse_handlers)) {
|
||||
monitor_printf(mon, "No mouse devices connected\n");
|
||||
return;
|
||||
}
|
||||
|
||||
QTAILQ_FOREACH(cursor, &mouse_handlers, node) {
|
||||
if (cursor->index == index) {
|
||||
found = 1;
|
||||
qemu_activate_mouse_event_handler(cursor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
monitor_printf(mon, "Mouse at given index not found\n");
|
||||
}
|
||||
|
||||
check_mode_change();
|
||||
}
|
||||
|
||||
void qemu_add_mouse_mode_change_notifier(Notifier *notify)
|
||||
{
|
||||
notifier_list_add(&mouse_mode_notifiers, notify);
|
||||
}
|
||||
|
||||
void qemu_remove_mouse_mode_change_notifier(Notifier *notify)
|
||||
{
|
||||
notifier_remove(notify);
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "keymaps.h"
|
||||
#include "sysemu.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
static int get_keysym(const name2keysym_t *table,
|
||||
const char *name)
|
||||
|
|
80
ui/qemu-pixman.c
Normal file
80
ui/qemu-pixman.c
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "ui/qemu-pixman.h"
|
||||
|
||||
int qemu_pixman_get_type(int rshift, int gshift, int bshift)
|
||||
{
|
||||
int type = PIXMAN_TYPE_OTHER;
|
||||
|
||||
if (rshift > gshift && gshift > bshift) {
|
||||
if (bshift == 0) {
|
||||
type = PIXMAN_TYPE_ARGB;
|
||||
} else {
|
||||
#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)
|
||||
type = PIXMAN_TYPE_RGBA;
|
||||
#endif
|
||||
}
|
||||
} else if (rshift < gshift && gshift < bshift) {
|
||||
if (rshift == 0) {
|
||||
type = PIXMAN_TYPE_ABGR;
|
||||
} else {
|
||||
#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 16, 0)
|
||||
type = PIXMAN_TYPE_BGRA;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
|
||||
{
|
||||
pixman_format_code_t format;
|
||||
int type;
|
||||
|
||||
type = qemu_pixman_get_type(pf->rshift, pf->gshift, pf->bshift);
|
||||
format = PIXMAN_FORMAT(pf->bits_per_pixel, type,
|
||||
pf->abits, pf->rbits, pf->gbits, pf->bbits);
|
||||
if (!pixman_format_supported_source(format)) {
|
||||
return 0;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
|
||||
int width)
|
||||
{
|
||||
pixman_image_t *image = pixman_image_create_bits(format, width, 1, NULL, 0);
|
||||
assert(image != NULL);
|
||||
return image;
|
||||
}
|
||||
|
||||
void qemu_pixman_linebuf_fill(pixman_image_t *linebuf, pixman_image_t *fb,
|
||||
int width, int x, int y)
|
||||
{
|
||||
pixman_image_composite(PIXMAN_OP_SRC, fb, NULL, linebuf,
|
||||
x, y, 0, 0, 0, 0, width, 1);
|
||||
}
|
||||
|
||||
pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
|
||||
pixman_image_t *image)
|
||||
{
|
||||
pixman_image_t *mirror;
|
||||
|
||||
mirror = pixman_image_create_bits(format,
|
||||
pixman_image_get_width(image),
|
||||
pixman_image_get_height(image),
|
||||
NULL,
|
||||
pixman_image_get_stride(image));
|
||||
return mirror;
|
||||
}
|
||||
|
||||
void qemu_pixman_image_unref(pixman_image_t *image)
|
||||
{
|
||||
if (image == NULL) {
|
||||
return;
|
||||
}
|
||||
pixman_image_unref(image);
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_SPICE_H
|
||||
#define QEMU_SPICE_H
|
||||
|
||||
#ifdef CONFIG_SPICE
|
||||
|
||||
#include <spice.h>
|
||||
|
||||
#include "qemu-option.h"
|
||||
#include "qemu-config.h"
|
||||
#include "qemu-char.h"
|
||||
#include "monitor.h"
|
||||
|
||||
extern int using_spice;
|
||||
|
||||
void qemu_spice_init(void);
|
||||
void qemu_spice_input_init(void);
|
||||
void qemu_spice_audio_init(void);
|
||||
void qemu_spice_display_init(DisplayState *ds);
|
||||
int qemu_spice_display_add_client(int csock, int skipauth, int tls);
|
||||
int qemu_spice_add_interface(SpiceBaseInstance *sin);
|
||||
int qemu_spice_set_passwd(const char *passwd,
|
||||
bool fail_if_connected, bool disconnect_if_connected);
|
||||
int qemu_spice_set_pw_expire(time_t expires);
|
||||
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
|
||||
const char *subject,
|
||||
MonitorCompletion cb, void *opaque);
|
||||
|
||||
void do_info_spice_print(Monitor *mon, const QObject *data);
|
||||
void do_info_spice(Monitor *mon, QObject **ret_data);
|
||||
|
||||
CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
|
||||
#if SPICE_SERVER_VERSION >= 0x000c02
|
||||
CharDriverState *qemu_chr_open_spice_port(QemuOpts *opts);
|
||||
void qemu_spice_register_ports(void);
|
||||
#endif
|
||||
|
||||
#else /* CONFIG_SPICE */
|
||||
#include "monitor.h"
|
||||
|
||||
#define using_spice 0
|
||||
static inline int qemu_spice_set_passwd(const char *passwd,
|
||||
bool fail_if_connected,
|
||||
bool disconnect_if_connected)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
static inline int qemu_spice_set_pw_expire(time_t expires)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
static inline int qemu_spice_migrate_info(const char *h, int p, int t,
|
||||
const char *s,
|
||||
MonitorCompletion cb, void *opaque)
|
||||
{
|
||||
cb(opaque, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int qemu_spice_display_add_client(int csock, int skipauth,
|
||||
int tls)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SPICE */
|
||||
|
||||
#endif /* QEMU_SPICE_H */
|
9
ui/qemu-x509.h
Normal file
9
ui/qemu-x509.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef QEMU_X509_H
|
||||
#define QEMU_X509_H
|
||||
|
||||
#define X509_CA_CERT_FILE "ca-cert.pem"
|
||||
#define X509_CA_CRL_FILE "ca-crl.pem"
|
||||
#define X509_SERVER_KEY_FILE "server-key.pem"
|
||||
#define X509_SERVER_CERT_FILE "server-cert.pem"
|
||||
|
||||
#endif /* QEMU_X509_H */
|
4
ui/sdl.c
4
ui/sdl.c
|
@ -29,8 +29,8 @@
|
|||
#include <SDL_syswm.h>
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "console.h"
|
||||
#include "sysemu.h"
|
||||
#include "ui/console.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "x_keymap.h"
|
||||
#include "sdl_zoom.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
#include "sdl_zoom.h"
|
||||
#include "osdep.h"
|
||||
#include "qemu/osdep.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -19,25 +19,25 @@
|
|||
#include <spice-experimental.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include "sysemu.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-spice.h"
|
||||
#include "qemu-thread.h"
|
||||
#include "qemu-timer.h"
|
||||
#include "qemu-queue.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu-x509.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qint.h"
|
||||
#include "qbool.h"
|
||||
#include "qstring.h"
|
||||
#include "qjson.h"
|
||||
#include "notify.h"
|
||||
#include "migration.h"
|
||||
#include "monitor.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "migration/migration.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "hw/hw.h"
|
||||
#include "spice-display.h"
|
||||
#include "ui/spice-display.h"
|
||||
|
||||
/* core bits */
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-spice.h"
|
||||
#include "qemu-timer.h"
|
||||
#include "qemu-queue.h"
|
||||
#include "monitor.h"
|
||||
#include "console.h"
|
||||
#include "sysemu.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "ui/console.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include "spice-display.h"
|
||||
#include "ui/spice-display.h"
|
||||
|
||||
static int debug = 0;
|
||||
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <spice/ipc_ring.h>
|
||||
#include <spice/enums.h>
|
||||
#include <spice/qxl_dev.h>
|
||||
|
||||
#include "qemu-thread.h"
|
||||
#include "qemu-pixman.h"
|
||||
#include "sysemu.h"
|
||||
|
||||
#define NUM_MEMSLOTS 8
|
||||
#define MEMSLOT_GENERATION_BITS 8
|
||||
#define MEMSLOT_SLOT_BITS 8
|
||||
|
||||
#define MEMSLOT_GROUP_HOST 0
|
||||
#define MEMSLOT_GROUP_GUEST 1
|
||||
#define NUM_MEMSLOTS_GROUPS 2
|
||||
|
||||
/*
|
||||
* Internal enum to differenciate between options for
|
||||
* io calls that have a sync (old) version and an _async (new)
|
||||
* version:
|
||||
* QXL_SYNC: use the old version
|
||||
* QXL_ASYNC: use the new version and make sure there are no two
|
||||
* happening at the same time. This is used for guest initiated
|
||||
* calls
|
||||
*/
|
||||
typedef enum qxl_async_io {
|
||||
QXL_SYNC,
|
||||
QXL_ASYNC,
|
||||
} qxl_async_io;
|
||||
|
||||
enum {
|
||||
QXL_COOKIE_TYPE_IO,
|
||||
QXL_COOKIE_TYPE_RENDER_UPDATE_AREA,
|
||||
QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
|
||||
};
|
||||
|
||||
typedef struct QXLCookie {
|
||||
int type;
|
||||
uint64_t io;
|
||||
union {
|
||||
uint32_t surface_id;
|
||||
QXLRect area;
|
||||
struct {
|
||||
QXLRect area;
|
||||
int redraw;
|
||||
} render;
|
||||
} u;
|
||||
} QXLCookie;
|
||||
|
||||
QXLCookie *qxl_cookie_new(int type, uint64_t io);
|
||||
|
||||
typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
|
||||
typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
|
||||
|
||||
struct SimpleSpiceDisplay {
|
||||
DisplayState *ds;
|
||||
void *buf;
|
||||
int bufsize;
|
||||
QXLWorker *worker;
|
||||
QXLInstance qxl;
|
||||
uint32_t unique;
|
||||
pixman_image_t *surface;
|
||||
pixman_image_t *mirror;
|
||||
int32_t num_surfaces;
|
||||
|
||||
QXLRect dirty;
|
||||
int notify;
|
||||
|
||||
/*
|
||||
* All struct members below this comment can be accessed from
|
||||
* both spice server and qemu (iothread) context and any access
|
||||
* to them must be protected by the lock.
|
||||
*/
|
||||
QemuMutex lock;
|
||||
QTAILQ_HEAD(, SimpleSpiceUpdate) updates;
|
||||
QEMUCursor *cursor;
|
||||
int mouse_x, mouse_y;
|
||||
};
|
||||
|
||||
struct SimpleSpiceUpdate {
|
||||
QXLDrawable drawable;
|
||||
QXLImage image;
|
||||
QXLCommandExt ext;
|
||||
uint8_t *bitmap;
|
||||
QTAILQ_ENTRY(SimpleSpiceUpdate) next;
|
||||
};
|
||||
|
||||
int qemu_spice_rect_is_empty(const QXLRect* r);
|
||||
void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
|
||||
|
||||
void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate *update);
|
||||
void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_vm_change_state_handler(void *opaque, int running,
|
||||
RunState state);
|
||||
void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds);
|
||||
|
||||
void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
|
||||
int x, int y, int w, int h);
|
||||
void qemu_spice_display_resize(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_cursor_refresh_unlocked(SimpleSpiceDisplay *ssd);
|
||||
|
||||
void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot,
|
||||
qxl_async_io async);
|
||||
void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid,
|
||||
uint32_t sid);
|
||||
void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id,
|
||||
QXLDevSurfaceCreate *surface,
|
||||
qxl_async_io async);
|
||||
void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd,
|
||||
uint32_t id, qxl_async_io async);
|
||||
void qemu_spice_wakeup(SimpleSpiceDisplay *ssd);
|
||||
void qemu_spice_display_start(void);
|
||||
void qemu_spice_display_stop(void);
|
||||
int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd);
|
|
@ -24,8 +24,8 @@
|
|||
#include <spice/enums.h>
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-spice.h"
|
||||
#include "console.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
#include "ui/console.h"
|
||||
|
||||
/* keyboard bits */
|
||||
|
||||
|
|
4611
ui/vgafont.h
Normal file
4611
ui/vgafont.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@
|
|||
typedef struct VncStateSASL VncStateSASL;
|
||||
typedef struct VncDisplaySASL VncDisplaySASL;
|
||||
|
||||
#include "acl.h"
|
||||
#include "qemu/acl.h"
|
||||
|
||||
struct VncStateSASL {
|
||||
sasl_conn_t *conn;
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
#include <jpeglib.h>
|
||||
#endif
|
||||
|
||||
#include "bswap.h"
|
||||
#include "qint.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "vnc.h"
|
||||
#include "vnc-enc-tight.h"
|
||||
#include "vnc-palette.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "vnc.h"
|
||||
#include "vnc-jobs.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "qemu/sockets.h"
|
||||
|
||||
/*
|
||||
* Locking:
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#ifndef VNC_PALETTE_H
|
||||
#define VNC_PALETTE_H
|
||||
|
||||
#include "qlist.h"
|
||||
#include "qemu-queue.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qemu/queue.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "qemu-x509.h"
|
||||
#include "vnc.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "qemu/sockets.h"
|
||||
|
||||
#if defined(_VNC_DEBUG) && _VNC_DEBUG >= 2
|
||||
/* Very verbose, so only enabled for _VNC_DEBUG >= 2 */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
#include "acl.h"
|
||||
#include "qemu/acl.h"
|
||||
|
||||
enum {
|
||||
VNC_WIREMODE_CLEAR,
|
||||
|
|
12
ui/vnc.c
12
ui/vnc.c
|
@ -26,13 +26,13 @@
|
|||
|
||||
#include "vnc.h"
|
||||
#include "vnc-jobs.h"
|
||||
#include "sysemu.h"
|
||||
#include "qemu_socket.h"
|
||||
#include "qemu-timer.h"
|
||||
#include "acl.h"
|
||||
#include "qemu-objects.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/acl.h"
|
||||
#include "qapi/qmp/types.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "osdep.h"
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#define VNC_REFRESH_INTERVAL_BASE 30
|
||||
#define VNC_REFRESH_INTERVAL_INC 50
|
||||
|
|
10
ui/vnc.h
10
ui/vnc.h
|
@ -28,12 +28,12 @@
|
|||
#define __QEMU_VNC_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu-queue.h"
|
||||
#include "qemu-thread.h"
|
||||
#include "console.h"
|
||||
#include "monitor.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "ui/console.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "audio/audio.h"
|
||||
#include "bitmap.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include <zlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue