Bug report regarding mouse capturing.

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Ben321
Posts: 32
Joined: 30. Dec 2016, 01:51

Bug report regarding mouse capturing.

Post by Ben321 »

When I run an OS in VBox without Guest Additions, and the mouse type is set to PS2 Mouse, it is supposed to capture the mouse input when I click in the guest OS window. Unfortunately, while it does always recognize mouse input, it only sometimes clips the mouse movement to within the client area of that guest OS window. This means that if I move the mouse far enough, the host OS cursor moves away from the guest OS window and and thus the guest OS window stops receiving input. This can make a guest OS unusable if the cursor responds more slowly in the guest OS than it does in the host OS. Large amounts of mouse movement is required to get the cursor in the guest OS to move a small amount, but the result is that the host OS mouse cursor moves quickly away from the actual guest OS window (at which point the guest OS window stops receiving input from the mouse). This doesn't always happen, but it does sometimes. I'm not sure the actual cause, but I've got an idea on a permanent fix. See my "note to VBox developers" below for the fix.

Note to VBox developers:
I've got a fix for this problem. This fix is applicable to only the WIndows version of VBox, as it depends on a Windows API function. The function you need to be using to force the mouse cursor to be bound by the client region of the guest OS window, is called ClipCursor. Please look into using this function to fix the issue I've described. I've found that in programs I've written that use this function, the host OS mouse cursor cannot spontaneously be released without any reason (as has been happening in VBox at times). The clipping must first be released before the cursor can move freely on the screen, which happens in one specific condition, which is the clipping is explicitly released with another call to ClipCursor (using a null pointer for the function argument) which should happen when the user presses the special key combination to release the cursor.
Post Reply