All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/6] Fixes 20210726 patches
@ 2021-07-26 11:05 Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 1/6] ui/gtk: Fix relative mouse with multiple monitors Gerd Hoffmann
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Gerd Hoffmann

The following changes since commit a2376507f615495b1d16685449ce0ea78c2caf9d:

  Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-07-24 11:04:57 +0100)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/fixes-20210726-pull-request

for you to fetch changes up to 584af1f1d955476aacba3350c4efb5865fc91c09:

  ui/gtk: add a keyboard fifo to the VTE consoles (2021-07-26 10:24:49 +0200)

----------------------------------------------------------------
ui: fixes for 6.1

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

Akihiko Odaki (4):
  ui/spice: Use HAVE_SPICE_GL for OpenGL checks
  ui/egl-headless: Remove a check for CONFIG_OPENGL
  ui/cocoa: Fix the type of main's argv
  ui: update keycodemapdb submodule commit

Dennis Wölfing (1):
  ui/gtk: Fix relative mouse with multiple monitors

Volker Rümelin (1):
  ui/gtk: add a keyboard fifo to the VTE consoles

 include/ui/gtk.h  |  4 +++
 ui/egl-headless.c |  2 --
 ui/gtk.c          | 68 ++++++++++++++++++++++++++++-------------------
 ui/spice-app.c    |  3 ++-
 ui/spice-core.c   |  2 +-
 ui/cocoa.m        |  4 +--
 ui/keycodemapdb   |  2 +-
 7 files changed, 50 insertions(+), 35 deletions(-)

-- 
2.31.1




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

* [PULL 1/6] ui/gtk: Fix relative mouse with multiple monitors
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 2/6] ui/spice: Use HAVE_SPICE_GL for OpenGL checks Gerd Hoffmann
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Dennis Wölfing, Gerd Hoffmann,
	Marc-André Lureau

From: Dennis Wölfing <denniswoelfing@gmx.de>

To handle relative mouse input the event handler needs to move the mouse
away from the screen edges. Failing to do so results in the mouse
getting stuck at invisible walls. However the current implementation for
this is broken on hosts with multiple monitors.

With multiple monitors the mouse can be located outside of the current
monitor which is not handled by the current code. Also the monitor
itself might be located at coordinates different from (0, 0).

Signed-off-by: Dennis Wölfing <denniswoelfing@gmx.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210720143940.291413-1-denniswoelfing@gmx.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 376b4d528daa..18542c763312 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -865,37 +865,25 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
         GdkWindow *win = gtk_widget_get_window(widget);
         GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
         GdkRectangle geometry;
-        int screen_width, screen_height;
 
         int x = (int)motion->x_root;
         int y = (int)motion->y_root;
 
         gdk_monitor_get_geometry(monitor, &geometry);
-        screen_width = geometry.width;
-        screen_height = geometry.height;
 
         /* In relative mode check to see if client pointer hit
-         * one of the screen edges, and if so move it back by
-         * 200 pixels. This is important because the pointer
+         * one of the monitor edges, and if so move it back to the
+         * center of the monitor. This is important because the pointer
          * in the server doesn't correspond 1-for-1, and so
          * may still be only half way across the screen. Without
          * this warp, the server pointer would thus appear to hit
          * an invisible wall */
-        if (x == 0) {
-            x += 200;
-        }
-        if (y == 0) {
-            y += 200;
-        }
-        if (x == (screen_width - 1)) {
-            x -= 200;
-        }
-        if (y == (screen_height - 1)) {
-            y -= 200;
-        }
-
-        if (x != (int)motion->x_root || y != (int)motion->y_root) {
+        if (x <= geometry.x || x - geometry.x >= geometry.width - 1 ||
+            y <= geometry.y || y - geometry.y >= geometry.height - 1) {
             GdkDevice *dev = gdk_event_get_device((GdkEvent *)motion);
+            x = geometry.x + geometry.width / 2;
+            y = geometry.y + geometry.height / 2;
+
             gdk_device_warp(dev, screen, x, y);
             s->last_set = FALSE;
             return FALSE;
-- 
2.31.1



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

* [PULL 2/6] ui/spice: Use HAVE_SPICE_GL for OpenGL checks
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 1/6] ui/gtk: Fix relative mouse with multiple monitors Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 3/6] ui/egl-headless: Remove a check for CONFIG_OPENGL Gerd Hoffmann
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Gerd Hoffmann, Akihiko Odaki, Marc-André Lureau

From: Akihiko Odaki <akihiko.odaki@gmail.com>

Some code in ui/spice used CONFIG_OPENGL for OpenGL conditionals, but
SPICE also depends on CONFIG_GBM and SPICE server whose version is
0.13.1 or later for OpenGL. Always use HAVE_SPICE_GL, which defines the
precise condition.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210714055735.86050-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-app.c  | 3 ++-
 ui/spice-core.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ui/spice-app.c b/ui/spice-app.c
index 641f4a9d53e3..7e71e18da9ad 100644
--- a/ui/spice-app.c
+++ b/ui/spice-app.c
@@ -27,6 +27,7 @@
 #include <gio/gio.h>
 
 #include "ui/console.h"
+#include "ui/spice-display.h"
 #include "qemu/config-file.h"
 #include "qemu/option.h"
 #include "qemu/cutils.h"
@@ -175,7 +176,7 @@ static void spice_app_display_early_init(DisplayOptions *opts)
     qemu_opt_set(qopts, "addr", sock_path, &error_abort);
     qemu_opt_set(qopts, "image-compression", "off", &error_abort);
     qemu_opt_set(qopts, "streaming-video", "off", &error_abort);
-#ifdef CONFIG_OPENGL
+#ifdef HAVE_SPICE_GL
     qemu_opt_set(qopts, "gl", opts->has_gl ? "on" : "off", &error_abort);
     display_opengl = opts->has_gl;
 #endif
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 86d43783acac..0371055e6c17 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -1039,6 +1039,6 @@ static void spice_register_config(void)
 opts_init(spice_register_config);
 module_opts("spice");
 
-#ifdef CONFIG_OPENGL
+#ifdef HAVE_SPICE_GL
 module_dep("ui-opengl");
 #endif
-- 
2.31.1



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

* [PULL 3/6] ui/egl-headless: Remove a check for CONFIG_OPENGL
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 1/6] ui/gtk: Fix relative mouse with multiple monitors Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 2/6] ui/spice: Use HAVE_SPICE_GL for OpenGL checks Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 4/6] ui/cocoa: Fix the type of main's argv Gerd Hoffmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Gerd Hoffmann, Akihiko Odaki, Marc-André Lureau

From: Akihiko Odaki <akihiko.odaki@gmail.com>

ui/egl-headless is only built when CONFIG_OPENGL is defined because it
depends on CONFIG_OPENGL without condition. Remove a redundant
conditonal in ui/egl-headless.c

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210714055646.85952-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/egl-headless.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 75404e0e8700..a26a2520c496 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -214,6 +214,4 @@ static void register_egl(void)
 
 type_init(register_egl);
 
-#ifdef CONFIG_OPENGL
 module_dep("ui-opengl");
-#endif
-- 
2.31.1



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

* [PULL 4/6] ui/cocoa: Fix the type of main's argv
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2021-07-26 11:05 ` [PULL 3/6] ui/egl-headless: Remove a check for CONFIG_OPENGL Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 5/6] ui: update keycodemapdb submodule commit Gerd Hoffmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Gerd Hoffmann, Akihiko Odaki

From: Akihiko Odaki <akihiko.odaki@gmail.com>

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210708165619.29299-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/cocoa.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 9f72844b0793..68a6302184ab 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1888,12 +1888,12 @@ static void *call_qemu_main(void *opaque)
     exit(status);
 }
 
-int main (int argc, const char * argv[]) {
+int main (int argc, char **argv) {
     QemuThread thread;
 
     COCOA_DEBUG("Entered main()\n");
     gArgc = argc;
-    gArgv = (char **)argv;
+    gArgv = argv;
 
     qemu_sem_init(&display_init_sem, 0);
     qemu_sem_init(&app_started_sem, 0);
-- 
2.31.1



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

* [PULL 5/6] ui: update keycodemapdb submodule commit
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2021-07-26 11:05 ` [PULL 4/6] ui/cocoa: Fix the type of main's argv Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-26 11:05 ` [PULL 6/6] ui/gtk: add a keyboard fifo to the VTE consoles Gerd Hoffmann
  2021-07-27  7:34 ` [PULL 0/6] Fixes 20210726 patches Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Gerd Hoffmann, Akihiko Odaki

From: Akihiko Odaki <akihiko.odaki@gmail.com>

The change of ui/keycodemapdb effective on QEMU is only commit
d21009b1c9f94b740ea66be8e48a1d8ad8124023, which adds mappings for key
codes added in commit d7696ff884e35c6dacf83a7cbe3355e3b0a90125.

d21009b1c9f94b740ea66be8e48a1d8ad8124023 Add QEMU QKeyCode "lang1" and "lang2"
320f92c36a80bfafc5d57834592a7be5fd79f104 rust: fix cargo clippy
e62d42f0fd76f7bb8bf78385a83c060e66ff52b0 tests: add rust test
3e25e1ca1772fc3f2039f739f8f920450dc68e50 gen: add --lang rust
9133a0b8022d1fb063a81cc2ba3b627c14ccdfd1 tests: fix argument order

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: <20210705075912.2280-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/keycodemapdb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/keycodemapdb b/ui/keycodemapdb
index 6119e6e19a05..d21009b1c9f9 160000
--- a/ui/keycodemapdb
+++ b/ui/keycodemapdb
@@ -1 +1 @@
-Subproject commit 6119e6e19a050df847418de7babe5166779955e4
+Subproject commit d21009b1c9f94b740ea66be8e48a1d8ad8124023
-- 
2.31.1



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

* [PULL 6/6] ui/gtk: add a keyboard fifo to the VTE consoles
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2021-07-26 11:05 ` [PULL 5/6] ui: update keycodemapdb submodule commit Gerd Hoffmann
@ 2021-07-26 11:05 ` Gerd Hoffmann
  2021-07-27  7:34 ` [PULL 0/6] Fixes 20210726 patches Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Volker Rümelin, Gerd Hoffmann

From: Volker Rümelin <vr_qemu@t-online.de>

Since commit 8eb13bbbac ("ui/gtk: vte: fix sending multiple
characeters") it's very easy to lock up QEMU with the GTK ui.
If you configure a guest with a serial device and the guest
doesn't listen on this device, QEMU will lock up after
entering two characters in the serial console. That's because
current code uses a busy loop for the chardev write retries
and the busy loop doesn't terminate in this case.

To fix this problem add a fifo to the VTE consoles and use the
chr_accept_input() callback function to write the remaining
characters in the queue to the chardev.

The fifo has a size of 4096 bytes, so one can copy and paste
a fairly large URL or file path.

Fixes: 8eb13bbbac ("ui/gtk: vte: fix sending multiple characeters")
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20210725165039.5242-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/ui/gtk.h |  4 ++++
 ui/gtk.c         | 42 +++++++++++++++++++++++++++++++++---------
 2 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index 9516670ebc87..80d6bbd9b5f3 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -25,6 +25,9 @@
 #include "ui/egl-helpers.h"
 #include "ui/egl-context.h"
 #endif
+#ifdef CONFIG_VTE
+#include "qemu/fifo8.h"
+#endif
 
 #define MAX_VCS 10
 
@@ -62,6 +65,7 @@ typedef struct VirtualVteConsole {
     GtkWidget *scrollbar;
     GtkWidget *terminal;
     Chardev *chr;
+    Fifo8 out_fifo;
     bool echo;
 } VirtualVteConsole;
 #endif
diff --git a/ui/gtk.c b/ui/gtk.c
index 18542c763312..974e4dfc0b5b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1640,6 +1640,25 @@ static void gd_vc_adjustment_changed(GtkAdjustment *adjustment, void *opaque)
     }
 }
 
+static void gd_vc_send_chars(VirtualConsole *vc)
+{
+    uint32_t len, avail;
+
+    len = qemu_chr_be_can_write(vc->vte.chr);
+    avail = fifo8_num_used(&vc->vte.out_fifo);
+    if (len > avail) {
+        len = avail;
+    }
+    while (len > 0) {
+        const uint8_t *buf;
+        uint32_t size;
+
+        buf = fifo8_pop_buf(&vc->vte.out_fifo, len, &size);
+        qemu_chr_be_write(vc->vte.chr, (uint8_t *)buf, size);
+        len -= size;
+    }
+}
+
 static int gd_vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
 {
     VCChardev *vcd = VC_CHARDEV(chr);
@@ -1649,6 +1668,14 @@ static int gd_vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
     return len;
 }
 
+static void gd_vc_chr_accept_input(Chardev *chr)
+{
+    VCChardev *vcd = VC_CHARDEV(chr);
+    VirtualConsole *vc = vcd->console;
+
+    gd_vc_send_chars(vc);
+}
+
 static void gd_vc_chr_set_echo(Chardev *chr, bool echo)
 {
     VCChardev *vcd = VC_CHARDEV(chr);
@@ -1688,6 +1715,7 @@ static void char_gd_vc_class_init(ObjectClass *oc, void *data)
     cc->parse = qemu_chr_parse_vc;
     cc->open = gd_vc_open;
     cc->chr_write = gd_vc_chr_write;
+    cc->chr_accept_input = gd_vc_chr_accept_input;
     cc->chr_set_echo = gd_vc_chr_set_echo;
 }
 
@@ -1702,6 +1730,7 @@ static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size,
                          gpointer user_data)
 {
     VirtualConsole *vc = user_data;
+    uint32_t free;
 
     if (vc->vte.echo) {
         VteTerminal *term = VTE_TERMINAL(vc->vte.terminal);
@@ -1721,16 +1750,10 @@ static gboolean gd_vc_in(VteTerminal *terminal, gchar *text, guint size,
         }
     }
 
-    int remaining = size;
-    uint8_t* p = (uint8_t *)text;
-    while (remaining > 0) {
-        int can_write = qemu_chr_be_can_write(vc->vte.chr);
-        int written = MIN(remaining, can_write);
-        qemu_chr_be_write(vc->vte.chr, p, written);
+    free = fifo8_num_free(&vc->vte.out_fifo);
+    fifo8_push_all(&vc->vte.out_fifo, (uint8_t *)text, MIN(free, size));
+    gd_vc_send_chars(vc);
 
-        remaining -= written;
-        p += written;
-    }
     return TRUE;
 }
 
@@ -1747,6 +1770,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
     vc->s = s;
     vc->vte.echo = vcd->echo;
     vc->vte.chr = chr;
+    fifo8_create(&vc->vte.out_fifo, 4096);
     vcd->console = vc;
 
     snprintf(buffer, sizeof(buffer), "vc%d", idx);
-- 
2.31.1



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

* Re: [PULL 0/6] Fixes 20210726 patches
  2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2021-07-26 11:05 ` [PULL 6/6] ui/gtk: add a keyboard fifo to the VTE consoles Gerd Hoffmann
@ 2021-07-27  7:34 ` Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2021-07-27  7:34 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Mon, 26 Jul 2021 at 12:05, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit a2376507f615495b1d16685449ce0ea78c2caf9d:
>
>   Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-07-24 11:04:57 +0100)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/fixes-20210726-pull-request
>
> for you to fetch changes up to 584af1f1d955476aacba3350c4efb5865fc91c09:
>
>   ui/gtk: add a keyboard fifo to the VTE consoles (2021-07-26 10:24:49 +0200)
>
> ----------------------------------------------------------------
> ui: fixes for 6.1
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2021-07-27  7:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 11:05 [PULL 0/6] Fixes 20210726 patches Gerd Hoffmann
2021-07-26 11:05 ` [PULL 1/6] ui/gtk: Fix relative mouse with multiple monitors Gerd Hoffmann
2021-07-26 11:05 ` [PULL 2/6] ui/spice: Use HAVE_SPICE_GL for OpenGL checks Gerd Hoffmann
2021-07-26 11:05 ` [PULL 3/6] ui/egl-headless: Remove a check for CONFIG_OPENGL Gerd Hoffmann
2021-07-26 11:05 ` [PULL 4/6] ui/cocoa: Fix the type of main's argv Gerd Hoffmann
2021-07-26 11:05 ` [PULL 5/6] ui: update keycodemapdb submodule commit Gerd Hoffmann
2021-07-26 11:05 ` [PULL 6/6] ui/gtk: add a keyboard fifo to the VTE consoles Gerd Hoffmann
2021-07-27  7:34 ` [PULL 0/6] Fixes 20210726 patches Peter Maydell

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.