From e9820b4ca2a27d11ee3b657e12651efa9fa38d7f Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 15 Apr 2016 19:54:31 +0100 Subject: [PATCH] Bug 1264193 - Add extra check for DPI changes during window drag, because we sometimes miss a WM_DPICHANGED message. r=emk a=ritu --- widget/windows/nsWindow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index e39745de9a4..dc5c8f093c4 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -5371,6 +5371,16 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam, case WM_MOVING: FinishLiveResizing(MOVING); + if (WinUtils::IsPerMonitorDPIAware()) { + // Sometimes, we appear to miss a WM_DPICHANGED message while moving + // a window around. Therefore, call ChangedDPI and ResetLayout here, + // which causes the prescontext and appshell window management code to + // check the appUnitsPerDevPixel value and current widget size, and + // refresh them if necessary. If nothing has changed, these calls will + // return without actually triggering any extra reflow or painting. + ChangedDPI(); + ResetLayout(); + } break; case WM_ENTERSIZEMOVE: @@ -6927,6 +6937,7 @@ nsWindow::OnDPIChanged(int32_t x, int32_t y, int32_t width, int32_t height) Resize(x, y, width, height, true); } ChangedDPI(); + ResetLayout(); } /**************************************************************