[Spice-commits] 3 commits - gtk/spice-widget.c
Hans de Goede
jwrdegoede at kemper.freedesktop.org
Fri Mar 15 01:40:43 PDT 2013
gtk/spice-widget.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 91ceac03ee48aa90ad2f50d08d1f47ec2c7b3e63
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Mar 14 22:26:55 2013 +0100
spice-widget: Reconfiguring the grab is only needed on win32
Commit 8a7e72e3 "widget: regrab when widget is reconfigured" adds an
ungrab + grab call to the configure event handling code. Because:
"On Windows, we need to update the cursor clip. Call ungrab&grab to update it."
But on X11 this is not needed, see man XGrabPointer, which explains that
the grab automatically adjusts to window resizing.
Not only is it not needed it is also racy, causing spice-gtk based
apps to log messages like:
(remote-viewer:9935): GSpice-WARNING **: pointer grab failed 3
This patch fixes this by disabling the ungrab + re-grab on non-win32.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 2469bde..fb8094e 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1668,10 +1668,12 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
d->mx = conf->x;
d->my = conf->y;
+#ifdef WIN32
if (d->mouse_grab_active) {
try_mouse_ungrab(display);
try_mouse_grab(display);
}
+#endif
return true;
}
commit 8eed3c52693be3be4303684630c1f8c1bfd522e4
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Mar 14 22:20:11 2013 +0100
spice-widget: Fix auto-grab on window size change
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>
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 7ae05cd..2469bde 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;
}
commit 604ab8bad28169a7351c100d87dc9f1e0e203422
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Mar 14 21:45:25 2013 +0100
spice-widget: Ignore duplicate configure events
gtk seems to be sending us identical / repeated configure events quite
regularly (atleast under X11), we don't care about re-configures with the
same size + coordinates, so filter these out.
Note this patch uses the SpiceDisplayPrivate mx and my members which
were already defined to store the window position, but not yet used.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 42d0cdd..7ae05cd 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1654,12 +1654,20 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
SpiceDisplay *display = SPICE_DISPLAY(widget);
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+ if (conf->width == d->ww && conf->height == d->wh &&
+ conf->x == d->mx && conf->y == d->my) {
+ return true;
+ }
+
if (conf->width != d->ww || conf->height != d->wh) {
d->ww = conf->width;
d->wh = conf->height;
recalc_geometry(widget);
}
+ d->mx = conf->x;
+ d->my = conf->y;
+
try_mouse_ungrab(display);
try_mouse_grab(display);
More information about the Spice-commits
mailing list