qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/6] Ui 20180409 patches
@ 2018-04-09  9:40 Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 1/6] sdl2: Remove unused epoxy include Gerd Hoffmann
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The following changes since commit 094b62cd9cd9f137cf75b4931e41b8953fb4ccd9:

  Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging (2018-04-04 11:13:52 +0100)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/ui-20180409-pull-request

for you to fetch changes up to 1458da9131c39ca99699b521436d6ce72d7c7981:

  sdl2: drop dead code (2018-04-09 10:40:47 +0200)

----------------------------------------------------------------
sdl2: fix kbd regression (compared to sdl1), cleanups.

----------------------------------------------------------------

Elie Tournier (1):
  sdl2: Remove unused epoxy include

Gerd Hoffmann (5):
  ui: add ctrl modifier support to kbd_put_qcode_console()
  sdl2: track kbd modifier state unconditionally
  sdl2: enable ctrl modifier keys for text consoles
  sdl2: drop QEMU_KEY_BACKSPACE special case
  sdl2: drop dead code

 include/ui/console.h |  2 +-
 ui/console.c         | 15 +++++++++++++--
 ui/gtk.c             |  4 ++--
 ui/sdl2-gl.c         |  2 --
 ui/sdl2-input.c      | 46 ++++++++++++++++++++--------------------------
 5 files changed, 36 insertions(+), 33 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 1/6] sdl2: Remove unused epoxy include
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
@ 2018-04-09  9:40 ` Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 2/6] ui: add ctrl modifier support to kbd_put_qcode_console() Gerd Hoffmann
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Elie Tournier, Elie Tournier

From: Elie Tournier <tournier.elie@gmail.com>

Signed-off-by: Elie Tournier <elie.tournier@collabora.com>
Message-id: 20180404093040.26009-1-tournier.elie@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-gl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 5e1073a084..c3683e6b65 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -32,8 +32,6 @@
 #include "ui/sdl2.h"
 #include "sysemu/sysemu.h"
 
-#include <epoxy/gl.h>
-
 static void sdl2_set_scanout_mode(struct sdl2_console *scon, bool scanout)
 {
     if (scon->scanout_mode == scanout) {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 2/6] ui: add ctrl modifier support to kbd_put_qcode_console()
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 1/6] sdl2: Remove unused epoxy include Gerd Hoffmann
@ 2018-04-09  9:40 ` Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 3/6] sdl2: track kbd modifier state unconditionally Gerd Hoffmann
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-2-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/console.h |  2 +-
 ui/console.c         | 15 +++++++++++++--
 ui/gtk.c             |  4 ++--
 ui/sdl2-input.c      |  2 +-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/include/ui/console.h b/include/ui/console.h
index 6d2c052068..37a8d68d29 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -99,7 +99,7 @@ void hmp_mouse_set(Monitor *mon, const QDict *qdict);
 #define QEMU_KEY_CTRL_PAGEDOWN   0xe407
 
 void kbd_put_keysym_console(QemuConsole *s, int keysym);
-bool kbd_put_qcode_console(QemuConsole *s, int qcode);
+bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl);
 void kbd_put_string_console(QemuConsole *s, const char *str, int len);
 void kbd_put_keysym(int keysym);
 
diff --git a/ui/console.c b/ui/console.c
index 530a491987..3fb2f4e09f 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1191,11 +1191,22 @@ static const int qcode_to_keysym[Q_KEY_CODE__MAX] = {
     [Q_KEY_CODE_BACKSPACE] = QEMU_KEY_BACKSPACE,
 };
 
-bool kbd_put_qcode_console(QemuConsole *s, int qcode)
+static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX] = {
+    [Q_KEY_CODE_UP]     = QEMU_KEY_CTRL_UP,
+    [Q_KEY_CODE_DOWN]   = QEMU_KEY_CTRL_DOWN,
+    [Q_KEY_CODE_RIGHT]  = QEMU_KEY_CTRL_RIGHT,
+    [Q_KEY_CODE_LEFT]   = QEMU_KEY_CTRL_LEFT,
+    [Q_KEY_CODE_HOME]   = QEMU_KEY_CTRL_HOME,
+    [Q_KEY_CODE_END]    = QEMU_KEY_CTRL_END,
+    [Q_KEY_CODE_PGUP]   = QEMU_KEY_CTRL_PAGEUP,
+    [Q_KEY_CODE_PGDN]   = QEMU_KEY_CTRL_PAGEDOWN,
+};
+
+bool kbd_put_qcode_console(QemuConsole *s, int qcode, bool ctrl)
 {
     int keysym;
 
-    keysym = qcode_to_keysym[qcode];
+    keysym = ctrl ? ctrl_qcode_to_keysym[qcode] : qcode_to_keysym[qcode];
     if (keysym == 0) {
         return false;
     }
diff --git a/ui/gtk.c b/ui/gtk.c
index ef5bc42094..e98ac4d2fc 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1197,12 +1197,12 @@ static gboolean gd_text_key_down(GtkWidget *widget,
     QemuConsole *con = vc->gfx.dcl.con;
 
     if (key->keyval == GDK_KEY_Delete) {
-        kbd_put_qcode_console(con, Q_KEY_CODE_DELETE);
+        kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false);
     } else if (key->length) {
         kbd_put_string_console(con, key->string, key->length);
     } else {
         int qcode = gd_map_keycode(key->hardware_keycode);
-        kbd_put_qcode_console(con, qcode);
+        kbd_put_qcode_console(con, qcode, false);
     }
     return TRUE;
 }
diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 605d781971..35d35c14c4 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -70,7 +70,7 @@ void sdl2_process_key(struct sdl2_console *scon,
                 kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
                 break;
             default:
-                kbd_put_qcode_console(con, qcode);
+                kbd_put_qcode_console(con, qcode, false);
                 break;
             }
         }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 3/6] sdl2: track kbd modifier state unconditionally
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 1/6] sdl2: Remove unused epoxy include Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 2/6] ui: add ctrl modifier support to kbd_put_qcode_console() Gerd Hoffmann
@ 2018-04-09  9:40 ` Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 4/6] sdl2: enable ctrl modifier keys for text consoles Gerd Hoffmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

For both grapical and text consoles.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-3-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-input.c | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 35d35c14c4..8d0d9ba17c 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -60,23 +60,7 @@ void sdl2_process_key(struct sdl2_console *scon,
 
     qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
 
-    if (!qemu_console_is_graphic(con)) {
-        if (ev->type == SDL_KEYDOWN) {
-            switch (ev->keysym.scancode) {
-            case SDL_SCANCODE_RETURN:
-                kbd_put_keysym_console(con, '\n');
-                break;
-            case SDL_SCANCODE_BACKSPACE:
-                kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
-                break;
-            default:
-                kbd_put_qcode_console(con, qcode, false);
-                break;
-            }
-        }
-        return;
-    }
-
+    /* modifier state tracking */
     switch (ev->keysym.scancode) {
 #if 0
     case SDL_SCANCODE_NUMLOCKCLEAR:
@@ -99,8 +83,27 @@ void sdl2_process_key(struct sdl2_console *scon,
         } else {
             modifiers_state[ev->keysym.scancode] = 1;
         }
-        /* fall though */
+        break;
     default:
+        /* nothing */
+        break;
+    }
+
+    if (!qemu_console_is_graphic(con)) {
+        if (ev->type == SDL_KEYDOWN) {
+            switch (ev->keysym.scancode) {
+            case SDL_SCANCODE_RETURN:
+                kbd_put_keysym_console(con, '\n');
+                break;
+            case SDL_SCANCODE_BACKSPACE:
+                kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
+                break;
+            default:
+                kbd_put_qcode_console(con, qcode, false);
+                break;
+            }
+        }
+    } else {
         qemu_input_event_send_key_qcode(con, qcode,
                                         ev->type == SDL_KEYDOWN);
     }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 4/6] sdl2: enable ctrl modifier keys for text consoles
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2018-04-09  9:40 ` [Qemu-devel] [PULL 3/6] sdl2: track kbd modifier state unconditionally Gerd Hoffmann
@ 2018-04-09  9:40 ` Gerd Hoffmann
  2018-04-09  9:40 ` [Qemu-devel] [PULL 5/6] sdl2: drop QEMU_KEY_BACKSPACE special case Gerd Hoffmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Unbreaks ctrl-pageup/pagedown scrollback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-4-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-input.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 8d0d9ba17c..62c2b58ef0 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -90,6 +90,8 @@ void sdl2_process_key(struct sdl2_console *scon,
     }
 
     if (!qemu_console_is_graphic(con)) {
+        bool ctrl = (modifiers_state[SDL_SCANCODE_LCTRL] ||
+                     modifiers_state[SDL_SCANCODE_RCTRL]);
         if (ev->type == SDL_KEYDOWN) {
             switch (ev->keysym.scancode) {
             case SDL_SCANCODE_RETURN:
@@ -99,7 +101,7 @@ void sdl2_process_key(struct sdl2_console *scon,
                 kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
                 break;
             default:
-                kbd_put_qcode_console(con, qcode, false);
+                kbd_put_qcode_console(con, qcode, ctrl);
                 break;
             }
         }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 5/6] sdl2: drop QEMU_KEY_BACKSPACE special case
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2018-04-09  9:40 ` [Qemu-devel] [PULL 4/6] sdl2: enable ctrl modifier keys for text consoles Gerd Hoffmann
@ 2018-04-09  9:40 ` Gerd Hoffmann
  2018-04-09  9:41 ` [Qemu-devel] [PULL 6/6] sdl2: drop dead code Gerd Hoffmann
  2018-04-09 13:11 ` [Qemu-devel] [PULL 0/6] Ui 20180409 patches Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Not needed, kbd_put_qcode_console() will handle that for us.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-5-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-input.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index 62c2b58ef0..d46411c474 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -97,9 +97,6 @@ void sdl2_process_key(struct sdl2_console *scon,
             case SDL_SCANCODE_RETURN:
                 kbd_put_keysym_console(con, '\n');
                 break;
-            case SDL_SCANCODE_BACKSPACE:
-                kbd_put_keysym_console(con, QEMU_KEY_BACKSPACE);
-                break;
             default:
                 kbd_put_qcode_console(con, qcode, ctrl);
                 break;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 6/6] sdl2: drop dead code
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2018-04-09  9:40 ` [Qemu-devel] [PULL 5/6] sdl2: drop QEMU_KEY_BACKSPACE special case Gerd Hoffmann
@ 2018-04-09  9:41 ` Gerd Hoffmann
  2018-04-09 13:11 ` [Qemu-devel] [PULL 0/6] Ui 20180409 patches Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-04-09  9:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Leftover from sdl1 -> sdl2 port.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180321135041.15768-6-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-input.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/ui/sdl2-input.c b/ui/sdl2-input.c
index d46411c474..1378b63dd9 100644
--- a/ui/sdl2-input.c
+++ b/ui/sdl2-input.c
@@ -62,14 +62,6 @@ void sdl2_process_key(struct sdl2_console *scon,
 
     /* modifier state tracking */
     switch (ev->keysym.scancode) {
-#if 0
-    case SDL_SCANCODE_NUMLOCKCLEAR:
-    case SDL_SCANCODE_CAPSLOCK:
-        /* SDL does not send the key up event, so we generate it */
-        qemu_input_event_send_key_qcode(con, qcode, true);
-        qemu_input_event_send_key_qcode(con, qcode, false);
-        return;
-#endif
     case SDL_SCANCODE_LCTRL:
     case SDL_SCANCODE_LSHIFT:
     case SDL_SCANCODE_LALT:
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/6] Ui 20180409 patches
  2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2018-04-09  9:41 ` [Qemu-devel] [PULL 6/6] sdl2: drop dead code Gerd Hoffmann
@ 2018-04-09 13:11 ` Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2018-04-09 13:11 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 9 April 2018 at 10:40, Gerd Hoffmann <kraxel@redhat.com> wrote:
> The following changes since commit 094b62cd9cd9f137cf75b4931e41b8953fb4ccd9:
>
>   Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging (2018-04-04 11:13:52 +0100)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/ui-20180409-pull-request
>
> for you to fetch changes up to 1458da9131c39ca99699b521436d6ce72d7c7981:
>
>   sdl2: drop dead code (2018-04-09 10:40:47 +0200)
>
> ----------------------------------------------------------------
> sdl2: fix kbd regression (compared to sdl1), cleanups.
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-09 13:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-09  9:40 [Qemu-devel] [PULL 0/6] Ui 20180409 patches Gerd Hoffmann
2018-04-09  9:40 ` [Qemu-devel] [PULL 1/6] sdl2: Remove unused epoxy include Gerd Hoffmann
2018-04-09  9:40 ` [Qemu-devel] [PULL 2/6] ui: add ctrl modifier support to kbd_put_qcode_console() Gerd Hoffmann
2018-04-09  9:40 ` [Qemu-devel] [PULL 3/6] sdl2: track kbd modifier state unconditionally Gerd Hoffmann
2018-04-09  9:40 ` [Qemu-devel] [PULL 4/6] sdl2: enable ctrl modifier keys for text consoles Gerd Hoffmann
2018-04-09  9:40 ` [Qemu-devel] [PULL 5/6] sdl2: drop QEMU_KEY_BACKSPACE special case Gerd Hoffmann
2018-04-09  9:41 ` [Qemu-devel] [PULL 6/6] sdl2: drop dead code Gerd Hoffmann
2018-04-09 13:11 ` [Qemu-devel] [PULL 0/6] Ui 20180409 patches Peter Maydell

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).