Discussion:
Friendly Mouse Action
David Baron
2007-11-07 18:14:38 UTC
Permalink
Both the Innotek and the Qemu developers might look at a game called Einstein
http://games.glowix.com

The friendly mouse capture can be done without any untoward tricks, it
seems :-)
Dmitry A. Kuminov
2007-11-07 20:28:30 UTC
Permalink
Post by David Baron
Both the Innotek and the Qemu developers might look at a game called Einstein
http://games.glowix.com
The correct link is http://games.flowix.com/en/
Post by David Baron
The friendly mouse capture can be done without any untoward tricks, it
seems :-)
Could you please explain how that applies to VirtualBox and what
untoward tricks you mean?
--
Regards,
Dmitry A. Kuminov
Frans Pop
2007-11-07 20:53:19 UTC
Permalink
Post by Dmitry A. Kuminov
Post by David Baron
Both the Innotek and the Qemu developers might look at a game called
Einstein http://games.glowix.com
The correct link is http://games.flowix.com/en/
Post by David Baron
The friendly mouse capture can be done without any untoward tricks, it
seems :-)
Could you please explain how that applies to VirtualBox
Einstein (one of my favorite games ATM :-) automatically captures and
releases the mouse cursor when the "regular" mouse cursor enters/leaves its
window.

It is indeed a quite nice trick which would mean that you'd no longer have
to click the VM to capture the mouse, or to hit the host key to release it.
It would be similar to what's already done for the keyboard with the "auto
capture keyboard" option.
Personally I think that (if this is implemented) it would still be nice to
have the option to explicitly capture the mouse.

Cheers,
FJP
Dmitry A. Kuminov
2007-11-07 22:07:28 UTC
Permalink
Hello Frans,
Post by Frans Pop
Post by Dmitry A. Kuminov
Post by David Baron
The friendly mouse capture can be done without any untoward tricks, it
seems :-)
Could you please explain how that applies to VirtualBox
Einstein (one of my favorite games ATM :-) automatically captures and
releases the mouse cursor when the "regular" mouse cursor enters/leaves its
window.
This is exactly the same what happens now in VirtualBox once the Guest
Additions are installed onto the guest OS.
Post by Frans Pop
It is indeed a quite nice trick which would mean that you'd no longer have
to click the VM to capture the mouse, or to hit the host key to release it.
It would be similar to what's already done for the keyboard with the "auto
capture keyboard" option.
Yep, I think that everybody agrees that it's the most convenient way for
mouse interaction.

The "problem" here is that VirtualBox virtualizes the conventional PS/2
mouse hardware which converts physical mouse movements to series of
sample steps along the X and Y axes counted with the given frequency.
This gives us relative distance measurement ("how many steps the mouse
has made since the last check") on output.

The above means that VirtualBox cannot simply pass absolute {X,Y}
coordinates it gets from the host OS to the virtual mouse because the
mouse simply doesn't know anything about absolute coordinates. Instead,
VirtualBox has to convert absolute coordinates back to relative distance
numbers (calculated as a difference between the current and the previous
absolute coordinate) and pass these numbers to the virtual mouse which
will then report them to the guest OS as the "number of steps".

It should be mentioned that the "step" is not a pixel from the mouse
point of view; it's just a unit which is usually expressed in fractions
of an inch. The guest OS (the mouse driver) can treat these fractions
differently when mapping them to pixel-based mouse pointer movements.
For this reason it's hardly possible to predict by how many pixels the
guest mouse pointer will move after we feed the virtual mouse with the
given number of steps. Or in other words, w/o a special guest mouse
driver that the VirtualBox GUI front-end can talk directly to, it is
impossible to map host pixels to guest pixels when it comes to mouse
movements.

Subsequently, it means that we cannot just stop feeding the guest with
mouse "steps" when the host mouse pointer reaches one of the borders of
the VM window (and then leaves it) as we don't have a guarantee that the
guest mouse pointer has also reached the edge of the virtual display.

The only solution to overcome the above limitation is to virtualize
different mouse hardware that understands absolute positioning, for
example a tablet device. Needless to say that this will require a tablet
support from the guest OS anyway but I can admit that chances are high
even for old OSes like Windows 98. However, developing such a virtual
device is not a one day task and it isn't planned in the near future AFAIK.

Sorry for this maybe too detailed explanation -- I don't know your
technical skills. Anyway, it may be useful for someone else.
--
Regards,
Dmitry A. Kuminov
David Baron
2007-11-07 20:57:35 UTC
Permalink
Post by Dmitry A. Kuminov
Post by David Baron
Both the Innotek and the Qemu developers might look at a game called
Einstein http://games.glowix.com
The correct link is http://games.flowix.com/en/
Post by David Baron
The friendly mouse capture can be done without any untoward tricks, it
seems :-)
Could you please explain how that applies to VirtualBox and what
untoward tricks you mean?
Qemu: Tries to emulate a USB-tablet (at least in a windows guest). Of course,
Windows needs it drivers available for this and Qemu does not use
guest-additons. So I just use the keystrokes to toggle mouse capture. This is
certainly OK.

VBox: Also has keystrokes. Guest additions not available for Win98, but
sometimes, low and behold, quite spontaneously, friendly mouse capture is
working without even asking. Might stop during the session but works at least
for a while. I cannot reproduce this, it just happens.

In the Einstein game, mouse over the game's window is captured (or more
accurately, followed). When the mouse leaves the window, the "capture"
ceases. My suggestion (I have not looked at the code) is that VBox might work
similarly, without keyboard toggles or dependence on guest-additions.
Frank Mehnert
2007-11-07 21:42:08 UTC
Permalink
Post by David Baron
VBox: Also has keystrokes. Guest additions not available for Win98, but
sometimes, low and behold, quite spontaneously, friendly mouse capture is
working without even asking. Might stop during the session but works at
least for a while. I cannot reproduce this, it just happens.
In the Einstein game, mouse over the game's window is captured (or more
accurately, followed). When the mouse leaves the window, the "capture"
ceases. My suggestion (I have not looked at the code) is that VBox might
work similarly, without keyboard toggles or dependence on guest-additions.
You have to consider the following: If the guest additions are not available,
the guest is not able to receive absolute mouse coordinates, only relative
mouse coordinates --- at least with the mouse VBox is emulating. Therefore
some switch between the host mouse cursor and the guest mouse cursor is
needed. This cannot be done with auto-capturing since the state transition
cannot be that smooth as needed. The real problem is therefore to emulate
a pointing device which supports absolute mouse coordinates.

Kind regards,

Frank
--
Dr.-Ing. Frank Mehnert innotek GmbH, http://www.innotek.de
Dmitry A. Kuminov
2007-11-07 22:17:46 UTC
Permalink
Hello David,

Thank you for explanation.
Post by David Baron
VBox: Also has keystrokes. Guest additions not available for Win98, but
sometimes, low and behold, quite spontaneously, friendly mouse capture is
working without even asking. Might stop during the session but works at least
for a while. I cannot reproduce this, it just happens.
We've already heard about this spontaneous behavior but it actually
looks like a tricky bug in the absolute->relative conversion code in the
VirtualBox sources combined with the fact that for some curious reason
every single mouse step (mickey) is mapped to exactly one pixel on the
guest display by the guest mouse driver.
Post by David Baron
In the Einstein game, mouse over the game's window is captured (or more
accurately, followed). When the mouse leaves the window, the "capture"
ceases. My suggestion (I have not looked at the code) is that VBox might work
similarly, without keyboard toggles or dependence on guest-additions.
Please see my previous reply to Frans Pop in this thread. The Einstein
game is not an example here because all parties work with absolute mouse
coordinates there.
--
Regards,
Dmitry A. Kuminov
Loading...