From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel <qemu-devel@nongnu.org>,
qemu-trivial <qemu-trivial@nongnu.org>
Cc: Erik Rull <erik.rull@rdsoftware.de>
Subject: [Qemu-devel] [PATCH] sdl: Do not grab mouse on mode switch while in background
Date: Fri, 27 Jan 2012 23:41:54 +0100 [thread overview]
Message-ID: <4F232832.8060907@web.de> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
When the mouse mode changes to absolute while the SDL windows is not in
focus, refrain from grabbing the input. It would steal from some other
window.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
I bet this makes no difference for your problem, Erik, but I came
across this while trying to reproduce the issue.
ui/sdl.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/ui/sdl.c b/ui/sdl.c
index 8cafc44..384276d 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -483,12 +483,27 @@ static void sdl_grab_end(void)
sdl_update_caption();
}
+static void absolute_mouse_grab(void)
+{
+ int mouse_x, mouse_y;
+
+ if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
+ SDL_GetMouseState(&mouse_x, &mouse_y);
+ if (mouse_x > 0 && mouse_x < real_screen->w - 1 &&
+ mouse_y > 0 && mouse_y < real_screen->h - 1) {
+ sdl_grab_start();
+ }
+ }
+}
+
static void sdl_mouse_mode_change(Notifier *notify, void *data)
{
if (kbd_mouse_is_absolute()) {
if (!absolute_enabled) {
- sdl_grab_start();
absolute_enabled = 1;
+ if (is_graphic_console()) {
+ absolute_mouse_grab();
+ }
}
} else if (absolute_enabled) {
if (!gui_fullscreen) {
@@ -571,19 +586,6 @@ static void toggle_full_screen(DisplayState *ds)
vga_hw_update();
}
-static void absolute_mouse_grab(void)
-{
- int mouse_x, mouse_y;
-
- if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
- SDL_GetMouseState(&mouse_x, &mouse_y);
- if (mouse_x > 0 && mouse_x < real_screen->w - 1 &&
- mouse_y > 0 && mouse_y < real_screen->h - 1) {
- sdl_grab_start();
- }
- }
-}
-
static void handle_keydown(DisplayState *ds, SDL_Event *ev)
{
int mod_state;
--
1.7.3.4
next reply other threads:[~2012-01-27 22:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-27 22:41 Jan Kiszka [this message]
2012-01-28 11:17 ` [Qemu-devel] [PATCH] sdl: Do not grab mouse on mode switch while in background Jan Kiszka
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=4F232832.8060907@web.de \
--to=jan.kiszka@web.de \
--cc=erik.rull@rdsoftware.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).