[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/7] ui/gtk: fix cursor moved to left corner
From: |
marcandre . lureau |
Subject: |
[PULL 4/7] ui/gtk: fix cursor moved to left corner |
Date: |
Tue, 21 Mar 2023 13:03:31 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Do not attempt to move the pointer if the widget is not yet realized.
The mouse cursor is placed to the corner of the screen, on X11 at least,
as x_root and y_root are then miscalculated. (this is not reproducible
on Wayland, because Gtk doesn't implement device warping there)
This also fixes the following warning at start:
qemu: Gdk: gdk_window_get_root_coords: assertion 'GDK_IS_WINDOW (window)' failed
Fixes: 6effaa16ac98 ("ui: set cursor position upon listener
registration")
Reported-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20230320132624.1612464-1-marcandre.lureau@redhat.com>
---
ui/gtk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index fd82e9b1ca..e9564f2baa 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -450,7 +450,8 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
GdkDisplay *dpy;
gint x_root, y_root;
- if (qemu_input_is_absolute()) {
+ if (!gtk_widget_get_realized(vc->gfx.drawing_area) ||
+ qemu_input_is_absolute()) {
return;
}
--
2.39.2
- [PULL 0/7] ui/ fixes for 8.0, marcandre . lureau, 2023/03/21
- [PULL 1/7] win32: add qemu_close_socket_osfhandle(), marcandre . lureau, 2023/03/21
- [PULL 2/7] ui/spice: fix SOCKET handling regression, marcandre . lureau, 2023/03/21
- [PULL 3/7] ui/dbus: fix passing SOCKET to GSocket API & leak, marcandre . lureau, 2023/03/21
- [PULL 4/7] ui/gtk: fix cursor moved to left corner,
marcandre . lureau <=
- [PULL 5/7] ui: return the default console cursor when con == NULL, marcandre . lureau, 2023/03/21
- [PULL 6/7] ui/sdl2: remove workaround forcing x11, marcandre . lureau, 2023/03/21
- [PULL 7/7] ui: fix crash on serial reset, during init, marcandre . lureau, 2023/03/21
- Re: [PULL 0/7] ui/ fixes for 8.0, Erico Nunes, 2023/03/21
- Re: [PULL 0/7] ui/ fixes for 8.0, Peter Maydell, 2023/03/21