All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support
Date: Fri, 17 Nov 2017 11:30:24 +0100	[thread overview]
Message-ID: <20171117103046.15943-3-kraxel@redhat.com> (raw)
In-Reply-To: <20171117103046.15943-1-kraxel@redhat.com>

With absolute pointer devices such as usb-tablet being widely used
mouse grabs (for relative pointing devices) should be rarely needed
these days.  So the benefit of the options to configure the hotkey
modifiers for grab (and other actions) seems questionable.  Which
is expecially true for the -ctrl-grab which isn't handled in the
handle_keyup() code.

Drop the code, print a notice when the option is still used.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl.c  | 22 +++-------------------
 ui/sdl2.c | 23 +++--------------------
 vl.c      | 26 ++++----------------------
 3 files changed, 10 insertions(+), 61 deletions(-)

diff --git a/ui/sdl.c b/ui/sdl.c
index f3adbb7a64..2c85482b5e 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -364,12 +364,7 @@ static void sdl_update_caption(void)
     if (!runstate_is_running())
         status = " [Stopped]";
     else if (gui_grab) {
-        if (alt_grab)
-            status = " - Press Ctrl-Alt-Shift to exit mouse grab";
-        else if (ctrl_grab)
-            status = " - Press Right-Ctrl to exit mouse grab";
-        else
-            status = " - Press Ctrl-Alt to exit mouse grab";
+        status = " - Press Ctrl-Alt to exit mouse grab";
     }
 
     if (qemu_name) {
@@ -556,14 +551,7 @@ static void handle_keydown(SDL_Event *ev)
     int mod_state;
     int keycode;
 
-    if (alt_grab) {
-        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
-                    (gui_grab_code | KMOD_LSHIFT);
-    } else if (ctrl_grab) {
-        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
-    } else {
-        mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
-    }
+    mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
     gui_key_modifier_pressed = mod_state;
 
     if (gui_key_modifier_pressed) {
@@ -701,11 +689,7 @@ static void handle_keyup(SDL_Event *ev)
 {
     int mod_state;
 
-    if (!alt_grab) {
-        mod_state = (ev->key.keysym.mod & gui_grab_code);
-    } else {
-        mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT));
-    }
+    mod_state = (ev->key.keysym.mod & gui_grab_code);
     if (!mod_state && gui_key_modifier_pressed) {
         gui_key_modifier_pressed = 0;
         if (gui_keysym == 0) {
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 3802a9b477..e15566877b 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -139,13 +139,7 @@ static void sdl_update_caption(struct sdl2_console *scon)
     if (!runstate_is_running()) {
         status = " [Stopped]";
     } else if (gui_grab) {
-        if (alt_grab) {
-            status = " - Press Ctrl-Alt-Shift to exit grab";
-        } else if (ctrl_grab) {
-            status = " - Press Right-Ctrl to exit grab";
-        } else {
-            status = " - Press Ctrl-Alt to exit grab";
-        }
+        status = " - Press Ctrl-Alt to exit grab";
     }
 
     if (qemu_name) {
@@ -336,14 +330,7 @@ static void handle_keydown(SDL_Event *ev)
     int mod_state, win;
     struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
 
-    if (alt_grab) {
-        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
-            (gui_grab_code | KMOD_LSHIFT);
-    } else if (ctrl_grab) {
-        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
-    } else {
-        mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
-    }
+    mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
     gui_key_modifier_pressed = mod_state;
 
     if (gui_key_modifier_pressed) {
@@ -420,11 +407,7 @@ static void handle_keyup(SDL_Event *ev)
     int mod_state;
     struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
 
-    if (!alt_grab) {
-        mod_state = (ev->key.keysym.mod & gui_grab_code);
-    } else {
-        mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT));
-    }
+    mod_state = (ev->key.keysym.mod & gui_grab_code);
     if (!mod_state && gui_key_modifier_pressed) {
         gui_key_modifier_pressed = 0;
         if (gui_keysym == 0) {
diff --git a/vl.c b/vl.c
index 4d8553b433..7dab7523a6 100644
--- a/vl.c
+++ b/vl.c
@@ -175,8 +175,6 @@ QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
 int old_param = 0;
 const char *qemu_name;
-int alt_grab = 0;
-int ctrl_grab = 0;
 unsigned int nb_prom_envs = 0;
 const char *prom_envs[MAX_PROM_ENVS];
 int boot_menu;
@@ -2167,22 +2165,10 @@ static DisplayType select_display(const char *p)
                 warn_report("frame sdl option is unsupported, ignoring");
             } else if (strstart(opts, ",alt_grab=", &nextopt)) {
                 opts = nextopt;
-                if (strstart(opts, "on", &nextopt)) {
-                    alt_grab = 1;
-                } else if (strstart(opts, "off", &nextopt)) {
-                    alt_grab = 0;
-                } else {
-                    goto invalid_sdl_args;
-                }
+                warn_report("ctrl_grab sdl option is unsupported, ignoring");
             } else if (strstart(opts, ",ctrl_grab=", &nextopt)) {
                 opts = nextopt;
-                if (strstart(opts, "on", &nextopt)) {
-                    ctrl_grab = 1;
-                } else if (strstart(opts, "off", &nextopt)) {
-                    ctrl_grab = 0;
-                } else {
-                    goto invalid_sdl_args;
-                }
+                warn_report("alt_grab sdl option is unsupported, ignoring");
             } else if (strstart(opts, ",window_close=", &nextopt)) {
                 opts = nextopt;
                 if (strstart(opts, "on", &nextopt)) {
@@ -3780,10 +3766,10 @@ int main(int argc, char **argv, char **envp)
                 warn_report("-no-frame switch is unsupported, ignoring");
                 break;
             case QEMU_OPTION_alt_grab:
-                alt_grab = 1;
+                warn_report("-alt-grab switch is unsupported, ignoring");
                 break;
             case QEMU_OPTION_ctrl_grab:
-                ctrl_grab = 1;
+                warn_report("-ctrl-grab switch is unsupported, ignoring");
                 break;
             case QEMU_OPTION_no_quit:
                 no_quit = 1;
@@ -4466,10 +4452,6 @@ int main(int argc, char **argv, char **envp)
 #endif
     }
 
-    if ((alt_grab || ctrl_grab) && display_type != DT_SDL) {
-        error_report("-no-frame, -alt-grab and -ctrl-grab are only valid "
-                     "for SDL, ignoring option");
-    }
     if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
         error_report("-no-quit is only valid for GTK and SDL, "
                      "ignoring option");
-- 
2.9.3

  parent reply	other threads:[~2017-11-17 10:30 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 10:30 [Qemu-devel] [PATCH 00/24] RfC: rework display initialization Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 01/24] sdl: remove -no-frame support Gerd Hoffmann
2017-11-17 14:21   ` Daniel P. Berrange
2017-11-17 14:49     ` Gerd Hoffmann
2017-11-17 14:59       ` Daniel P. Berrange
2017-11-17 15:06         ` Daniel P. Berrange
2017-11-17 10:30 ` Gerd Hoffmann [this message]
2017-11-17 14:22   ` [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support Daniel P. Berrange
2017-11-17 14:51     ` Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 03/24] sdl: use ctrl-alt-g as grab hotkey Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 04/24] vl: rename DisplayType to LegacyDisplayType Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 05/24] gtk: add and use DisplayOptions + DisplayGTK Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 06/24] sdl: use DisplayOptions Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 07/24] vl: drop no_quit variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 08/24] egl-headless: use DisplayOptions Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 09/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 10/24] cocoa: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 11/24] vl: drop full_screen variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 12/24] vl: drop display_type variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 13/24] vl: drop request_opengl variable Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 14/24] console: add qemu display registry, add gtk Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 15/24] sdl: hook up to display registry Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 16/24] cocoa: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 17/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 18/24] egl-headless: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 19/24] console: add and use qemu_display_find_default Gerd Hoffmann
2017-11-17 12:55   ` Darren Kenny
2017-11-17 13:24     ` Gerd Hoffmann
2017-11-17 14:16       ` Darren Kenny
2017-11-17 15:03         ` Gerd Hoffmann
2017-11-17 15:55           ` Darren Kenny
2017-11-17 10:30 ` [Qemu-devel] [PATCH 20/24] console: add ui module loading support Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 21/24] sdl: build as module Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 22/24] gtk: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 23/24] curses: " Gerd Hoffmann
2017-11-17 10:30 ` [Qemu-devel] [PATCH 24/24] build: opengl should not need X11 Gerd Hoffmann
2017-11-17 10:58 ` [Qemu-devel] [PATCH 00/24] RfC: rework display initialization no-reply
     [not found] <mailman.8273.1510914667.27993.qemu-devel@nongnu.org>
2017-11-17 16:06 ` [Qemu-devel] [PATCH 02/24] sdl: remove -alt-grab and -ctrl-grab support Programmingkid
2017-11-17 21:14   ` Gerd Hoffmann

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=20171117103046.15943-3-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.