[Spice-devel] [spice-gtk v1] widget: mouse: Fix getting coordinates

Victor Toso victortoso at redhat.com
Fri Feb 22 14:21:45 UTC 2019


Hi,

On Fri, Feb 22, 2019 at 09:06:52AM -0500, Frediano Ziglio wrote:
> > Hi,
> > 
> > On Fri, Feb 22, 2019 at 08:47:42AM -0500, Frediano Ziglio wrote:
> > > > 
> > > > On Tue, Feb 12, 2019 at 04:36:17PM +0000, Victor Toso wrote:
> > > > > From: Victor Toso <me at victortoso.com>
> > > > > 
> > > > > Documentation for gdk_display_get_primary_monitor() says that it
> > > > > returns "the primary monitor, or NULL if no primary monitor is
> > > > > configured by the user".
> > > > > 
> > > > > If monitor endup being NULL, we endup using unitialized GdkRectangle
> > > 
> > > typo: endup -> end up
> > > typo: unitialized -> uninitialized
> > 
> > Ack
> > 
> > > 
> > > > > geom later on as gdk_monitor_get_geometry() will fail with:
> > > > > 
> > > > >  | gdk_monitor_get_geometry: assertion 'GDK_IS_MONITOR (monitor)'
> > > > >  | failed
> > > > > 
> > > > > This patch tries gdk_display_get_monitor_at_point() and will fail if
> > > > > no GdkMonitor is set.
> > > > </ping>
> > > > > 
> > > > > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > > 
> > > Were you be able to reproduce it?
> > 
> > Yes, patch fixes it
> > 
> 
> How? xrandr?

No need to change anything in the guest. Just uses spicy under
wayland and switch to server mode at menu > options > toggle
mouse mode, the warnings will follow.

Ack with the typo fixes then?

Cheers,

> > > > > ---
> > > > >  src/spice-widget.c | 5 +++++
> > > > >  1 file changed, 5 insertions(+)
> > > > > 
> > > > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > > > index 8adcc38..e69b808 100644
> > > > > --- a/src/spice-widget.c
> > > > > +++ b/src/spice-widget.c
> > > > > @@ -1129,6 +1129,11 @@ static void mouse_wrap(SpiceDisplay *display,
> > > > > GdkEventMotion *motion)
> > > > >      GdkWindow *gdk_window =
> > > > >      gtk_widget_get_window(GTK_WIDGET(display));
> > > > >      GdkDisplay *gdk_display = gdk_window_get_display(gdk_window);
> > > > >      GdkMonitor *monitor =
> > > > >      gdk_display_get_primary_monitor(gdk_display);
> > > > > +    if (monitor == NULL) {
> > > > > +        /* No primary monitor set, using last mouse coordinates */
> > > > > +        monitor = gdk_display_get_monitor_at_point(gdk_display,
> > > > > d->mouse_last_x, d->mouse_last_y);
> > > > > +    }
> > > > > +    g_return_if_fail(monitor != NULL);
> > > > >      gdk_monitor_get_geometry(monitor, &geom);
> > > > >  
> > > > >      xr = geom.width / 2;
> > > 
> > > Patch seems good.
> > > 
> > > Frediano
> > 
> > Thanks
> > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190222/6a2ebd2e/attachment.sig>


More information about the Spice-devel mailing list