ui: reorganize and cleanup display command line parsing.
gtk: fix gtk3 warnings. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJajCbNAAoJEEy22O7T6HE4WQoQALwyAeX1+NhPqaMeGrNESiwi HKoMx2dgxskC6J6VyVA4XGANKiTXFmsKQxNFiU4F9EqVH9JhP7J6IehgYl8U4Jqg U2+nXFu/e0si1M6XBe08MbqM7WDMRpiviyI93oHkd3X1b/jWDCVf3M8MJCc5Lqnq HhAiVLu0K+PjaxsAdsCCoBAwZGgfCeiEcDFUR3utJSGHX0Eda3SMdDhtz695C2M7 i8wQd58Soe/9hC7C7eTdkIt+XY8aogxVLCJS5S1IaeLxjs8QvnC+l0g4BSGViXaF sLsXVbA1LXxTZ/kr/Viox+1suDg9GP1Sota7Jss0Gdkriiv0+KQ6jhpFIi1P6zoq 8wR9kMjFlwjKnVn1oCzbp4Y7YvmKI2gaWzVNRU8rHMUl9hIKquM4Ueqiu9UPTgSA fOzdb3PlH/pc5N0KnhrLlfwaclFzUZ2vQctPgycYROirraVH9AaJvoUJOA/CcEJt D6ffQyr9PQMHHBeT7/u7s+G3AWx7nX291pafQNwnWWZ8Dc7fhQVInIMJHR5U2xHM k5DRckFdp73awfrbv43n/nFmDH3/EGLl1E/SXVJLUE41SRCkkJpytdaatZFB4kOL AM8WoIM4QvuaM8mf0T1xHVq7YMHzI76eo5EwSQsRKn1BvI7ToGR4D/nd86iR3SEY h+1KTsrwy5LTXZEjUjdR =KFKI -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180220-pull-request' into staging ui: reorganize and cleanup display command line parsing. gtk: fix gtk3 warnings. # gpg: Signature made Tue 20 Feb 2018 13:46:53 GMT # gpg: using RSA key 4CB6D8EED3E87138 # 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>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20180220-pull-request: ui: Reorder vte terminal packing to avoid gtk3 warnings vl: drop display_type variable vl: drop request_opengl variable vl: drop full_screen variable cocoa: use DisplayOptions curses: use DisplayOptions egl-headless: use DisplayOptions vl: drop no_quit variable sdl: use DisplayOptions gtk: add and use DisplayOptions + DisplayGTK vl: rename DisplayType to LegacyDisplayType vl: deprecate -no-frame Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
a6e0344fa0
|
@ -431,16 +431,16 @@ void surface_gl_setup_viewport(QemuGLShader *gls,
|
||||||
|
|
||||||
/* sdl.c */
|
/* sdl.c */
|
||||||
#ifdef CONFIG_SDL
|
#ifdef CONFIG_SDL
|
||||||
void sdl_display_early_init(int opengl);
|
void sdl_display_early_init(DisplayOptions *opts);
|
||||||
void sdl_display_init(DisplayState *ds, int full_screen);
|
void sdl_display_init(DisplayState *ds, DisplayOptions *opts);
|
||||||
#else
|
#else
|
||||||
static inline void sdl_display_early_init(int opengl)
|
static inline void sdl_display_early_init(DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_SDL is disabled */
|
/* This must never be called if CONFIG_SDL is disabled */
|
||||||
error_report("SDL support is disabled");
|
error_report("SDL support is disabled");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
static inline void sdl_display_init(DisplayState *ds, int full_screen)
|
static inline void sdl_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_SDL is disabled */
|
/* This must never be called if CONFIG_SDL is disabled */
|
||||||
error_report("SDL support is disabled");
|
error_report("SDL support is disabled");
|
||||||
|
@ -450,9 +450,9 @@ static inline void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
|
|
||||||
/* cocoa.m */
|
/* cocoa.m */
|
||||||
#ifdef CONFIG_COCOA
|
#ifdef CONFIG_COCOA
|
||||||
void cocoa_display_init(DisplayState *ds, int full_screen);
|
void cocoa_display_init(DisplayState *ds, DisplayOptions *opts);
|
||||||
#else
|
#else
|
||||||
static inline void cocoa_display_init(DisplayState *ds, int full_screen)
|
static inline void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_COCOA is disabled */
|
/* This must never be called if CONFIG_COCOA is disabled */
|
||||||
error_report("Cocoa support is disabled");
|
error_report("Cocoa support is disabled");
|
||||||
|
@ -471,9 +471,9 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp);
|
||||||
|
|
||||||
/* curses.c */
|
/* curses.c */
|
||||||
#ifdef CONFIG_CURSES
|
#ifdef CONFIG_CURSES
|
||||||
void curses_display_init(DisplayState *ds, int full_screen);
|
void curses_display_init(DisplayState *ds, DisplayOptions *opts);
|
||||||
#else
|
#else
|
||||||
static inline void curses_display_init(DisplayState *ds, int full_screen)
|
static inline void curses_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_CURSES is disabled */
|
/* This must never be called if CONFIG_CURSES is disabled */
|
||||||
error_report("curses support is disabled");
|
error_report("curses support is disabled");
|
||||||
|
@ -486,18 +486,17 @@ int index_from_key(const char *key, size_t key_length);
|
||||||
|
|
||||||
/* gtk.c */
|
/* gtk.c */
|
||||||
#ifdef CONFIG_GTK
|
#ifdef CONFIG_GTK
|
||||||
void early_gtk_display_init(int opengl);
|
void early_gtk_display_init(DisplayOptions *opts);
|
||||||
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
|
void gtk_display_init(DisplayState *ds, DisplayOptions *opts);
|
||||||
#else
|
#else
|
||||||
static inline void gtk_display_init(DisplayState *ds, bool full_screen,
|
static inline void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
bool grab_on_hover)
|
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_GTK is disabled */
|
/* This must never be called if CONFIG_GTK is disabled */
|
||||||
error_report("GTK support is disabled");
|
error_report("GTK support is disabled");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void early_gtk_display_init(int opengl)
|
static inline void early_gtk_display_init(DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* This must never be called if CONFIG_GTK is disabled */
|
/* This must never be called if CONFIG_GTK is disabled */
|
||||||
error_report("GTK support is disabled");
|
error_report("GTK support is disabled");
|
||||||
|
@ -506,6 +505,6 @@ static inline void early_gtk_display_init(int opengl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* egl-headless.c */
|
/* egl-headless.c */
|
||||||
void egl_headless_init(void);
|
void egl_headless_init(DisplayOptions *opts);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
64
qapi/ui.json
64
qapi/ui.json
|
@ -985,3 +985,67 @@
|
||||||
'data': { '*device': 'str',
|
'data': { '*device': 'str',
|
||||||
'*head' : 'int',
|
'*head' : 'int',
|
||||||
'events' : [ 'InputEvent' ] } }
|
'events' : [ 'InputEvent' ] } }
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# @DisplayNoOpts:
|
||||||
|
#
|
||||||
|
# Empty struct for displays without config options.
|
||||||
|
#
|
||||||
|
# Since: 2.12
|
||||||
|
#
|
||||||
|
##
|
||||||
|
{ 'struct' : 'DisplayNoOpts',
|
||||||
|
'data' : { } }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @DisplayGTK:
|
||||||
|
#
|
||||||
|
# GTK display options.
|
||||||
|
#
|
||||||
|
# @grab-on-hover: Grab keyboard input on mouse hover.
|
||||||
|
#
|
||||||
|
# Since: 2.12
|
||||||
|
#
|
||||||
|
##
|
||||||
|
{ 'struct' : 'DisplayGTK',
|
||||||
|
'data' : { '*grab-on-hover' : 'bool' } }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @DisplayType:
|
||||||
|
#
|
||||||
|
# Display (user interface) type.
|
||||||
|
#
|
||||||
|
# Since: 2.12
|
||||||
|
#
|
||||||
|
##
|
||||||
|
{ 'enum' : 'DisplayType',
|
||||||
|
'data' : [ 'default', 'none', 'gtk', 'sdl',
|
||||||
|
'egl-headless', 'curses', 'cocoa' ] }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @DisplayOptions:
|
||||||
|
#
|
||||||
|
# Display (user interface) options.
|
||||||
|
#
|
||||||
|
# @type: Which DisplayType qemu should use.
|
||||||
|
# @full-screen: Start user interface in fullscreen mode (default: off).
|
||||||
|
# @window-close: Allow to quit qemu with window close button (default: on).
|
||||||
|
# @gl: Enable OpenGL support (default: off).
|
||||||
|
#
|
||||||
|
# Since: 2.12
|
||||||
|
#
|
||||||
|
##
|
||||||
|
{ 'union' : 'DisplayOptions',
|
||||||
|
'base' : { 'type' : 'DisplayType',
|
||||||
|
'*full-screen' : 'bool',
|
||||||
|
'*window-close' : 'bool',
|
||||||
|
'*gl' : 'bool' },
|
||||||
|
'discriminator' : 'type',
|
||||||
|
'data' : { 'default' : 'DisplayNoOpts',
|
||||||
|
'none' : 'DisplayNoOpts',
|
||||||
|
'gtk' : 'DisplayGTK',
|
||||||
|
'sdl' : 'DisplayNoOpts',
|
||||||
|
'egl-headless' : 'DisplayNoOpts',
|
||||||
|
'curses' : 'DisplayNoOpts',
|
||||||
|
'cocoa' : 'DisplayNoOpts' } }
|
||||||
|
|
|
@ -2741,6 +2741,13 @@ filesystem test suite. Also it requires the CAP_DAC_READ_SEARCH capability,
|
||||||
which is not the recommended way to run QEMU. This backend should not be
|
which is not the recommended way to run QEMU. This backend should not be
|
||||||
used and it will be removed with no replacement.
|
used and it will be removed with no replacement.
|
||||||
|
|
||||||
|
@subsection -no-frame (since 2.12.0)
|
||||||
|
|
||||||
|
The ``-no-frame'' argument works with SDL 1.2 only. SDL 2.0 lacks
|
||||||
|
support for frameless windows, and the other user interfaces never
|
||||||
|
implemented this in the first place. So this will be removed together
|
||||||
|
with SDL 1.2 support.
|
||||||
|
|
||||||
@section qemu-img command line arguments
|
@section qemu-img command line arguments
|
||||||
|
|
||||||
@subsection convert -s (since 2.0.0)
|
@subsection convert -s (since 2.0.0)
|
||||||
|
|
|
@ -1683,12 +1683,12 @@ static void addRemovableDevicesMenuItems(void)
|
||||||
qapi_free_BlockInfoList(pointerToFree);
|
qapi_free_BlockInfoList(pointerToFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cocoa_display_init(DisplayState *ds, int full_screen)
|
void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
|
COCOA_DEBUG("qemu_cocoa: cocoa_display_init\n");
|
||||||
|
|
||||||
/* if fullscreen mode is to be used */
|
/* if fullscreen mode is to be used */
|
||||||
if (full_screen == true) {
|
if (opts->has_full_screen && opts->full_screen) {
|
||||||
[NSApp activateIgnoringOtherApps: YES];
|
[NSApp activateIgnoringOtherApps: YES];
|
||||||
[(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
|
[(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,7 +434,7 @@ static const DisplayChangeListenerOps dcl_ops = {
|
||||||
.dpy_text_cursor = curses_cursor_position,
|
.dpy_text_cursor = curses_cursor_position,
|
||||||
};
|
};
|
||||||
|
|
||||||
void curses_display_init(DisplayState *ds, int full_screen)
|
void curses_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
|
|
|
@ -154,7 +154,7 @@ static const DisplayChangeListenerOps egl_ops = {
|
||||||
.dpy_gl_update = egl_scanout_flush,
|
.dpy_gl_update = egl_scanout_flush,
|
||||||
};
|
};
|
||||||
|
|
||||||
void egl_headless_init(void)
|
void egl_headless_init(DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
QemuConsole *con;
|
QemuConsole *con;
|
||||||
egl_dpy *edpy;
|
egl_dpy *edpy;
|
||||||
|
|
36
ui/gtk.c
36
ui/gtk.c
|
@ -230,6 +230,8 @@ struct GtkDisplayState {
|
||||||
|
|
||||||
bool modifier_pressed[ARRAY_SIZE(modifier_keycode)];
|
bool modifier_pressed[ARRAY_SIZE(modifier_keycode)];
|
||||||
bool ignore_keys;
|
bool ignore_keys;
|
||||||
|
|
||||||
|
DisplayOptions *opts;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct VCChardev {
|
typedef struct VCChardev {
|
||||||
|
@ -778,9 +780,14 @@ static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
GtkDisplayState *s = opaque;
|
GtkDisplayState *s = opaque;
|
||||||
|
bool allow_close = true;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!no_quit) {
|
if (s->opts->has_window_close && !s->opts->window_close) {
|
||||||
|
allow_close = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allow_close) {
|
||||||
for (i = 0; i < s->nb_vcs; i++) {
|
for (i = 0; i < s->nb_vcs; i++) {
|
||||||
if (s->vc[i].type != GD_VC_GFX) {
|
if (s->vc[i].type != GD_VC_GFX) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1945,8 +1952,8 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
scrollbar = gtk_vscrollbar_new(vadjustment);
|
scrollbar = gtk_vscrollbar_new(vadjustment);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(box), vc->vte.terminal, TRUE, TRUE, 0);
|
gtk_box_pack_end(GTK_BOX(box), scrollbar, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(box), scrollbar, FALSE, FALSE, 0);
|
gtk_box_pack_end(GTK_BOX(box), vc->vte.terminal, TRUE, TRUE, 0);
|
||||||
|
|
||||||
vc->vte.box = box;
|
vc->vte.box = box;
|
||||||
vc->vte.scrollbar = scrollbar;
|
vc->vte.scrollbar = scrollbar;
|
||||||
|
@ -2290,7 +2297,7 @@ static void gd_create_menus(GtkDisplayState *s)
|
||||||
|
|
||||||
static gboolean gtkinit;
|
static gboolean gtkinit;
|
||||||
|
|
||||||
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
|
void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
VirtualConsole *vc;
|
VirtualConsole *vc;
|
||||||
|
|
||||||
|
@ -2302,6 +2309,8 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
|
||||||
fprintf(stderr, "gtk initialization failed\n");
|
fprintf(stderr, "gtk initialization failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
assert(opts->type == DISPLAY_TYPE_GTK);
|
||||||
|
s->opts = opts;
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||||
g_printerr("Running QEMU with GTK 2.x is deprecated, and will be removed\n"
|
g_printerr("Running QEMU with GTK 2.x is deprecated, and will be removed\n"
|
||||||
|
@ -2388,15 +2397,17 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
|
||||||
vc && vc->type == GD_VC_VTE);
|
vc && vc->type == GD_VC_VTE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (full_screen) {
|
if (opts->has_full_screen &&
|
||||||
|
opts->full_screen) {
|
||||||
gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
|
gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
|
||||||
}
|
}
|
||||||
if (grab_on_hover) {
|
if (opts->u.gtk.has_grab_on_hover &&
|
||||||
|
opts->u.gtk.grab_on_hover) {
|
||||||
gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
|
gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void early_gtk_display_init(int opengl)
|
void early_gtk_display_init(DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
/* The QEMU code relies on the assumption that it's always run in
|
/* The QEMU code relies on the assumption that it's always run in
|
||||||
* the C locale. Therefore it is not prepared to deal with
|
* the C locale. Therefore it is not prepared to deal with
|
||||||
|
@ -2422,11 +2433,8 @@ void early_gtk_display_init(int opengl)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opengl) {
|
assert(opts->type == DISPLAY_TYPE_GTK);
|
||||||
case -1: /* default */
|
if (opts->has_gl && opts->gl) {
|
||||||
case 0: /* off */
|
|
||||||
break;
|
|
||||||
case 1: /* on */
|
|
||||||
#if defined(CONFIG_OPENGL)
|
#if defined(CONFIG_OPENGL)
|
||||||
#if defined(CONFIG_GTK_GL)
|
#if defined(CONFIG_GTK_GL)
|
||||||
gtk_gl_area_init();
|
gtk_gl_area_init();
|
||||||
|
@ -2434,10 +2442,6 @@ void early_gtk_display_init(int opengl)
|
||||||
gtk_egl_init();
|
gtk_egl_init();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
keycode_map = gd_get_keymap(&keycode_maplen);
|
keycode_map = gd_get_keymap(&keycode_maplen);
|
||||||
|
|
19
ui/sdl.c
19
ui/sdl.c
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
static DisplayChangeListener *dcl;
|
static DisplayChangeListener *dcl;
|
||||||
static DisplaySurface *surface;
|
static DisplaySurface *surface;
|
||||||
|
static DisplayOptions *opts;
|
||||||
static SDL_Surface *real_screen;
|
static SDL_Surface *real_screen;
|
||||||
static SDL_Surface *guest_screen = NULL;
|
static SDL_Surface *guest_screen = NULL;
|
||||||
static int gui_grab; /* if true, all keyboard/mouse events are grabbed */
|
static int gui_grab; /* if true, all keyboard/mouse events are grabbed */
|
||||||
|
@ -769,6 +770,7 @@ static void handle_activation(SDL_Event *ev)
|
||||||
static void sdl_refresh(DisplayChangeListener *dcl)
|
static void sdl_refresh(DisplayChangeListener *dcl)
|
||||||
{
|
{
|
||||||
SDL_Event ev1, *ev = &ev1;
|
SDL_Event ev1, *ev = &ev1;
|
||||||
|
bool allow_close = true;
|
||||||
int idle = 1;
|
int idle = 1;
|
||||||
|
|
||||||
if (last_vm_running != runstate_is_running()) {
|
if (last_vm_running != runstate_is_running()) {
|
||||||
|
@ -793,7 +795,10 @@ static void sdl_refresh(DisplayChangeListener *dcl)
|
||||||
handle_keyup(ev);
|
handle_keyup(ev);
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
if (!no_quit) {
|
if (opts->has_window_close && !opts->window_close) {
|
||||||
|
allow_close = false;
|
||||||
|
}
|
||||||
|
if (allow_close) {
|
||||||
no_shutdown = 0;
|
no_shutdown = 0;
|
||||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
||||||
}
|
}
|
||||||
|
@ -892,9 +897,9 @@ static const DisplayChangeListenerOps dcl_ops = {
|
||||||
.dpy_cursor_define = sdl_mouse_define,
|
.dpy_cursor_define = sdl_mouse_define,
|
||||||
};
|
};
|
||||||
|
|
||||||
void sdl_display_early_init(int opengl)
|
void sdl_display_early_init(DisplayOptions *opts)
|
||||||
{
|
{
|
||||||
if (opengl == 1 /* on */) {
|
if (opts->has_gl && opts->gl) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"SDL1 display code has no opengl support.\n"
|
"SDL1 display code has no opengl support.\n"
|
||||||
"Please recompile qemu with SDL2, using\n"
|
"Please recompile qemu with SDL2, using\n"
|
||||||
|
@ -902,7 +907,7 @@ void sdl_display_early_init(int opengl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdl_display_init(DisplayState *ds, int full_screen)
|
void sdl_display_init(DisplayState *ds, DisplayOptions *o)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
|
@ -910,6 +915,8 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
SDL_SysWMinfo info;
|
SDL_SysWMinfo info;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
assert(o->type == DISPLAY_TYPE_SDL);
|
||||||
|
opts = o;
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
/* always use generic keymaps */
|
/* always use generic keymaps */
|
||||||
if (!keyboard_layout)
|
if (!keyboard_layout)
|
||||||
|
@ -924,7 +931,7 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
g_printerr("Running QEMU with SDL 1.2 is deprecated, and will be removed\n"
|
g_printerr("Running QEMU with SDL 1.2 is deprecated, and will be removed\n"
|
||||||
"in a future release. Please switch to SDL 2.0 instead\n");
|
"in a future release. Please switch to SDL 2.0 instead\n");
|
||||||
|
|
||||||
if (!full_screen) {
|
if (opts->has_full_screen && opts->full_screen) {
|
||||||
setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
|
setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);
|
||||||
}
|
}
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -967,7 +974,7 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (full_screen) {
|
if (opts->has_full_screen && opts->full_screen) {
|
||||||
gui_fullscreen = 1;
|
gui_fullscreen = 1;
|
||||||
sdl_grab_start();
|
sdl_grab_start();
|
||||||
}
|
}
|
||||||
|
|
33
ui/sdl2.c
33
ui/sdl2.c
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
static int sdl2_num_outputs;
|
static int sdl2_num_outputs;
|
||||||
static struct sdl2_console *sdl2_console;
|
static struct sdl2_console *sdl2_console;
|
||||||
|
static DisplayOptions *opts;
|
||||||
|
|
||||||
static SDL_Surface *guest_sprite_surface;
|
static SDL_Surface *guest_sprite_surface;
|
||||||
static int gui_grab; /* if true, all keyboard/mouse events are grabbed */
|
static int gui_grab; /* if true, all keyboard/mouse events are grabbed */
|
||||||
|
@ -526,6 +527,7 @@ static void handle_mousewheel(SDL_Event *ev)
|
||||||
static void handle_windowevent(SDL_Event *ev)
|
static void handle_windowevent(SDL_Event *ev)
|
||||||
{
|
{
|
||||||
struct sdl2_console *scon = get_scon_from_window(ev->window.windowID);
|
struct sdl2_console *scon = get_scon_from_window(ev->window.windowID);
|
||||||
|
bool allow_close = true;
|
||||||
|
|
||||||
if (!scon) {
|
if (!scon) {
|
||||||
return;
|
return;
|
||||||
|
@ -572,7 +574,10 @@ static void handle_windowevent(SDL_Event *ev)
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_WINDOWEVENT_CLOSE:
|
||||||
if (qemu_console_is_graphic(scon->dcl.con)) {
|
if (qemu_console_is_graphic(scon->dcl.con)) {
|
||||||
if (!no_quit) {
|
if (opts->has_window_close && !opts->window_close) {
|
||||||
|
allow_close = false;
|
||||||
|
}
|
||||||
|
if (allow_close) {
|
||||||
no_shutdown = 0;
|
no_shutdown = 0;
|
||||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
||||||
}
|
}
|
||||||
|
@ -593,6 +598,7 @@ static void handle_windowevent(SDL_Event *ev)
|
||||||
void sdl2_poll_events(struct sdl2_console *scon)
|
void sdl2_poll_events(struct sdl2_console *scon)
|
||||||
{
|
{
|
||||||
SDL_Event ev1, *ev = &ev1;
|
SDL_Event ev1, *ev = &ev1;
|
||||||
|
bool allow_close = true;
|
||||||
int idle = 1;
|
int idle = 1;
|
||||||
|
|
||||||
if (scon->last_vm_running != runstate_is_running()) {
|
if (scon->last_vm_running != runstate_is_running()) {
|
||||||
|
@ -615,7 +621,10 @@ void sdl2_poll_events(struct sdl2_console *scon)
|
||||||
handle_textinput(ev);
|
handle_textinput(ev);
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
if (!no_quit) {
|
if (opts->has_window_close && !opts->window_close) {
|
||||||
|
allow_close = false;
|
||||||
|
}
|
||||||
|
if (allow_close) {
|
||||||
no_shutdown = 0;
|
no_shutdown = 0;
|
||||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
||||||
}
|
}
|
||||||
|
@ -750,24 +759,17 @@ static const DisplayChangeListenerOps dcl_gl_ops = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void sdl_display_early_init(int opengl)
|
void sdl_display_early_init(DisplayOptions *o)
|
||||||
{
|
{
|
||||||
switch (opengl) {
|
assert(o->type == DISPLAY_TYPE_SDL);
|
||||||
case -1: /* default */
|
if (o->has_gl && o->gl) {
|
||||||
case 0: /* off */
|
|
||||||
break;
|
|
||||||
case 1: /* on */
|
|
||||||
#ifdef CONFIG_OPENGL
|
#ifdef CONFIG_OPENGL
|
||||||
display_opengl = 1;
|
display_opengl = 1;
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdl_display_init(DisplayState *ds, int full_screen)
|
void sdl_display_init(DisplayState *ds, DisplayOptions *o)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
|
@ -775,6 +777,9 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
int i;
|
int i;
|
||||||
SDL_SysWMinfo info;
|
SDL_SysWMinfo info;
|
||||||
|
|
||||||
|
assert(o->type == DISPLAY_TYPE_SDL);
|
||||||
|
opts = o;
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
/* on Linux, SDL may use fbcon|directfb|svgalib when run without
|
/* on Linux, SDL may use fbcon|directfb|svgalib when run without
|
||||||
* accessible $DISPLAY to open X11 window. This is often the case
|
* accessible $DISPLAY to open X11 window. This is often the case
|
||||||
|
@ -849,7 +854,7 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
||||||
g_free(filename);
|
g_free(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (full_screen) {
|
if (opts->has_full_screen && opts->full_screen) {
|
||||||
gui_fullscreen = 1;
|
gui_fullscreen = 1;
|
||||||
sdl_grab_start(0);
|
sdl_grab_start(0);
|
||||||
}
|
}
|
||||||
|
|
119
vl.c
119
vl.c
|
@ -136,7 +136,6 @@ static const char *data_dir[16];
|
||||||
static int data_dir_idx;
|
static int data_dir_idx;
|
||||||
const char *bios_name = NULL;
|
const char *bios_name = NULL;
|
||||||
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
|
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
|
||||||
int request_opengl = -1;
|
|
||||||
int display_opengl;
|
int display_opengl;
|
||||||
const char* keyboard_layout = NULL;
|
const char* keyboard_layout = NULL;
|
||||||
ram_addr_t ram_size;
|
ram_addr_t ram_size;
|
||||||
|
@ -150,10 +149,8 @@ static int rtc_utc = 1;
|
||||||
static int rtc_date_offset = -1; /* -1 means no change */
|
static int rtc_date_offset = -1; /* -1 means no change */
|
||||||
QEMUClockType rtc_clock;
|
QEMUClockType rtc_clock;
|
||||||
int vga_interface_type = VGA_NONE;
|
int vga_interface_type = VGA_NONE;
|
||||||
static int full_screen = 0;
|
static DisplayOptions dpy;
|
||||||
int no_frame;
|
int no_frame;
|
||||||
int no_quit = 0;
|
|
||||||
static bool grab_on_hover;
|
|
||||||
Chardev *serial_hds[MAX_SERIAL_PORTS];
|
Chardev *serial_hds[MAX_SERIAL_PORTS];
|
||||||
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
|
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
|
||||||
Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES];
|
Chardev *virtcon_hds[MAX_VIRTIO_CONSOLES];
|
||||||
|
@ -2083,28 +2080,19 @@ static void select_vgahw(const char *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum DisplayType {
|
static void parse_display(const char *p)
|
||||||
DT_DEFAULT,
|
|
||||||
DT_CURSES,
|
|
||||||
DT_SDL,
|
|
||||||
DT_COCOA,
|
|
||||||
DT_GTK,
|
|
||||||
DT_EGL,
|
|
||||||
DT_NONE,
|
|
||||||
} DisplayType;
|
|
||||||
|
|
||||||
static DisplayType select_display(const char *p)
|
|
||||||
{
|
{
|
||||||
const char *opts;
|
const char *opts;
|
||||||
DisplayType display = DT_DEFAULT;
|
|
||||||
|
|
||||||
if (strstart(p, "sdl", &opts)) {
|
if (strstart(p, "sdl", &opts)) {
|
||||||
#ifdef CONFIG_SDL
|
#ifdef CONFIG_SDL
|
||||||
display = DT_SDL;
|
dpy.type = DISPLAY_TYPE_SDL;
|
||||||
while (*opts) {
|
while (*opts) {
|
||||||
const char *nextopt;
|
const char *nextopt;
|
||||||
|
|
||||||
if (strstart(opts, ",frame=", &nextopt)) {
|
if (strstart(opts, ",frame=", &nextopt)) {
|
||||||
|
g_printerr("The frame= sdl option is deprecated, and will be\n"
|
||||||
|
"removed in a future release.\n");
|
||||||
opts = nextopt;
|
opts = nextopt;
|
||||||
if (strstart(opts, "on", &nextopt)) {
|
if (strstart(opts, "on", &nextopt)) {
|
||||||
no_frame = 0;
|
no_frame = 0;
|
||||||
|
@ -2133,19 +2121,21 @@ static DisplayType select_display(const char *p)
|
||||||
}
|
}
|
||||||
} else if (strstart(opts, ",window_close=", &nextopt)) {
|
} else if (strstart(opts, ",window_close=", &nextopt)) {
|
||||||
opts = nextopt;
|
opts = nextopt;
|
||||||
|
dpy.has_window_close = true;
|
||||||
if (strstart(opts, "on", &nextopt)) {
|
if (strstart(opts, "on", &nextopt)) {
|
||||||
no_quit = 0;
|
dpy.window_close = true;
|
||||||
} else if (strstart(opts, "off", &nextopt)) {
|
} else if (strstart(opts, "off", &nextopt)) {
|
||||||
no_quit = 1;
|
dpy.window_close = false;
|
||||||
} else {
|
} else {
|
||||||
goto invalid_sdl_args;
|
goto invalid_sdl_args;
|
||||||
}
|
}
|
||||||
} else if (strstart(opts, ",gl=", &nextopt)) {
|
} else if (strstart(opts, ",gl=", &nextopt)) {
|
||||||
opts = nextopt;
|
opts = nextopt;
|
||||||
|
dpy.has_gl = true;
|
||||||
if (strstart(opts, "on", &nextopt)) {
|
if (strstart(opts, "on", &nextopt)) {
|
||||||
request_opengl = 1;
|
dpy.gl = true;
|
||||||
} else if (strstart(opts, "off", &nextopt)) {
|
} else if (strstart(opts, "off", &nextopt)) {
|
||||||
request_opengl = 0;
|
dpy.gl = false;
|
||||||
} else {
|
} else {
|
||||||
goto invalid_sdl_args;
|
goto invalid_sdl_args;
|
||||||
}
|
}
|
||||||
|
@ -2169,41 +2159,42 @@ static DisplayType select_display(const char *p)
|
||||||
}
|
}
|
||||||
} else if (strstart(p, "egl-headless", &opts)) {
|
} else if (strstart(p, "egl-headless", &opts)) {
|
||||||
#ifdef CONFIG_OPENGL_DMABUF
|
#ifdef CONFIG_OPENGL_DMABUF
|
||||||
request_opengl = 1;
|
|
||||||
display_opengl = 1;
|
display_opengl = 1;
|
||||||
display = DT_EGL;
|
dpy.type = DISPLAY_TYPE_EGL_HEADLESS;
|
||||||
#else
|
#else
|
||||||
error_report("egl support is disabled");
|
error_report("egl support is disabled");
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
} else if (strstart(p, "curses", &opts)) {
|
} else if (strstart(p, "curses", &opts)) {
|
||||||
#ifdef CONFIG_CURSES
|
#ifdef CONFIG_CURSES
|
||||||
display = DT_CURSES;
|
dpy.type = DISPLAY_TYPE_CURSES;
|
||||||
#else
|
#else
|
||||||
error_report("curses support is disabled");
|
error_report("curses support is disabled");
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
} else if (strstart(p, "gtk", &opts)) {
|
} else if (strstart(p, "gtk", &opts)) {
|
||||||
#ifdef CONFIG_GTK
|
#ifdef CONFIG_GTK
|
||||||
display = DT_GTK;
|
dpy.type = DISPLAY_TYPE_GTK;
|
||||||
while (*opts) {
|
while (*opts) {
|
||||||
const char *nextopt;
|
const char *nextopt;
|
||||||
|
|
||||||
if (strstart(opts, ",grab_on_hover=", &nextopt)) {
|
if (strstart(opts, ",grab_on_hover=", &nextopt)) {
|
||||||
opts = nextopt;
|
opts = nextopt;
|
||||||
|
dpy.u.gtk.has_grab_on_hover = true;
|
||||||
if (strstart(opts, "on", &nextopt)) {
|
if (strstart(opts, "on", &nextopt)) {
|
||||||
grab_on_hover = true;
|
dpy.u.gtk.grab_on_hover = true;
|
||||||
} else if (strstart(opts, "off", &nextopt)) {
|
} else if (strstart(opts, "off", &nextopt)) {
|
||||||
grab_on_hover = false;
|
dpy.u.gtk.grab_on_hover = false;
|
||||||
} else {
|
} else {
|
||||||
goto invalid_gtk_args;
|
goto invalid_gtk_args;
|
||||||
}
|
}
|
||||||
} else if (strstart(opts, ",gl=", &nextopt)) {
|
} else if (strstart(opts, ",gl=", &nextopt)) {
|
||||||
opts = nextopt;
|
opts = nextopt;
|
||||||
|
dpy.has_gl = true;
|
||||||
if (strstart(opts, "on", &nextopt)) {
|
if (strstart(opts, "on", &nextopt)) {
|
||||||
request_opengl = 1;
|
dpy.gl = true;
|
||||||
} else if (strstart(opts, "off", &nextopt)) {
|
} else if (strstart(opts, "off", &nextopt)) {
|
||||||
request_opengl = 0;
|
dpy.gl = false;
|
||||||
} else {
|
} else {
|
||||||
goto invalid_gtk_args;
|
goto invalid_gtk_args;
|
||||||
}
|
}
|
||||||
|
@ -2219,13 +2210,11 @@ static DisplayType select_display(const char *p)
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
} else if (strstart(p, "none", &opts)) {
|
} else if (strstart(p, "none", &opts)) {
|
||||||
display = DT_NONE;
|
dpy.type = DISPLAY_TYPE_NONE;
|
||||||
} else {
|
} else {
|
||||||
error_report("unknown display type");
|
error_report("unknown display type");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return display;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int balloon_parse(const char *arg)
|
static int balloon_parse(const char *arg)
|
||||||
|
@ -3049,7 +3038,6 @@ int main(int argc, char **argv, char **envp)
|
||||||
const char *incoming = NULL;
|
const char *incoming = NULL;
|
||||||
bool userconfig = true;
|
bool userconfig = true;
|
||||||
bool nographic = false;
|
bool nographic = false;
|
||||||
DisplayType display_type = DT_DEFAULT;
|
|
||||||
int display_remote = 0;
|
int display_remote = 0;
|
||||||
const char *log_mask = NULL;
|
const char *log_mask = NULL;
|
||||||
const char *log_file = NULL;
|
const char *log_file = NULL;
|
||||||
|
@ -3243,17 +3231,17 @@ int main(int argc, char **argv, char **envp)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_display:
|
case QEMU_OPTION_display:
|
||||||
display_type = select_display(optarg);
|
parse_display(optarg);
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_nographic:
|
case QEMU_OPTION_nographic:
|
||||||
olist = qemu_find_opts("machine");
|
olist = qemu_find_opts("machine");
|
||||||
qemu_opts_parse_noisily(olist, "graphics=off", false);
|
qemu_opts_parse_noisily(olist, "graphics=off", false);
|
||||||
nographic = true;
|
nographic = true;
|
||||||
display_type = DT_NONE;
|
dpy.type = DISPLAY_TYPE_NONE;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_curses:
|
case QEMU_OPTION_curses:
|
||||||
#ifdef CONFIG_CURSES
|
#ifdef CONFIG_CURSES
|
||||||
display_type = DT_CURSES;
|
dpy.type = DISPLAY_TYPE_CURSES;
|
||||||
#else
|
#else
|
||||||
error_report("curses support is disabled");
|
error_report("curses support is disabled");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -3636,9 +3624,12 @@ int main(int argc, char **argv, char **envp)
|
||||||
loadvm = optarg;
|
loadvm = optarg;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_full_screen:
|
case QEMU_OPTION_full_screen:
|
||||||
full_screen = 1;
|
dpy.has_full_screen = true;
|
||||||
|
dpy.full_screen = true;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_no_frame:
|
case QEMU_OPTION_no_frame:
|
||||||
|
g_printerr("The -no-frame switch is deprecated, and will be\n"
|
||||||
|
"removed in a future release.\n");
|
||||||
no_frame = 1;
|
no_frame = 1;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_alt_grab:
|
case QEMU_OPTION_alt_grab:
|
||||||
|
@ -3648,11 +3639,12 @@ int main(int argc, char **argv, char **envp)
|
||||||
ctrl_grab = 1;
|
ctrl_grab = 1;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_no_quit:
|
case QEMU_OPTION_no_quit:
|
||||||
no_quit = 1;
|
dpy.has_window_close = true;
|
||||||
|
dpy.window_close = false;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_sdl:
|
case QEMU_OPTION_sdl:
|
||||||
#ifdef CONFIG_SDL
|
#ifdef CONFIG_SDL
|
||||||
display_type = DT_SDL;
|
dpy.type = DISPLAY_TYPE_SDL;
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
error_report("SDL support is disabled");
|
error_report("SDL support is disabled");
|
||||||
|
@ -4267,7 +4259,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_CURSES
|
#ifdef CONFIG_CURSES
|
||||||
if (display_type == DT_CURSES) {
|
if (dpy.type == DISPLAY_TYPE_CURSES) {
|
||||||
error_report("curses display cannot be used with -daemonize");
|
error_report("curses display cannot be used with -daemonize");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -4313,40 +4305,41 @@ int main(int argc, char **argv, char **envp)
|
||||||
display_remote++;
|
display_remote++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (display_type == DT_DEFAULT && !display_remote) {
|
if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
|
||||||
#if defined(CONFIG_GTK)
|
#if defined(CONFIG_GTK)
|
||||||
display_type = DT_GTK;
|
dpy.type = DISPLAY_TYPE_GTK;
|
||||||
#elif defined(CONFIG_SDL)
|
#elif defined(CONFIG_SDL)
|
||||||
display_type = DT_SDL;
|
dpy.type = DISPLAY_TYPE_SDL;
|
||||||
#elif defined(CONFIG_COCOA)
|
#elif defined(CONFIG_COCOA)
|
||||||
display_type = DT_COCOA;
|
dpy.type = DISPLAY_TYPE_COCOA;
|
||||||
#elif defined(CONFIG_VNC)
|
#elif defined(CONFIG_VNC)
|
||||||
vnc_parse("localhost:0,to=99,id=default", &error_abort);
|
vnc_parse("localhost:0,to=99,id=default", &error_abort);
|
||||||
#else
|
#else
|
||||||
display_type = DT_NONE;
|
dpy.type = DISPLAY_TYPE_NONE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) {
|
if ((no_frame || alt_grab || ctrl_grab) && dpy.type != DISPLAY_TYPE_SDL) {
|
||||||
error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
|
error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
|
||||||
"for SDL, ignoring option");
|
"for SDL, ignoring option");
|
||||||
}
|
}
|
||||||
if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
|
if (dpy.has_window_close &&
|
||||||
|
(dpy.type != DISPLAY_TYPE_GTK && dpy.type != DISPLAY_TYPE_SDL)) {
|
||||||
error_report("-no-quit is only valid for GTK and SDL, "
|
error_report("-no-quit is only valid for GTK and SDL, "
|
||||||
"ignoring option");
|
"ignoring option");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display_type == DT_GTK) {
|
if (dpy.type == DISPLAY_TYPE_GTK) {
|
||||||
early_gtk_display_init(request_opengl);
|
early_gtk_display_init(&dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display_type == DT_SDL) {
|
if (dpy.type == DISPLAY_TYPE_SDL) {
|
||||||
sdl_display_early_init(request_opengl);
|
sdl_display_early_init(&dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_console_early_init();
|
qemu_console_early_init();
|
||||||
|
|
||||||
if (request_opengl == 1 && display_opengl == 0) {
|
if (dpy.has_gl && dpy.gl && display_opengl == 0) {
|
||||||
#if defined(CONFIG_OPENGL)
|
#if defined(CONFIG_OPENGL)
|
||||||
error_report("OpenGL is not supported by the display");
|
error_report("OpenGL is not supported by the display");
|
||||||
#else
|
#else
|
||||||
|
@ -4671,18 +4664,18 @@ int main(int argc, char **argv, char **envp)
|
||||||
ds = init_displaystate();
|
ds = init_displaystate();
|
||||||
|
|
||||||
/* init local displays */
|
/* init local displays */
|
||||||
switch (display_type) {
|
switch (dpy.type) {
|
||||||
case DT_CURSES:
|
case DISPLAY_TYPE_CURSES:
|
||||||
curses_display_init(ds, full_screen);
|
curses_display_init(ds, &dpy);
|
||||||
break;
|
break;
|
||||||
case DT_SDL:
|
case DISPLAY_TYPE_SDL:
|
||||||
sdl_display_init(ds, full_screen);
|
sdl_display_init(ds, &dpy);
|
||||||
break;
|
break;
|
||||||
case DT_COCOA:
|
case DISPLAY_TYPE_COCOA:
|
||||||
cocoa_display_init(ds, full_screen);
|
cocoa_display_init(ds, &dpy);
|
||||||
break;
|
break;
|
||||||
case DT_GTK:
|
case DISPLAY_TYPE_GTK:
|
||||||
gtk_display_init(ds, full_screen, grab_on_hover);
|
gtk_display_init(ds, &dpy);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -4702,8 +4695,8 @@ int main(int argc, char **argv, char **envp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OPENGL_DMABUF
|
#ifdef CONFIG_OPENGL_DMABUF
|
||||||
if (display_type == DT_EGL) {
|
if (dpy.type == DISPLAY_TYPE_EGL_HEADLESS) {
|
||||||
egl_headless_init();
|
egl_headless_init(&dpy);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue