NattyNarwhal / vmwmouse

VMware mouse driver for Windows 3.1
335 stars 13 forks source link

Hide cursor when mouse leaves the VM #14

Open NattyNarwhal opened 2 years ago

NattyNarwhal commented 2 years ago

Is this something in the flags (high word of EAX) we're missing out on?

supercomputer7 commented 2 years ago

I don't know if you ask this as you open this for a discussion, but as far as I know, the VMMouse protocol doesn't support such case. You might be able to check if the mouse is very near the corner of the screen or something like that and have timeout to hide the cursor. I also looked in the source code of QEMU 5.2.0 for vmmouse and didn't see evidence for such scenario.

NattyNarwhal commented 2 years ago

I guess it could check if BX/CX are 0 or FFFFh, though not sure if that's wise (i.e. it's on the edge). I'm unsure if there's an event sent to the VM on cursor exit, and I'm also unsure what the high word of EAX is; klange in OSDev documents it as a thing, but I've never seen anything check it nor does QEMU send it....

supercomputer7 commented 2 years ago

As far as I know there is no event being sent when the cursor exits the VM window. Even if VMWare actually supports such thing, I really don’t think it worth the hard work of debugging it with VMWare. Also, if QEMU is not supporting this, it will be very VMWare-specific feature. Not a good idea probably.

NattyNarwhal commented 2 years ago

Yeah, I agree. I was just curious what those flags were, and the fact it seems modern vmtools (well, and the tablet) seem to do this.

supercomputer7 commented 2 years ago

Yeah, I agree. I was just curious what those flags were, and the fact it seems modern vmtools (well, and the tablet) seem to do this.

It could be that the vmtools code is able to do so via an extension through the VMWare backdoor. Might be interesting project to learn more about this, you could also leverage this to automatically set the resolution when the user changes the window size of the VM monitor.

NattyNarwhal commented 2 years ago

Well, Windows 3.x display drivers are fixed resolution - you have to restart Windows and I believe swap the driver to actually change resolution...

supercomputer7 commented 2 years ago

Well, Windows 3.x display drivers are fixed resolution - you have to restart Windows and I believe swap the driver to actually change resolution...

I don’t know much about Windows 3.1 driver model but if that’s the case then I definitely won’t bother to try implementing that. And even the fact that you wrote a vmmouse driver for such old OS is both unexpected and brilliant and I wouldn’t expect from you to implement features like changing resolution dynamically or “knowing” if the mouse is not in the VM window.