Re: PATCH: Fix "invisible wall" problem with relative mouse mode
- From: "Daniel P. Berrange" <dan berrange com>
- To: Anthony Liguori <anthony codemonkey ws>
- Cc: "Daniel P. Berrange" <berrange redhat com>, gtk-vnc-list gnome org
- Subject: Re: PATCH: Fix "invisible wall" problem with relative mouse mode
- Date: Tue, 24 Feb 2009 15:00:12 +0000
On Tue, Feb 24, 2009 at 08:50:19AM -0600, Anthony Liguori wrote:
> Daniel P. Berrange wrote:
> >On Tue, Feb 24, 2009 at 08:25:33AM -0600, Anthony Liguori wrote:
> >
> >>Daniel P. Berrange wrote:
> >>
> >>>A number of bugs have conspired together to make relative mouse mode not
> >>>work very well. The core problem is that when using the relative mode the
> >>>mouse pointer will appear to hit an "invisible wall" before the true edge
> >>>of the screen.
> >>>
> >>>The problems start occur when we do the mouse grab and fall out from
> >>>that...
> >>>
> >>>- We passed our window as the "confine-to" arg for the gdk_pointer_grab.
> >>> This meant that the client desktop pointer would stop moving /
> >>> generating
> >>> events when we hit the edge of our window. In relative mode we need to
> >>> get continuous events no matter where the pointer is, since we're after
> >>> relative changes, not absolute coords.
> >>>
> >>>
> >>What is supposed to fix this is auto warping. If you detect that you're
> >>close to the edge of the screen, it should warp you toward the center of
> >>the window.
> >>
> >>When I first implemented this, I observed that confining the pointer to
> >>the desktop instead of the window merely made the problem harder to
> >>reproduce. You still stop getting pointer events if the mouse hits the
> >>edge of the screen so under the right circumstances, you'll still hit a
> >>wall.
> >>
> >>The warping was supposed to be the proper fix although apparently it's
> >>not working well enough.
> >>
> >
> >The warping *does* in fact work perfectly, but only if you allow the mouse
> >to move outside the VNC window. So this patch should enable the behaviour
> >you originally intended. If we confined the pointer to just the VNC
> >window, then we would have to change the warping code to watch for hitting
> >the edge of the VNC widget instead of edge of the screen.
> >
> >To test this was actually working, I tweaked the grab so that the local
> >cursor was not hidden while grabbed - this lets you see when it hits
> >the edge and that it warps back away from it
> >
> > if (x == 0) x += 200;
> > if (y == 0) y += 200;
> > if (x == (gdk_screen_get_width(screen) - 1)) x -= 200;
> > if (y == (gdk_screen_get_height(screen) - 1)) y -= 200;
>
> This looks like a bug to me, no? Shouldn't it be using the window
> sizes? I'm not sure what I was thinking with this one...
In this context, x & y are refering to the pointer position relative to
the root window, since they're initialized from
int x = (int)motion->x_root;
int y = (int)motion->y_root;
> If we just changed it to use the window width/height, shouldn't that
> also fix the problem?
If we also changed x & y to be the window-relative instead of root-relative
coords, then yes, that'd probably work too.
Daniel
--
|: http://berrange.com/ -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://freshmeat.net/~danielpb/ -o- http://gtk-vnc.sourceforge.net :|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]