RMichelsen / Nvy

Nvy - A Neovim client in C++
MIT License
333 stars 28 forks source link

Fix moving window to different DPI screen #114

Closed dapetcu21 closed 2 months ago

dapetcu21 commented 10 months ago

The previous behavior was pretty wild for me. When moving from a 100% scale display to a 150% scale display, the window would resize incorrectly, end up back on the 100% display, then as you continued to drag your mouse, it would trigger WM_DPICHANGED again and this would repeat a couple of times, often ending up with a window 4 or 8 times bigger than expected.

It's a bit hard to explain. I can provide a video if further clarification is needed.

I fixed this by using prcNewWindow->left/top (the new suggested window position from the event) instead of SWP_NOMOVE.

I also fixed the renderer not updating properly when a DPI transition happened, which would sometimes result in a wrong text scale.

RMichelsen commented 2 months ago

Sorry for the long response time, the change seems good. Merged 👍