Bug 1264193 - Add extra check for DPI changes during window drag, because we sometimes miss a WM_DPICHANGED message. r=emk
authorJonathan Kew <jkew@mozilla.com>
Fri, 15 Apr 2016 19:54:31 +0100
changeset 331484 a007f40ee34d05c5d752aa6e91cc6ed881c7b7a6
parent 331483 4a6678c781c9f84b1b15f51360f62d48648a2887
child 331485 9b887cca899597dcdda08b0de87d3a06c7536c79
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1264193
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264193 - Add extra check for DPI changes during window drag, because we sometimes miss a WM_DPICHANGED message. r=emk
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5368,16 +5368,26 @@ nsWindow::ProcessMessage(UINT msg, WPARA
                                            nullptr);
         }
       }
       break;
     }
 
     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:
     {
       if (mResizeState == NOT_RESIZING) {
         mResizeState = IN_SIZEMOVE;
       }
       break;
@@ -6919,16 +6929,17 @@ nsWindow::OnDPIChanged(int32_t x, int32_
         width = std::min(width, availWidth);
         height = std::min(height, availHeight);
       }
     }
 
     Resize(x, y, width, height, true);
   }
   ChangedDPI();
+  ResetLayout();
 }
 
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: IME management and accessibility
  **
  ** Handles managing IME input and accessibility.