VirtualBox

Changes between Version 9 and Version 10 of MouseInput


Ignore:
Timestamp:
Dec 14, 2017 7:04:56 AM (6 years ago)
Author:
Michael Thayer
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MouseInput

    v9 v10  
    77This page gives a quick overview of the way (or ways) in which mouse input to virtual machines works in !VirtualBox and some ways to get a closer look at what is happening in order to understand when things go wrong.  Please feel free to suggest improvements!
    88
    9 == General flow of mouse input == #General
     9== How mouse input reaches guest systems == #General
     10
     11In order to let the user control the guest system with the host input devices, !VirtualBox emulates input devices inside the virtual machine.  The simplest case is when the host pointer is captured and !VirtualBox is only emulating a standard (PS/2 or USB) mouse.  In this case, when the user moves the host pointer to the left, !VirtualBox simulates left movement on the emulated mouse, and when the user clicks the right button a right button click is simulated on the guest mouse.
     12
     13When mouse integration is enabled, this becomes slightly more complicated.  !VirtualBox emulates a graphics tablet (similar to a touch screen), which can send exact positions instead of just "left", "right", "up", "down".  Unfortunately these positions are not in pixels on the screen, but in percentages - e.g. 56 percent along the X axis from the left to the right edge and 73 percent along the Y axis from the top to the bottom edge.  For this to work correctly, the guest and the host have to agree about which positions on the tablet correspond to which positions on the guest screens - e.g. virtual screen one might go from 0 to 50 percent along the X axis and from 0 to 100 on the Y axis, while virtual screen two might go from 50 to 100 on X and also from 0 to 100 on Y.  This corresponds to screen two laid out to the right of screen one, with the right edge of screen one exactly matching the left edge of screen two.  If host and guest agree about this layout then mouse integration can work.  Otherwise the position of clicks in the guest will not correctly match the pointer location.
     14
     15This is further complicate by the fact that for historical reasons (i.e. it seemed like a good idea at the time), the Guest Additions input device sends position information but not button information.  So it needs to be used in conjunction with another device which can send the button information (this can actually happen on physical laptops too, which multiple touch pad and touch point devices and various sets of buttons), and the two can get very slightly out of synchronisation, causing strange effects.  This will be fixed as soon as there is nothing else more important needing fixing, which is not likely to happen for a long time.  This does not happen when using the emulated USB graphics tablet device, which also has buttons, but that device does not always map well to multiple guest screens.
     16
     17== General flow of mouse input == #Flow
    1018
    1119Like many things in !VirtualBox, mouse input follows a chain which starts at the "front-end" - usually the !VirtualBox application window which displays the virtual machine, or the built-in remote desktop server - and works its way through to the guest operating system which sees the input through virtual devices using native or !VirtualBox guest drivers.  If something is going wrong then getting as much information as possible about what is happening at each point in the chain is a good way of finding out more.

© 2023 Oracle
ContactPrivacy policyTerms of Use