summaryrefslogtreecommitdiff
path: root/mozilla-1573813.patch
blob: e9fca079296888ab58aae64c744956e915e38dc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6577,11 +6577,22 @@
 }
 
 gint nsWindow::GdkScaleFactor() {
+  // For popup windows with parent window we need to get scale factor of the
+  // parent window. Otherwise the scale factor of the popup is not updated
+  // during it's hidden.
+  GdkWindow* scaledGdkWindow = mGdkWindow;
+  if (mToplevelParentWindow) {
+    scaledGdkWindow = gtk_widget_get_window(GTK_WIDGET(mToplevelParentWindow));
+    // Fallback for windows which parent has been unrealized.
+    if (!scaledGdkWindow) {
+      scaledGdkWindow = mGdkWindow;
+    }
+  }
   // Available as of GTK 3.10+
   static auto sGdkWindowGetScaleFactorPtr =
       (gint(*)(GdkWindow*))dlsym(RTLD_DEFAULT, "gdk_window_get_scale_factor");
-  if (sGdkWindowGetScaleFactorPtr && mGdkWindow)
-    return (*sGdkWindowGetScaleFactorPtr)(mGdkWindow);
+  if (sGdkWindowGetScaleFactorPtr && scaledGdkWindow)
+    return (*sGdkWindowGetScaleFactorPtr)(scaledGdkWindow);
   return ScreenHelperGTK::GetGTKMonitorScaleFactor();
 }
 

bgstack15