[Spice-devel] [PATCH spice-gtk 2/3] spice-widget: Fix auto-grab on window size change
Hans de Goede
hdegoede at redhat.com
Thu Mar 14 14:32:55 PDT 2013
Commit 8a7e72e3 "widget: regrab when widget is reconfigured" adds an
ungrab + grab call to the configure event handling code. But it does this
without checking if the mouse is grabbed at all, causing an unsolicited
grab in certain scenarios, ie:
1) User boots a vm
2) Connects with remote-viewer
3) Goes and do some web-browsing while the vm boots
4) Mouse happens to hover over the remote-viewer window
5) Guests changes resolution (ie X starts)
6) The mouse is grabbed, and when the user tries to move it to
click something in his web-browser this does not work.
This patch fixes this by checking that the mouse is grabbed before doing
the ungrab + re-grab which is needed to reconfigure the grab to the new window
size / location.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
gtk/spice-widget.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index ff76498..82ec4ff 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1668,8 +1668,10 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
d->mx = conf->x;
d->my = conf->y;
- try_mouse_ungrab(display);
- try_mouse_grab(display);
+ if (d->mouse_grab_active) {
+ try_mouse_ungrab(display);
+ try_mouse_grab(display);
+ }
return true;
}
--
1.8.1.4
More information about the Spice-devel
mailing list