[vbox-dev] mouse integration concept level overview?

Michael Thayer michael.thayer at oracle.com
Tue Sep 6 19:19:02 GMT 2011


Hello Huihong,

On Tue, 2011-09-06 at 10:25 -0700, Huihong Luo wrote:
> I noted that Windows additions (vboxmouse.sys and VBoxMouseNT.sys)
> doesn't perform any conversion from this 0-FFFF percentange
> coordinates, however X11 additions convert them to screen resolution.
> Does Windows happen to use the same measurement of 0-0xFFFF ?
Yes, since we originally only supported Windows as a guest the Additions
and Host-to-Guest protocol were originally designed to work comfortably
with Windows.  Note that X.Org has evolved/improved quite a bit over the
years - if you look at vboxmouse_15.c, which supports a range of
different "vintages" of X.Org, you will see that the older ones require
us to manually convert the values we read to pixel offsets, whereas the
newest let us specify the range of values we return and take care of all
the conversion for us.  (With an off-by-half pixel error unfortunately
which we have to work around in the host code, but such is life.)
 
> Another thing is that the cursor shape at pointer disppears when
> moving out of vm guest window, does virtualbox perform some special
> task to make the curson not to appear? or the host simply reports some
> out of range positions to the guest. I was curious how this is
> handled.
When mouse integration is enabled the software guest cursor is hidden,
and instead the host cursor tracks the shape that the guest cursor would
have.  From the point of view of the Additions we are providing a
hardware cursor (most graphics cards provide a hardware sprite for this
purpose), and it is telling us where it should be and what shape it
should be.  And obviously when the host pointer is not above the guest
window it simply takes on the shape requested by whatever other host
application it moves over next.

Of course, since we don't let the guest move the host cursor this only
works if the guest wants it to be where it is already, but since our
input driver is providing the position data this usually works.

Regards,

Michael

> --- On Fri, 9/2/11, Michael Thayer <michael.thayer at oracle.com> wrote:
> 
> 
> From: Michael Thayer <michael.thayer at oracle.com>
> Subject: Re: [vbox-dev] mouse integration concept level overview?
> To: "Huihong Luo" <huisinro at yahoo.com>
> Cc: vbox-dev at virtualbox.org
> Date: Friday, September 2, 2011, 1:47 PM
> 
> 
> Hello Huihong,
> 
> On Thu, 2011-09-01 at 20:56 -0700, Huihong Luo wrote:
> > I need to know a bit more about the mouse integration. Can someone explain in big picture on what happened when a mouse pointer is moving from host to the guest? once the mouse inside the guest window, host informs the guest about the mouse positions? etc.
> >  
> > I need to get some ideas on this in order to implement the drag-and-drop feature for vbox. Right now, it's stuck when the mouse is dragged from host to vm, how the guest side knows about that. I need to press a key for now to tell the guest side, so the dnd isn't smooth yet. A good understanding on mouse integration would be very helpful.
> > _______________________________________________ vbox-dev mailing list vbox-dev at virtualbox.org http://vbox.innotek.de/mailman/listinfo/vbox-dev
> 
> I'm afraid that this will be a quick-ish explanation for now.  When
> absolute pointer reporting is enabled (see the VMMDevReq_GetMouseStatus
> VMM device request) the current pointer position can be requested with
> the VMMDevReqMousePointer request.  This is reported as a percentage of
> the width and height (respectively) of the guest screen - expressed as a
> value from 0 to 0xFFFF - or of the virtual desktop for multi-monitor
> guests.  The host works out what percentage values correspond to the
> position of the host pointer relative to the host window the machine is
> running in, and the Additions report the position back to the guest in a
> way that the guest OS can convert to the correct pixel offset.  The host
> sends a VMM device event (basically an interrupt and a data word) when
> absolute reporting is enabled or disabled and when new position data is
> available.
> 
> Hope that helps a bit.
> 
> Regards,
> 
> Michael

-- 
ORACLE Deutschland B.V. & Co. KG   Michael Thayer
Werkstrasse 24                     VirtualBox engineering
71384 Weinstadt, Germany           mailto:michael.thayer at oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven





More information about the vbox-dev mailing list