diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-07-26 20:50:19 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-07-26 20:50:19 +0100 |
commit | 1f3c9c762e2a4eada649393e9527b19e048f3ba7 (patch) | |
tree | 9f2e7287b83328872f48964e3cabadd6041c6887 | |
parent | 76bf66b9136ce373f006f68b0ef4819abc797054 (diff) | |
parent | 584af1f1d955476aacba3350c4efb5865fc91c09 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20210726-pull-request' into staging
ui: fixes for 6.1
# gpg: Signature made Mon 26 Jul 2021 12:05:33 BST
# gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/fixes-20210726-pull-request:
ui/gtk: add a keyboard fifo to the VTE consoles
ui: update keycodemapdb submodule commit
ui/cocoa: Fix the type of main's argv
ui/egl-headless: Remove a check for CONFIG_OPENGL
ui/spice: Use HAVE_SPICE_GL for OpenGL checks
ui/gtk: Fix relative mouse with multiple monitors
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | include/ui/gtk.h | 4 | ||||
-rw-r--r-- | ui/cocoa.m | 4 | ||||
-rw-r--r-- | ui/egl-headless.c | 2 | ||||
-rw-r--r-- | ui/gtk.c | 68 | ||||
m--------- | ui/keycodemapdb | 0 | ||||
-rw-r--r-- | ui/spice-app.c | 3 | ||||
-rw-r--r-- | ui/spice-core.c | 2 |
7 files changed, 49 insertions, 34 deletions
diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 9516670ebc..80d6bbd9b5 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/cocoa.m b/ui/cocoa.m index 9f72844b07..68a6302184 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); diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 75404e0e87..a26a2520c4 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 @@ -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; @@ -1652,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); @@ -1661,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); @@ -1700,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; } @@ -1714,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); @@ -1733,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; } @@ -1759,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); diff --git a/ui/keycodemapdb b/ui/keycodemapdb -Subproject 6119e6e19a050df847418de7babe5166779955e +Subproject d21009b1c9f94b740ea66be8e48a1d8ad812402 diff --git a/ui/spice-app.c b/ui/spice-app.c index 641f4a9d53..7e71e18da9 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 86d43783ac..0371055e6c 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 |