Problem with mouse grabbing
Why does qemu grab the mouse? Sometimes, when it is closing, I will forget to press Ctrl-Shift, and the mouse ends up being unusable.
This got very old in a very short amount of time, so I edited sdl.c to simply "follow" the X mouse pointer, ala VNC-style, and it works. There is a strange bug, but aside from that it works perfectly. I find this more convenient for handling the mouse. My question is: why does qemu grab the mouse pointer instead of just following it? Is this for technical reasons or just because the VM looks nicer that way?
P.S. The strange bug is simply that the virtual mouse pointer moves a little bit faster than the real mouse pointer. It's annoying but still usable, although it does cause the virtual mouse pointer to show up in odd places every now and then.
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
QEMU Needs to grab the mouse because it emulates a real mouse, instead of using a pseudo-mouse driver.
As a result, mouse scaling will always be a problem, since all the user has to do is change the mouse scaling in the host OS to cause problems with the tracking (the scaling problem you noticed.) That's not to mention if the mouse came in somewhere different from where it left. There's nothing to cause the emulated mouse pointer to move to the position where the real one entered the QEMU window.
GREG
Quoted 15 lines · Jim C. Brown
Why does qemu grab the mouse? Sometimes, when it is closing, I will forget to press Ctrl-Shift, and the mouse ends up being unusable.
This got very old in a very short amount of time, so I edited
sdl.cto simply "follow" the X mouse pointer, ala VNC-style, and it works. There is a strange bug, but aside from that it works perfectly. I find this more convenient for handling the mouse. My question is: why does qemu grab the mouse pointer instead of just following it? Is this for technical reasons or just because the VM looks nicer that way?
P.S. The strange bug is simply that the virtual mouse pointer moves a little bit faster than the real mouse pointer. It's annoying but still usable, although it does cause the virtual mouse pointer to show up in odd places every now and then.
Quoted 2 lines · Greg Alexander
QEMU Needs to grab the mouse because it emulates a real mouse, instead of using a pseudo-mouse driver.
I don't follow you here. How would using a pseudo-mouse driver fix it?
Quoted 4 lines
As a result, mouse scaling will always be a problem, since all the user has to do is change the mouse scaling in the host OS to cause problems with the tracking (the scaling problem you noticed.)
There must be some way to detect this. If we did know what the mouse scaling was, this should be easy to compensate for.
Quoted 5 lines
That's not to
mention if the mouse came in somewhere different from where it left. There's nothing to cause the emulated mouse pointer to move to the position where the real one entered the QEMU window.
It does for me, actually. And I didn't deliberately change any code to make it do this, either. It seems to be a side effect.
Quoted 2 lines
GREG
<snip>
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Quoted 6 lines · Jim C. Brown
Quoted 1 line · Greg Alexander
QEMU Needs to grab the mouse because it emulates a real mouse, instead of using a pseudo-mouse driver.
I don't follow you here. How would using a pseudo-mouse driver fix it?
A pseudo-mouse driver for the guest OS would position the guest mouse pointer at the position of the host mouse pointer within the VNC window, instead of using relative mouse movements and pretending to be a real mouse to the guest OS.
Quoted 5 lines
Quoted 1 line
As a result, mouse scaling will always be a problem, since all the user has to do is change the mouse scaling in the host OS to cause problems with the tracking (the scaling problem you noticed.)
There must be some way to detect this. If we did know what the mouse scaling was, this should be easy to compensate for.
If you have that much access to the guest OS, why not just write the pseudo-mouse driver? Of course, there's also the option of adding a "dumb" scaling option to the emulated mouse that is user configurable.
Quoted 6 lines
Quoted 2 lines
That's not to mention if the mouse came in somewhere different from where it left. There's nothing to cause the emulated mouse pointer to move to the position where the real one entered the QEMU window.
It does for me, actually. And I didn't deliberately change any code to make it do this, either. It seems to be a side effect.
I guess if the scaling is accurate and it interprets moving off the screen and then moving back in at another location as a movement from where it left to where it came in, that would take care of the leaving and reentering problems.
GREG
Quoted 2 lines
A pseudo-mouse driver for the guest OS would position the guest mouse pointer at the position of the host mouse pointer within the VNC window, instead of using relative mouse movements and pretending to be a real mouse to the guest OS.
Some pointing devices actually report absolute position as part of their packet stream. Some examples:
- Synaptics Touchpad
- Various PS/2 touchscreen input drivers
- Any USB HID-compliant device can
The first two require a "knocking" protocol to unlock the absolute positioning data. Only the third has built-in support in Windows.
Matt.
begin:vcard
fn:Matthew Mastracci
n:Mastracci;Matthew
org:aclaro Softworks, inc.
adr:;;1900 a - 11 St. SE;Calgary;Alberta;T2H 3G2;Canada email;internet:[email protected]
title:Software Developer
tel;work:(403) 299-6612
x-mozilla-html:FALSE
url:http://www.aclaro.com
version:2.1
end:vcard