Contributor
Contributor

"Trapping" mouse within guest operating system

Jump to solution

In past versions of VMWare on other operating systems, I'm sure this was possible but I cannot find out how to do it in VMWare Fusion.

Here is my problem: The default behavior is that when your mouse hits the edge of the guest OS's window, it leaves the window and comes back to the mac's desktop. I am playing a game which scrolls when you hit the edge of the window, and it isn't catching the mouse hitting the edge of the screen when it is leaving the guest OS's window. Therefore, I'd like the mouse to be trapped within the guest OS, so it cannot leave the window meaning the game will be able to scroll correctly.

This happens even in full screen mode, because the game doesn't fill the whole screen.

Many thanks for any help.

0 Kudos
1 Solution

Accepted Solutions
Hot Shot
Hot Shot

Shutdown VMware Tools before you start the game.

View solution in original post

0 Kudos
8 Replies
Hot Shot
Hot Shot

Shutdown VMware Tools before you start the game.

View solution in original post

0 Kudos
Immortal
Immortal

If you want to have tools installed but still trap the mouse within the console window, you can add the following line to the guest's .vmx file while the VM is powered off and Fusion is not running:

pref.motionUngrab = "FALSE"

0 Kudos
Contributor
Contributor

Hi etung,

Thanks for your reply. I think vmware tools gives some useful functions so it would be good to be able to keep most of the functionality.

How do I do this change the setting you mention? I have opened the vmware image as a package, and found a vmx file inside this but I don't know how to edit this file -- when I double click it, it opens vmware and starts up the vm (the vm is suspended rather than powered off if this changes things?).

0 Kudos
Immortal
Immortal

If you want to have tools installed but still trap the mouse within the console window, you can add the following line to the guest's .vmx file while the VM is powered off and Fusion is not running:

pref.motionUngrab = "FALSE"

I tried this and it didn't stop the mouse from slipping past the edge of the Virtual Machines window.

0 Kudos
Immortal
Immortal

I tried this and it didn't stop the mouse from slipping past the edge of the Virtual Machines window.

Hmm, looks like you're right, I need to double check the correct command.

delusional: you need to open the .vmx file in a text editor such as TextEdit. You can do this by running TextEdit, then drag-n-drop the .vmx file on TextEdit's Dock icon (the Dock icon should darken to show you it's a valid target).

0 Kudos
Hot Shot
Hot Shot

I should have gone into more detail. Sorry. You wouldn't have to leave the VMware tools disabled permanently. I would imagine, from what you described, that you wouldn't have to have any of the VMware tools features while the game is running. So you can disable the tools before the game and then start them afterwards. Ordinarily this could take several steps, but here is one way it could be automated.

What OS is the VM by the way? Windows XP perhaps? If so, then a couple of batch files or shortcuts could be run to disable and enable VMware tools. This command will temporarily turn them off:

net stop "vmware tools service"

And, yes, you guessed it, this starts the service back up.

net start "vmware tools service"

You could even create a batch to start your game and do the above two steps automatically. This is a feature you may even want in VMware workstation.

net stop "vmware tools service"

"c:\program files\folder\game.exe" Whatever the path to your game is, see the shortcut.

net start "vmware tools service"

The equivalent could be done in the other OSes that can run VMware tools. Another benefit is that no reboot is required.

Contributor
Contributor

Thanks ClayMon, I didn't realise the tools ran as a normal service (XP is the guest, yes) and, as such, were quite so simple to start/stop. As I'm only using the guest OS for the game right now, I've simply removed the tools.

Do the tools offer any services I might want whilst running a game, so not having them at all might be unwise?

0 Kudos
Hot Shot
Hot Shot

Thanks ClayMon, I didn't realise the tools ran as a normal service (XP is the guest, yes) and, as such, were quite so simple to start/stop. As I'm only using the guest OS for the game right now, I've simply removed the tools.

Do the tools offer any services I might want whilst running a game, so not having them at all might be unwise?<div>


I don't think so. Unless you want to copy some text to the clipboard, I don't think you'll want, or need, any of the other functions during game play. Time sync isn't needed in XP. You won't be shrinking any disks. The NIC and video drivers will already be installed, and I don't think you will be changing desktop resolution either.




You probably already know this, but if you use a batch similar to what I posted eariler, it may be necessary to launch the game with:




start /wait "" "c:\program files\folder\game.exe"




The above will wait for the game to finish before going back to starting the service again. The doubled quotes are to prevent a bug, I mean feature, from just leaving a CMD prompt open, instead of the game.



0 Kudos