Re: PATCH: Fix "invisible wall" problem with relative mouse mode

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...

If we just changed it to use the window width/height, shouldn't that also fix the problem?


Anthony Liguori

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]