From d8f7aac4ca32f3aee3fcdda3e2847489e847b60e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 6 Mar 2020 16:14:35 -0600 Subject: [PATCH] Resize the drag bar on `WM_DISPLAYCHANGE` (#4829) ## Summary of the Pull Request Pretty straightforward. When we get a `WM_DISPLAYCHANGE`, that means the display's DPI changed. When that happens, resize the drag bar, so that it'll reflect the new scaling. Unblocks #4778 Closes #4166 ## Validation Man I've changed the DPI of my displays so many times in the last 30 minutes. I dragged the window across a bunch of DPI boundaries too. --- src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp index b4752bd7327..bf35c555aa6 100644 --- a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp @@ -480,6 +480,11 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept { switch (message) { + case WM_DISPLAYCHANGE: + // GH#4166: When the DPI of the monitor changes out from underneath us, + // resize our drag bar, to reflect its newly scaled size. + _UpdateIslandRegion(); + return 0; case WM_NCCALCSIZE: return _OnNcCalcSize(wParam, lParam); case WM_NCHITTEST: