mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JRE-119 [ask if ui scale is enabled natively]
(cherry picked from commit 801f45875fd8699edcbda5896210cec191062261)
(cherry picked from commit 20edebdefa)
This commit is contained in:
committed by
alexey.ushakov@jetbrains.com
parent
14e8a62606
commit
b4949efc09
@@ -27,6 +27,7 @@
|
||||
#include "mmsystem.h"
|
||||
#include "jlong.h"
|
||||
#include "awt_DesktopProperties.h"
|
||||
#include "awt_Win32GraphicsDevice.h"
|
||||
#include "awt_Toolkit.h"
|
||||
#include "sun_awt_windows_WDesktopProperties.h"
|
||||
#include "java_awt_Font.h"
|
||||
@@ -88,6 +89,11 @@ void AwtDesktopProperties::GetWindowsParameters() {
|
||||
}
|
||||
|
||||
void getInvScale(float &invScaleX, float &invScaleY) {
|
||||
if (!AwtWin32GraphicsDevice::IsUiScaleEnabled()) {
|
||||
invScaleX = 1.0f;
|
||||
invScaleY = 1.0f;
|
||||
return;
|
||||
}
|
||||
static int dpiX = -1;
|
||||
static int dpiY = -1;
|
||||
if (dpiX == -1 || dpiY == -1) {
|
||||
|
||||
@@ -940,6 +940,14 @@ int AwtWin32GraphicsDevice::GetScreenFromHMONITOR(HMONITOR mon) {
|
||||
* End of static deviceIndex-based methods
|
||||
*/
|
||||
|
||||
BOOL AwtWin32GraphicsDevice::IsUiScaleEnabled()
|
||||
{
|
||||
return JNU_CallStaticMethodByName(AwtToolkit::GetEnv(),
|
||||
NULL,
|
||||
"sun/java2d/SunGraphicsEnvironment",
|
||||
"isUIScaleEnabled",
|
||||
"()Z").z;
|
||||
}
|
||||
|
||||
const DWORD REQUIRED_FLAGS = ( //Flags which must be set in
|
||||
PFD_SUPPORT_GDI | //in the PixelFormatDescriptor.
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
static void DisableOffscreenAccelerationForDevice(HMONITOR hMonitor);
|
||||
static HDC GetDCFromScreen(int screen);
|
||||
static int GetScreenFromHMONITOR(HMONITOR mon);
|
||||
static BOOL IsUiScaleEnabled(); // if not, be dpi-unaware (backward compatible behaviour)
|
||||
|
||||
static int primaryIndex;
|
||||
static BOOL primaryPalettized;
|
||||
|
||||
Reference in New Issue
Block a user