jeffpar / pcjs.v1

PCjs Machines 1.0 (archived)
https://github.com/jeffpar/pcjs.org
GNU General Public License v3.0
474 stars 92 forks source link

Host's mouse stops working properly on high DPI screens #51

Closed MarkJeronimus closed 6 years ago

MarkJeronimus commented 7 years ago

When the mouse is captured by the virtual machine, when the host machine has high DPI (in my case 200%) the relative mouse movements are calculated improperly, causing the cursor to wander to the top-left and making it hard to move the mouse right or down.

The mechanism is as follows: Every time the mouse moves, it's deviation from center is recorded, then the mouse is moved back to the center. however, in my case when I move the mouse right or down a pixel (on my screen) it records 0.5 logical pixels, which rounds down to 0. When I move the mouse smoothly with a low enough velocity that all movements are 0.5 pixels, the VM mouse doesn't move at all. Conversely, when I move the mouse left or up 0.5 pixels, it moves at double the speed in the VM.

jeffpar commented 7 years ago

Can you provide the URL of the machine you were using, and the resolution of the host display at the time? I need some repro details, because I haven't seen this problem before (I use a MacBook with a Retina display). Thanks.

MarkJeronimus commented 7 years ago

http://www.pcjs.org/devices/pcx86/machine/5160/cga/256kb/win101/ Windows 10, 2880x1620, set to 200% dpi. Size of the browser canvas in Firefox 53: 2321x1505

When I make the browser window smaller, depending on the parity of the width & height the pointer refuses to go up or right, or up or down.

jeffpar commented 6 years ago

I'm not sure whether this is still a problem. I just tested the URL you provided with Windows 10, 2880x1800, 200% DPI, and I didn't have any difficulty moving the mouse in any direction, using either Edge or Firefox. I can imagine it would be nice to have some UI for adjusting the scaling factor between physical and virtual mouse coordinates, but I'll have to save that feature for another day.

MarkJeronimus commented 6 years ago

Can't test. Every computer I choose I get "Unable to restore disk '10Mb Hard Disk: unsupported restore format"

jeffpar commented 6 years ago

If the machine has a "Reset" button, see if that resolves your problem. Which URL(s) are giving you this problem? Thanks.

MarkJeronimus commented 6 years ago

The lin above and a buch random from the home page (win 1, win 3.1, win 95). Reset works but then the machine doesn't load the game/app it's supposed to load.

jeffpar commented 6 years ago

Weird. I'm running Windows 10 right now, and I've been trying all the machines from the home page in Edge, Firefox, and Chrome, and I can't reproduce that error. Maybe there's some old PCjs files in your browser's cache that are out of sync with the current files? If so, could you try emptying your cache, or try a different browser? Sorry for the hassle.