void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)

{

    int flags;

    uint8_t data = 0;

    const SDL_VideoInfo *vi;

    char *filename;



#if defined(__APPLE__)

    /* always use generic keymaps */

    if (!keyboard_layout)

        keyboard_layout = "en-us";

#endif

    if(keyboard_layout) {

        kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);

        if (!kbd_layout)

            exit(1);

    }



    if (no_frame)

        gui_noframe = 1;



    if (!full_screen) {

        setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);

    }

#ifdef __linux__

    /* on Linux, SDL may use fbcon|directfb|svgalib when run without

     * accessible $DISPLAY to open X11 window.  This is often the case

     * when qemu is run using sudo.  But in this case, and when actually

     * run in X11 environment, SDL fights with X11 for the video card,

     * making current display unavailable, often until reboot.

     * So make x11 the default SDL video driver if this variable is unset.

     * This is a bit hackish but saves us from bigger problem.

     * Maybe it's a good idea to fix this in SDL instead.

     */

    setenv("SDL_VIDEODRIVER", "x11", 0);

#endif



    /* Enable normal up/down events for Caps-Lock and Num-Lock keys.

     * This requires SDL >= 1.2.14. */

    setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);



    flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;

    if (SDL_Init (flags)) {

        fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",

                SDL_GetError());

        exit(1);

    }

    vi = SDL_GetVideoInfo();

    host_format = *(vi->vfmt);



    /* Load a 32x32x4 image. White pixels are transparent. */

    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");

    if (filename) {

        SDL_Surface *image = SDL_LoadBMP(filename);

        if (image) {

            uint32_t colorkey = SDL_MapRGB(image->format, 255, 255, 255);

            SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);

            SDL_WM_SetIcon(image, NULL);

        }

        g_free(filename);

    }



    if (full_screen) {

        gui_fullscreen = 1;

        sdl_grab_start();

    }



    dcl = g_malloc0(sizeof(DisplayChangeListener));

    dcl->ops = &dcl_ops;

    register_displaychangelistener(dcl);



    mouse_mode_notifier.notify = sdl_mouse_mode_change;

    qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);



    sdl_update_caption();

    SDL_EnableKeyRepeat(250, 50);

    gui_grab = 0;



    sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);

    sdl_cursor_normal = SDL_GetCursor();



    atexit(sdl_cleanup);

}

void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)

{

    int flags;

    uint8_t data = 0;

    const SDL_VideoInfo *vi;

    char *filename;



#if defined(__APPLE__)

    

    if (!keyboard_layout)

        keyboard_layout = "en-us";

#endif

    if(keyboard_layout) {

        kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);

        if (!kbd_layout)

            exit(1);

    }



    if (no_frame)

        gui_noframe = 1;



    if (!full_screen) {

        setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);

    }

#ifdef __linux__

    

















    setenv("SDL_VIDEODRIVER", "x11", 0);

#endif



    



    setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);



    flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;

    if (SDL_Init (flags)) {

        fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",

                SDL_GetError());

        exit(1);

    }

    vi = SDL_GetVideoInfo();

    host_format = *(vi->vfmt);



    

    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");

    if (filename) {

        SDL_Surface *image = SDL_LoadBMP(filename);

        if (image) {

            uint32_t colorkey = SDL_MapRGB(image->format, 255, 255, 255);

            SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);

            SDL_WM_SetIcon(image, NULL);

        }

        g_free(filename);

    }



    if (full_screen) {

        gui_fullscreen = 1;

        sdl_grab_start();

    }



    dcl = g_malloc0(sizeof(DisplayChangeListener));

    dcl->ops = &dcl_ops;

    register_displaychangelistener(dcl);



    mouse_mode_notifier.notify = sdl_mouse_mode_change;

    qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);



    sdl_update_caption();

    SDL_EnableKeyRepeat(250, 50);

    gui_grab = 0;



    sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);

    sdl_cursor_normal = SDL_GetCursor();



    atexit(sdl_cleanup);

}

    dcl = g_malloc0(sizeof(DisplayChangeListener));
void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2)

{

    int VAR_3;

    uint8_t data = 0;

    const SDL_VideoInfo *VAR_4;

    char *VAR_5;



#if defined(__APPLE__)

    

    if (!keyboard_layout)

        keyboard_layout = "en-us";

#endif

    if(keyboard_layout) {

        kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);

        if (!kbd_layout)

            exit(1);

    }



    if (VAR_2)

        gui_noframe = 1;



    if (!VAR_1) {

        setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0);

    }

#ifdef __linux__

    

















    setenv("SDL_VIDEODRIVER", "x11", 0);

#endif



    



    setenv("SDL_DISABLE_LOCK_KEYS", "1", 1);



    VAR_3 = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;

    if (SDL_Init (VAR_3)) {

        fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",

                SDL_GetError());

        exit(1);

    }

    VAR_4 = SDL_GetVideoInfo();

    host_format = *(VAR_4->vfmt);



    

    VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp");

    if (VAR_5) {

        SDL_Surface *image = SDL_LoadBMP(VAR_5);

        if (image) {

            uint32_t colorkey = SDL_MapRGB(image->format, 255, 255, 255);

            SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey);

            SDL_WM_SetIcon(image, NULL);

        }

        g_free(VAR_5);

    }



    if (VAR_1) {

        gui_fullscreen = 1;

        sdl_grab_start();

    }



    dcl = g_malloc0(sizeof(DisplayChangeListener));

    dcl->ops = &dcl_ops;

    register_displaychangelistener(dcl);



    mouse_mode_notifier.notify = sdl_mouse_mode_change;

    qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);



    sdl_update_caption();

    SDL_EnableKeyRepeat(250, 50);

    gui_grab = 0;



    sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);

    sdl_cursor_normal = SDL_GetCursor();



    atexit(sdl_cleanup);

}

void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2)
{ int VAR_3; uint8_t data = 0; const SDL_VideoInfo *VAR_4; char *VAR_5; #if defined(__APPLE__)
if (!keyboard_layout)
keyboard_layout = "en-us"; #endif
if(keyboard_layout) { kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout); if (!kbd_layout)
exit(1); } if (VAR_2)
gui_noframe = 1; if (!VAR_1) { setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } #ifdef __linux__
setenv("SDL_VIDEODRIVER", "x11", 0); #endif
setenv("SDL_DISABLE_LOCK_KEYS", "1", 1); VAR_3 = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; if (SDL_Init (VAR_3)) { fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",
SDL_GetError()); exit(1); } VAR_4 = SDL_GetVideoInfo(); host_format = *(VAR_4->vfmt); VAR_5 = qemu_find_file(QEMU_FILE_TYPE_BIOS, "qemu-icon.bmp"); if (VAR_5) { SDL_Surface *image = SDL_LoadBMP(VAR_5); if (image) { uint32_t colorkey = SDL_MapRGB(image->format, 255, 255, 255); SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorkey); SDL_WM_SetIcon(image, NULL); } g_free(VAR_5); } if (VAR_1) { gui_fullscreen = 1; sdl_grab_start(); } dcl = g_malloc0(sizeof(DisplayChangeListener)); dcl->ops = &dcl_ops; register_displaychangelistener(dcl); mouse_mode_notifier.notify = sdl_mouse_mode_change; qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier); sdl_update_caption(); SDL_EnableKeyRepeat(250, 50); gui_grab = 0; sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal = SDL_GetCursor(); atexit(sdl_cleanup); }