From 0095cc62b6803d5e2cb8cb27e5b14657d9dc0c95 Mon Sep 17 00:00:00 2001 From: Fabian Lesniak Date: Tue, 6 Dec 2016 20:00:05 +0100 Subject: [PATCH 01/11] qapi: add support for mice with extra/side buttons Adds "side" and "extra" values to enum InputButton. The naming was borrowed from evdev since it is more descriptive than "button4" and "button5". Signed-off-by: Fabian Lesniak Message-id: 20161206190007.7539-2-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann --- qapi-schema.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qapi-schema.json b/qapi-schema.json index 82fabc6e24..cbdffddbc6 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5390,10 +5390,15 @@ # # Button of a pointer input device (mouse, tablet). # +# @side: front side button of a 5-button mouse (since 2.9) +# +# @extra: rear side button of a 5-button mouse (since 2.9) +# # Since: 2.0 ## { 'enum' : 'InputButton', - 'data' : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down' ] } + 'data' : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side', + 'extra' ] } ## # @InputAxis: From 8b0caab07bf0056f44b52eb335faa45f07b7e1a6 Mon Sep 17 00:00:00 2001 From: Fabian Lesniak Date: Tue, 6 Dec 2016 20:00:06 +0100 Subject: [PATCH 02/11] ps2: add support for mice with extra/side buttons This enables the ps2 controller to process mouse events for buttons 4 and 5. Additionally, distinct definitions for the ps2 mouse button state are introduced. The legacy definitions from console.h are not used anymore. Signed-off-by: Fabian Lesniak Message-id: 20161206190007.7539-3-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann --- hw/input/ps2.c | 8 +++++--- include/hw/input/ps2.h | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 8485a4edaf..1d3a440bbd 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -881,9 +881,11 @@ static void ps2_mouse_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { static const int bmap[INPUT_BUTTON__MAX] = { - [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON, - [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON, - [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, + [INPUT_BUTTON_LEFT] = PS2_MOUSE_BUTTON_LEFT, + [INPUT_BUTTON_MIDDLE] = PS2_MOUSE_BUTTON_MIDDLE, + [INPUT_BUTTON_RIGHT] = PS2_MOUSE_BUTTON_RIGHT, + [INPUT_BUTTON_SIDE] = PS2_MOUSE_BUTTON_SIDE, + [INPUT_BUTTON_EXTRA] = PS2_MOUSE_BUTTON_EXTRA, }; PS2MouseState *s = (PS2MouseState *)dev; InputMoveEvent *move; diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index b9ceee4154..0fec91cdb0 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -25,6 +25,12 @@ #ifndef HW_PS2_H #define HW_PS2_H +#define PS2_MOUSE_BUTTON_LEFT 0x01 +#define PS2_MOUSE_BUTTON_MIDDLE 0x02 +#define PS2_MOUSE_BUTTON_RIGHT 0x04 +#define PS2_MOUSE_BUTTON_SIDE 0x08 +#define PS2_MOUSE_BUTTON_EXTRA 0x10 + /* ps2.c */ void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); From 1266b68c6e3af7f7bd53edcba1ee12cec07cdefe Mon Sep 17 00:00:00 2001 From: Fabian Lesniak Date: Tue, 6 Dec 2016 20:00:07 +0100 Subject: [PATCH 03/11] ui: add support for mice with extra/side buttons Adds input event generation for BTN_SIDE and BTN_EXTRA events to gtk and input-linux methods. Signed-off-by: Fabian Lesniak Message-id: 20161206190007.7539-4-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 4 ++++ ui/input-linux.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index bdd831c268..3f67a345d1 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1007,6 +1007,10 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button, btn = INPUT_BUTTON_MIDDLE; } else if (button->button == 3) { btn = INPUT_BUTTON_RIGHT; + } else if (button->button == 8) { + btn = INPUT_BUTTON_SIDE; + } else if (button->button == 9) { + btn = INPUT_BUTTON_EXTRA; } else { return TRUE; } diff --git a/ui/input-linux.c b/ui/input-linux.c index f345317794..ac31f47719 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -291,6 +291,12 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event) qemu_input_queue_btn(NULL, INPUT_BUTTON_WHEEL_DOWN, event->value); break; + case BTN_SIDE: + qemu_input_queue_btn(NULL, INPUT_BUTTON_SIDE, event->value); + break; + case BTN_EXTRA: + qemu_input_queue_btn(NULL, INPUT_BUTTON_EXTRA, event->value); + break; }; break; case EV_REL: From a54f0d2ba3094ca43e85a465c7c4ae58c589efc4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Jan 2017 17:14:02 +0100 Subject: [PATCH 04/11] vnc: track LED state separately Piggy-backing on the modifier state array made it difficult to send out updates at the proper times. Signed-off-by: Pierre Ossman Message-id: 5aa28297d665cee24ddab26bbf4633e4252f97b6.1483978442.git.ossman@cendio.se Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 59 +++++++++++++++----------------------------------------- ui/vnc.h | 3 ++- 2 files changed, 18 insertions(+), 44 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 29aa9c4c97..cf9b597d1d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1231,8 +1231,6 @@ void vnc_disconnect_finish(VncState *vs) vnc_update_server_surface(vs->vd); } - if (vs->vd->lock_key_sync) - qemu_remove_led_event_handler(vs->led); vnc_unlock_output(vs); qemu_mutex_destroy(&vs->output_mutex); @@ -1665,69 +1663,39 @@ static void press_key(VncState *vs, int keysym) qemu_input_event_send_key_delay(vs->vd->key_delay_ms); } -static int current_led_state(VncState *vs) -{ - int ledstate = 0; - - if (vs->modifiers_state[0x46]) { - ledstate |= QEMU_SCROLL_LOCK_LED; - } - if (vs->modifiers_state[0x45]) { - ledstate |= QEMU_NUM_LOCK_LED; - } - if (vs->modifiers_state[0x3a]) { - ledstate |= QEMU_CAPS_LOCK_LED; - } - - return ledstate; -} - static void vnc_led_state_change(VncState *vs) { - int ledstate = 0; - if (!vnc_has_feature(vs, VNC_FEATURE_LED_STATE)) { return; } - ledstate = current_led_state(vs); vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, 0, 0, 1, 1, VNC_ENCODING_LED_STATE); - vnc_write_u8(vs, ledstate); + vnc_write_u8(vs, vs->vd->ledstate); vnc_unlock_output(vs); vnc_flush(vs); } static void kbd_leds(void *opaque, int ledstate) { - VncState *vs = opaque; - int caps, num, scr; - bool has_changed = (ledstate != current_led_state(vs)); + VncDisplay *vd = opaque; + VncState *client; trace_vnc_key_guest_leds((ledstate & QEMU_CAPS_LOCK_LED), (ledstate & QEMU_NUM_LOCK_LED), (ledstate & QEMU_SCROLL_LOCK_LED)); - caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0; - num = ledstate & QEMU_NUM_LOCK_LED ? 1 : 0; - scr = ledstate & QEMU_SCROLL_LOCK_LED ? 1 : 0; - - if (vs->modifiers_state[0x3a] != caps) { - vs->modifiers_state[0x3a] = caps; - } - if (vs->modifiers_state[0x45] != num) { - vs->modifiers_state[0x45] = num; - } - if (vs->modifiers_state[0x46] != scr) { - vs->modifiers_state[0x46] = scr; + if (ledstate == vd->ledstate) { + return; } - /* Sending the current led state message to the client */ - if (has_changed) { - vnc_led_state_change(vs); + vd->ledstate = ledstate; + + QTAILQ_FOREACH(client, &vd->clients, next) { + vnc_led_state_change(client); } } @@ -3087,8 +3055,6 @@ void vnc_start_protocol(VncState *vs) vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); - if (vs->vd->lock_key_sync) - vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); @@ -3195,6 +3161,9 @@ static void vnc_display_close(VncDisplay *vd) } g_free(vd->tlsaclname); vd->tlsaclname = NULL; + if (vd->lock_key_sync) { + qemu_remove_led_event_handler(vd->led); + } } int vnc_display_password(const char *id, const char *password) @@ -3762,6 +3731,10 @@ void vnc_display_open(const char *id, Error **errp) } #endif vd->lock_key_sync = lock_key_sync; + if (lock_key_sync) { + vd->led = qemu_add_led_event_handler(kbd_leds, vd); + } + vd->ledstate = 0; vd->key_delay_ms = key_delay_ms; device_id = qemu_opt_get(opts, "display"); diff --git a/ui/vnc.h b/ui/vnc.h index d20b154a77..d8c9de5a75 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -154,6 +154,8 @@ struct VncDisplay DisplayChangeListener dcl; kbd_layout_t *kbd_layout; int lock_key_sync; + QEMUPutLEDEntry *led; + int ledstate; int key_delay_ms; QemuMutex mutex; @@ -304,7 +306,6 @@ struct VncState size_t read_handler_expect; /* input */ uint8_t modifiers_state[256]; - QEMUPutLEDEntry *led; bool abort; QemuMutex output_mutex; From e229d1efd7323504f90127bbf52e63f4773dc382 Mon Sep 17 00:00:00 2001 From: OGAWA Hirofumi Date: Thu, 5 Jan 2017 05:41:16 +0900 Subject: [PATCH 05/11] ui/gtk: Fix mouse wheel on 3.4.0 or later On 3.4.0 or later, send GDK_SCROLL_SMOOTH event, instead of GDK_SCROLL_UP/DOWN. This fixes it by converting any smooth scroll to up/down. (I.e. without smooth support) Signed-off-by: OGAWA Hirofumi Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 3f67a345d1..2f81863cb5 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1031,6 +1031,19 @@ static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll, btn = INPUT_BUTTON_WHEEL_UP; } else if (scroll->direction == GDK_SCROLL_DOWN) { btn = INPUT_BUTTON_WHEEL_DOWN; +#if GTK_CHECK_VERSION(3, 4, 0) + } else if (scroll->direction == GDK_SCROLL_SMOOTH) { + gdouble delta_x, delta_y; + if (!gdk_event_get_scroll_deltas((GdkEvent *)scroll, + &delta_x, &delta_y)) { + return TRUE; + } + if (delta_y > 0) { + btn = INPUT_BUTTON_WHEEL_DOWN; + } else { + btn = INPUT_BUTTON_WHEEL_UP; + } +#endif } else { return TRUE; } From 6b557d7c933442377de59b71d0d82c3ccba68b2e Mon Sep 17 00:00:00 2001 From: Rami Rosen Date: Tue, 10 Jan 2017 11:19:25 +0200 Subject: [PATCH 06/11] ui: fix format specfier in vnc to avoid break in build. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building qemu after setting _VNC_DEBUG to 1 (see ui/vnc.h), we get the following error and the build breaks: ... ui/vnc.c: In function ‘vnc_client_io_error’: ui/vnc.c:1262:13: error: format ‘%d’ expects argument of type ‘int’, but VNC_DEBUG("Closing down client sock: ret %d (%s)\n", ^ cc1: all warnings being treated as errors make: *** [ui/vnc.o] Error 1 ... This patch solves this issue by fixing the print format specifier in vnc_client_io_error() to be %zd, which corresponds to the type of the "ret" variable. Signed-off-by: Rami Rosen Message-id: 1484039965-25907-1-git-send-email-rami.rosen@intel.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index cf9b597d1d..6854fdb02f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1257,7 +1257,7 @@ ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp) if (ret == 0) { VNC_DEBUG("Closing down client sock: EOF\n"); } else if (ret != QIO_CHANNEL_ERR_BLOCK) { - VNC_DEBUG("Closing down client sock: ret %d (%s)\n", + VNC_DEBUG("Closing down client sock: ret %zd (%s)\n", ret, errp ? error_get_pretty(*errp) : "Unknown"); } From 66f6b82bf26cc15e33a39390844035d017102902 Mon Sep 17 00:00:00 2001 From: Ziyue Yang Date: Tue, 31 Jan 2017 09:32:15 +0800 Subject: [PATCH 07/11] ui/gtk.c: add ctrl-alt-= support for zoom in acceleration Solving wishlist item at https://bugs.launchpad.net/qemu/+bug/1656710 by accepting Ctrl-Alt-= as an additional zoom-in acceleration. Using gtk_accel_group_connect to support multiple accelerations triggering a single menu item since that gtk_accel_map_add_entry seems to support only one acceleration. A wrapper function gd_accel_zoom_in is added to support gtk_accel_group_connect's callback activities. Signed-off-by: Ziyue Yang Message-id: 1485826335-15686-1-git-send-email-skiver.cloud.yzy@gmail.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 2f81863cb5..b734c0b16e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -105,6 +105,7 @@ #define GDK_KEY_g GDK_g #define GDK_KEY_q GDK_q #define GDK_KEY_plus GDK_plus +#define GDK_KEY_equal GDK_equal #define GDK_KEY_minus GDK_minus #define GDK_KEY_Pause GDK_Pause #define GDK_KEY_Delete GDK_Delete @@ -1342,6 +1343,12 @@ static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque) gd_update_windowsize(vc); } +static void gd_accel_zoom_in(void *opaque) +{ + GtkDisplayState *s = opaque; + gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_in_item)); +} + static void gd_menu_zoom_out(GtkMenuItem *item, void *opaque) { GtkDisplayState *s = opaque; @@ -2109,6 +2116,8 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s) "/View/Zoom In"); gtk_accel_map_add_entry("/View/Zoom In", GDK_KEY_plus, HOTKEY_MODIFIERS); + gtk_accel_group_connect(s->accel_group, GDK_KEY_equal, HOTKEY_MODIFIERS, 0, + g_cclosure_new_swap(G_CALLBACK(gd_accel_zoom_in), s, NULL)); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_in_item); s->zoom_out_item = gtk_menu_item_new_with_mnemonic(_("Zoom _Out")); From 51e0b654539d587f09fc23074d1ae2a9c7747b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 30 Jan 2017 14:45:40 +0400 Subject: [PATCH 08/11] spice: wakeup QXL worker to pick up mouse changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without it, server-mode mouse is "slow" to update position: QXL will wait until new display commands come. This is very visible with virtio-gpu. Signed-off-by: Marc-André Lureau Message-id: 20170130104540.14660-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/spice-display.c b/ui/spice-display.c index 5e6f78a219..64e472eeb0 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -769,6 +769,7 @@ static void display_mouse_set(DisplayChangeListener *dcl, g_free(ssd->ptr_move); ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on); qemu_mutex_unlock(&ssd->lock); + qemu_spice_wakeup(ssd); } static void display_mouse_define(DisplayChangeListener *dcl, @@ -787,6 +788,7 @@ static void display_mouse_define(DisplayChangeListener *dcl, g_free(ssd->ptr_define); ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0); qemu_mutex_unlock(&ssd->lock); + qemu_spice_wakeup(ssd); } static const DisplayChangeListenerOps display_listener_ops = { From eebe0b7905642a986cbce7406d6ab7bf78f3e210 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 24 Jan 2017 10:00:28 +0100 Subject: [PATCH 09/11] vnc: fix overflow in vnc_update_stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit "bea60dd ui/vnc: fix potential memory corruption issues" is incomplete. vnc_update_stats must calculate width and height the same way vnc_refresh_server_surface does it, to make sure we don't use width and height values larger than the qemu vnc server can handle. Commit "e22492d ui/vnc: disable adaptive update calculations if not needed" masks the issue in the default configuration. It triggers only in case the "lossy" option is set to "on" (default is "off"). Cc: Marc-André Lureau Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-id: 1485248428-575-1-git-send-email-kraxel@redhat.com --- ui/vnc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 6854fdb02f..cdeb79c3cc 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2724,8 +2724,10 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y) static int vnc_update_stats(VncDisplay *vd, struct timeval * tv) { - int width = pixman_image_get_width(vd->guest.fb); - int height = pixman_image_get_height(vd->guest.fb); + int width = MIN(pixman_image_get_width(vd->guest.fb), + pixman_image_get_width(vd->server)); + int height = MIN(pixman_image_get_height(vd->guest.fb), + pixman_image_get_height(vd->server)); int x, y; struct timeval res; int has_dirty = 0; From 27b224a61f97faabbd20bdf72c0c1a3dbe400cd1 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 31 Jan 2017 11:09:45 +0100 Subject: [PATCH 10/11] gtk: Hardcode LC_CTYPE as C.utf-8 Commit 2cb5d2a4 removed setlocale() for everything except LC_MESSAGES in order to avoid unwanted side effects such as using the wrong decimal separator in generated JSON objects. However, the problem that unsetting LC_CTYPE caused is that non-ASCII characters are considered non-printable now and therefore the GTK menus display question marks for accented letters, Chinese characters etc. A first attempt to fix this [1] was rejected because even just setting LC_CTYPE to the user's locale (and thereby modifying the semantics of the ctype.h functions) could have unwanted effects that we're not aware of yet. Recently, however, glibc introduced a new locale "C.utf-8" that just uses UTF-8 as its charset, but otherwise leaves the semantics alone. Just setting the right character set is enough for our use case, so we can just hardcode this one without having to be afraid of nasty side effects. Older systems that don't have the new locale will continue displaying question marks, but this should fix the problem for most users. [1] https://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03591.html ('Re: gtk: use setlocale() for LC_MESSAGES only') Signed-off-by: Kevin Wolf Message-id: 20170131100945.8189-1-kwolf@redhat.com [ kraxel: change C.utf-8 to C.UTF-8 ] Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index b734c0b16e..ca50772749 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2258,8 +2258,12 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) s->free_scale = FALSE; - /* LC_MESSAGES only. See early_gtk_display_init() for details */ + /* Mostly LC_MESSAGES only. See early_gtk_display_init() for details. For + * LC_CTYPE, we need to make sure that non-ASCII characters are considered + * printable, but without changing any of the character classes to make + * sure that we don't accidentally break implicit assumptions. */ setlocale(LC_MESSAGES, ""); + setlocale(LC_CTYPE, "C.UTF-8"); bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR); textdomain("qemu"); From 3ef0c573d37b117867352a8bd8c567d3b774fe37 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 24 Jan 2017 12:10:39 +0100 Subject: [PATCH 11/11] console: fix console resize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only skip surface reallocation in case the old surface was created using qemu_alloc_display (via qemu_create_displaysurface) too, otherwise we might end up with a DisplaySurface with the wrong backing storage. Cc: 1658634@bugs.launchpad.net Fixes: cd958edb1fae85d0c7d1e1acbff82d22724e8d64 Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Tested-by: Laszlo Ersek Message-id: 1485256239-12219-1-git-send-email-kraxel@redhat.com --- ui/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/console.c b/ui/console.c index fe03a666f7..e353c85681 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2116,7 +2116,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height) assert(s->console_type == GRAPHIC_CONSOLE); - if (s->surface && + if (s->surface && (s->surface->flags & QEMU_ALLOCATED_FLAG) && pixman_image_get_width(s->surface->image) == width && pixman_image_get_height(s->surface->image) == height) { return;