diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2014-05-27 09:44:39 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-06-02 16:28:58 +0200 |
commit | 363f59d9e44f1ecede0e50ae2d3b96c969985663 (patch) | |
tree | ac79b51a7343115ff5dc62bb6e21ad7a020392a6 /ui/sdl2.c | |
parent | bdef97247477955c26806f0eccb0fce9c1ecbeee (diff) | |
download | qemu-363f59d9e44f1ecede0e50ae2d3b96c969985663.tar.gz qemu-363f59d9e44f1ecede0e50ae2d3b96c969985663.tar.bz2 qemu-363f59d9e44f1ecede0e50ae2d3b96c969985663.zip |
sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl2.c')
-rw-r--r-- | ui/sdl2.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -49,6 +49,7 @@ static struct sdl2_state { int idx; int last_vm_running; /* per console for caption reasons */ int x, y; + int hidden; } *sdl2_console; static SDL_Surface *guest_sprite_surface; @@ -136,6 +137,9 @@ static void do_sdl_resize(struct sdl2_state *scon, int width, int height, } else { flags |= SDL_WINDOW_RESIZABLE; } + if (scon->hidden) { + flags |= SDL_WINDOW_HIDDEN; + } scon->real_window = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, @@ -458,7 +462,7 @@ static void toggle_full_screen(struct sdl2_state *scon) static void handle_keydown(SDL_Event *ev) { - int mod_state; + int mod_state, win; struct sdl2_state *scon = get_scon_from_window(ev->key.windowID); if (alt_grab) { @@ -473,6 +477,27 @@ static void handle_keydown(SDL_Event *ev) if (gui_key_modifier_pressed) { switch (ev->key.keysym.scancode) { + case SDL_SCANCODE_2: + case SDL_SCANCODE_3: + case SDL_SCANCODE_4: + case SDL_SCANCODE_5: + case SDL_SCANCODE_6: + case SDL_SCANCODE_7: + case SDL_SCANCODE_8: + case SDL_SCANCODE_9: + win = ev->key.keysym.scancode - SDL_SCANCODE_1; + if (win < sdl2_num_outputs) { + sdl2_console[win].hidden = !sdl2_console[win].hidden; + if (sdl2_console[win].real_window) { + if (sdl2_console[win].hidden) { + SDL_HideWindow(sdl2_console[win].real_window); + } else { + SDL_ShowWindow(sdl2_console[win].real_window); + } + } + gui_keysym = 1; + } + break; case SDL_SCANCODE_F: toggle_full_screen(scon); gui_keysym = 1; |