Skip to content

VLC not changing size on DPI changes

When a per-monitor DPI aware window (one that scales to the DPI of it's monitor) changes DPI, it should do two things:

  • change scale factor applied to all UI
  • change the size of the window to ensure the logical size doesn't change

The first mistake any per-monitor aware app makes is to ignore DPI changes. VLC now is changing it's scale for DPI changes (which makes the buttons/ other UI the right size on each monitor), BUT the window isn't changing size.

WM_DPICHANGED includes an lParam with a suggested rect. You must SetWindowPos with this rect without modifying the rect for any reason. https://msdn.microsoft.com/en-us/library/windows/desktop/dn312083(v=vs.85).aspx

The second mistake any per-monitor aware app makes is to think they can modify the rect. Long story short, you cannot, and attempting to do so will cause the window to fly away from the cursor when vigorously moved between monitors of different DPIs (and in the worst case get stuck in a loop fighting to respond to DPI changes that cause the reverse DPI change).

VLC is missing the required SetWindowPos call in response to WM_DPICHANGED. The result is that moving the window from a high DPI monitor to a low DPI monitor results in a gigantic window (and the reverse direction results in an unexpectedly small window).

3.0.3 Vetinari

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information