From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 3/4] sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows
Date: Mon, 2 Jun 2014 16:37:29 +0200 [thread overview]
Message-ID: <1401719850-16998-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1401719850-16998-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/sdl2.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 0e884f9..749fa89 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -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;
--
1.8.3.1
next prev parent reply other threads:[~2014-06-02 14:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 14:37 [Qemu-devel] [PULL 0/4] sdl2: add support for text consoles Gerd Hoffmann
2014-06-02 14:37 ` [Qemu-devel] [PULL 1/4] console: add kbd_put_qcode_console Gerd Hoffmann
2014-06-02 14:37 ` [Qemu-devel] [PULL 2/4] console: add kbd_put_string_console Gerd Hoffmann
2014-06-02 14:37 ` Gerd Hoffmann [this message]
2014-06-02 14:37 ` [Qemu-devel] [PULL 4/4] sdl2: textinput + terminal Gerd Hoffmann
2014-06-02 16:06 ` [Qemu-devel] [PULL 0/4] sdl2: add support for text consoles Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401719850-16998-4-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).