ui: fixes for 6.1

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmD+lv0ACgkQTLbY7tPo
 cTjkmhAAre3jMeFq4cCTQFWqYCSHV6NaCMZ+4943QePtn6FGx7Mo/wDAXOnWpVmZ
 HkRJk36ZTU78egfaL+7rVajW2qCN6wa1uvvxrV+IaDF8A2cQwzbdTEqkotNZ3vBM
 C6r6m4Z+Pt8zVUaJHS78Bw5UzI581j39xcsKGK2EPtVir6/nyZRy0JT3c7lmDDEN
 RljAIOC0ajCZEfEir8PV0pl2ycU4IDtjKNLWNjRXwLXVuBuSupdQ1d5GsPZseod7
 DbxGNzsKTzoTbk4BIF67SBEvCdGFyM6aow3mXIdH1kxKZhY2DU/uZib2h8qjts/V
 B+kny114WDlhBCsi+tj33wsUJxLAhFFUVQyWu8gvG28duf9OsbvQ5O/bYtgv428m
 2vZeLpj/ou/a2Xmmae4vPJkEwR9R0fxX25NRWNgvS8d3eAog3Ev2DaUu6FcuWZtl
 X1lchw5qZrrdTqBOxRqCO4ZgcPHTzH4zlq+YdOTND9wICeI0KbE2RtgS6j5vfyW8
 Vk081aUTm/m6R9vKM11eavS9YRUP5tQSaHsaIbC662YgyTYxrm3On6yyFzwA6pK+
 rGL7N3wIeDjcgEvcCsVCCzyS3saTpiAAKFmygNwsuGwX0nGImmKPSfa1gJvsuRGG
 L5CNC5CLi95zepkHX3PDDSIIMMmIT/qTIgeQUCOeP2Sf9shmrRw=
 =Yjvt
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2021-07-26 20:50:19 +01:00
commit 1f3c9c762e
7 changed files with 50 additions and 35 deletions

View File

@ -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

View File

@ -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);

View File

@ -214,6 +214,4 @@ static void register_egl(void)
type_init(register_egl);
#ifdef CONFIG_OPENGL
module_dep("ui-opengl");
#endif

View File

@ -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);

@ -1 +1 @@
Subproject commit 6119e6e19a050df847418de7babe5166779955e4
Subproject commit d21009b1c9f94b740ea66be8e48a1d8ad8124023

View File

@ -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

View File

@ -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