mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240180 - Optimize native theme scaling for the single-monitor case. r=emk
This commit is contained in:
parent
04e7780340
commit
06e58001b4
@ -1550,13 +1550,18 @@ AssumeThemePartAndStateAreTransparent(int32_t aPart, int32_t aState)
|
||||
// with a different DPI setting from the system's primary monitor, we need to
|
||||
// apply scaling to native-themed elements as the Windows theme APIs assume
|
||||
// the primary monitor's resolution.
|
||||
static double
|
||||
static inline double
|
||||
GetThemeDpiScaleFactor(nsIFrame* aFrame)
|
||||
{
|
||||
double primaryScale =
|
||||
WinUtils::LogToPhysFactor(WinUtils::GetPrimaryMonitor());
|
||||
nsIWidget* rootWidget = aFrame->PresContext()->GetRootWidget();
|
||||
return rootWidget ? rootWidget->GetDefaultScale().scale / primaryScale : 1.0;
|
||||
if (WinUtils::IsPerMonitorDPIAware() && GetSystemMetrics(SM_CMONITORS) > 1) {
|
||||
nsIWidget* rootWidget = aFrame->PresContext()->GetRootWidget();
|
||||
if (rootWidget) {
|
||||
double primaryScale =
|
||||
WinUtils::LogToPhysFactor(WinUtils::GetPrimaryMonitor());
|
||||
return rootWidget->GetDefaultScale().scale / primaryScale;
|
||||
}
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
Loading…
Reference in New Issue
Block a user