GNOME Bugzilla – Bug 664567
In VNC absolute pointer mode, mouse clicks don't get released if the cursor escapes the boxes window
Last modified: 2013-09-18 11:23:28 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.
seems to be a gtk-vnc bug. happens in vinagre as well.
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.
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>
Fixed in the 0.5.3 release