After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664567 - In VNC absolute pointer mode, mouse clicks don't get released if the cursor escapes the boxes window
In VNC absolute pointer mode, mouse clicks don't get released if the cursor e...
Status: RESOLVED FIXED
Product: gtk-vnc
Classification: Other
Component: general
0.5.x
Other Linux
: Normal major
: ---
Assigned To: gtk-vnc-maint
gtk-vnc-maint
Depends on:
Blocks:
 
 
Reported: 2011-11-22 15:10 UTC by doctorkohaku
Modified: 2013-09-18 11:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description doctorkohaku 2011-11-22 15:10:46 UTC
While connected to a VNC server in absolute pointer mode (qemu -usbdevice tablet), gnome-boxes doesn't detect mouserelease events if the pointer is moved outside the boxes VNC display.

Steps to reproduce:
1. Connect to a VNC server in absolute pointer mode (i.e. qemu -vnc :0 -usbdevice tablet).
2. Open something like a long text file that will give you a scrollbar to play with.
3. Click on the scrollbar and move the mouse cursor outside the gnome-boxes window.
4. Release the mouse button with the pointer outside the gnome-boxes window.
5. Go back inside the gnome-boxes window.
6. The scrollbar will still move, as if the mouse button is still held down.
Expected behaviour: The mouse key should be released and the scrollbar should no longer move.
Comment 1 doctorkohaku 2011-11-22 16:15:55 UTC
seems to be a gtk-vnc bug. happens in vinagre as well.
Comment 2 Marc-Andre Lureau 2012-05-17 23:37:13 UTC
gtk-vnc and spice ungrab the pointer on leave-events, even if the button was pressed.

it might make sense to keep a pointer grab, but that wouldn't allow to drag and drop between monitors easily (unless there is a way to grab a pointer on multiple windows!, which I would be glad to know how if it exists)

spice synchronize and/or release the buttons when entering/moving the widget.

So, gtk-vnc should perhaps do the same.
Comment 3 Daniel P. Berrange 2013-09-17 15:16:00 UTC
GTK takes an automatic grab on the pointer when a button is pressed, so we should continue to receive all events when clicking inside the guest and then moving the mouse outside the widget boundary. Unfortunately, gtk-vnc had a bogus 'leave-notify' event handler which released this automatic GTK grab. I've fixed this broken event handle and so automatic grabs work correctly again.
commit 1344b9270e842ebbafe7c293ff64df0579e73add
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Sep 17 16:11:43 2013 +0100

    Don't ungrab pointer on leave-notify events
    
    If we ungrab the pointer on leave-notify events, this breaks
    the automatic grabs when a button is pressed in absolute pointer.
    A symptom of this is that if you press to start highlighting text
    in a gedit window in a server, and move the mouse outside the VNC
    widget and release the button, the server will never see the mouse
    up event. We must preserve grabs upon button press so that the
    VNC server always sees the eventual release events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664567
    
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>



A second patch was also needed so that we continue to deliver motion events to the client even when outside the widget boundary

commit 645bb94ecb36777c7fca6bedd79d564f6dd3cc00
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Sep 17 16:10:07 2013 +0100

    Don't drop mouse events that are out of bounds
    
    In absolute mode, if the mouse cursor goes outside the bounds
    of the window, we drop the motion event entirely. This is bad
    because only one of the co-ordinates may be out of bounds, and
    the server still wants to see movement in the other axis. Instead
    of dropping the events, just clamp co-ordinates to the boundary.
    
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Comment 4 Daniel P. Berrange 2013-09-18 11:23:28 UTC
Fixed in the 0.5.3 release