зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1573813 - use parent window scale factor for the popup/tooltips; r=stransky
For popup windows with parent we need to get scale factor of the parent window. Because when the windows are hidden they're not receiving updates about changing scaling factor. So when moving from normal dpi to the hidpi monitor the newly opened popup windows will have the same scale. Differential Revision: https://phabricator.services.mozilla.com/D45649 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1b4d182145
Коммит
9f70c0454a
|
@ -6589,11 +6589,22 @@ void nsWindow::SetDrawsInTitlebar(bool aState) {
|
|||
}
|
||||
|
||||
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 (mWindowType == eWindowType_popup && 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();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче