Bug 1482920: Force fullscreen window position. r=jmathies
authorAdam Gashlin <agashlin@mozilla.com>
Wed, 28 Nov 2018 20:05:06 +0000
changeset 505012 bcc079816150ebbb4e20c2cb7c68560b8cdfb075
parent 505011 85b68ee430dc5b8ec21663ecfd00e4b14e80b944
child 505013 0fd399c6caabff60ac0fe53b920b7d26a9806750
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1482920
milestone65.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 1482920: Force fullscreen window position. r=jmathies Differential Revision: https://phabricator.services.mozilla.com/D13042
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6899,16 +6899,39 @@ void nsWindow::OnWindowPosChanging(LPWIN
       sizeMode = nsSizeMode_Normal;
 
     if (mWidgetListener)
       mWidgetListener->SizeModeChanged(sizeMode);
 
     UpdateNonClientMargins(sizeMode, false);
   }
 
+  // Force fullscreen. This works around a bug in Windows 10 1809 where
+  // using fullscreen when a window is "snapped" causes a spurious resize
+  // smaller than the full screen, see bug 1482920.
+  if (mSizeMode == nsSizeMode_Fullscreen &&
+      !(info->flags & SWP_NOMOVE) && !(info->flags & SWP_NOSIZE)) {
+    nsCOMPtr<nsIScreenManager> screenmgr = do_GetService(sScreenManagerContractID);
+    if (screenmgr) {
+      nsCOMPtr<nsIScreen> screen;
+      screenmgr->ScreenForRect(info->x, info->y, info->cx, info->cy,
+                               getter_AddRefs(screen));
+
+      if (screen) {
+        int32_t x, y, width, height;
+        screen->GetRectDisplayPix(&x, &y, &width, &height);
+
+        info->x = x;
+        info->y = y;
+        info->cx = width;
+        info->cy = height;
+      }
+    }
+  }
+
   // enforce local z-order rules
   if (!(info->flags & SWP_NOZORDER)) {
     HWND hwndAfter = info->hwndInsertAfter;
 
     nsWindow *aboveWindow = 0;
     nsWindowZ placement;
 
     if (hwndAfter == HWND_BOTTOM)