mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
sdl: use DisplayOptions
Switch sdl ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20180202111022.19269-6-kraxel@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
0c8d706532
commit
fe91f36aa5
5 changed files with 50 additions and 28 deletions
19
ui/sdl.c
19
ui/sdl.c
|
@ -41,6 +41,7 @@
|
|||
|
||||
static DisplayChangeListener *dcl;
|
||||
static DisplaySurface *surface;
|
||||
static DisplayOptions *opts;
|
||||
static SDL_Surface *real_screen;
|
||||
static SDL_Surface *guest_screen = NULL;
|
||||
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)
|
||||
{
|
||||
SDL_Event ev1, *ev = &ev1;
|
||||
bool allow_close = true;
|
||||
int idle = 1;
|
||||
|
||||
if (last_vm_running != runstate_is_running()) {
|
||||
|
@ -793,7 +795,10 @@ static void sdl_refresh(DisplayChangeListener *dcl)
|
|||
handle_keyup(ev);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
if (!no_quit) {
|
||||
if (opts->has_window_close && !opts->window_close) {
|
||||
allow_close = false;
|
||||
}
|
||||
if (allow_close) {
|
||||
no_shutdown = 0;
|
||||
qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
|
||||
}
|
||||
|
@ -892,9 +897,9 @@ static const DisplayChangeListenerOps dcl_ops = {
|
|||
.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,
|
||||
"SDL1 display code has no opengl support.\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;
|
||||
uint8_t data = 0;
|
||||
|
@ -910,6 +915,8 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
|||
SDL_SysWMinfo info;
|
||||
char *filename;
|
||||
|
||||
assert(o->type == DISPLAY_TYPE_SDL);
|
||||
opts = o;
|
||||
#if defined(__APPLE__)
|
||||
/* always use generic keymaps */
|
||||
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"
|
||||
"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);
|
||||
}
|
||||
#ifdef __linux__
|
||||
|
@ -967,7 +974,7 @@ void sdl_display_init(DisplayState *ds, int full_screen)
|
|||
g_free(filename);
|
||||
}
|
||||
|
||||
if (full_screen) {
|
||||
if (opts->has_full_screen && opts->full_screen) {
|
||||
gui_fullscreen = 1;
|
||||
sdl_grab_start();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue