diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index d1224b14f18..31dc46398e7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -3368,6 +3368,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(GetThemeTextExtent) } #endif +#ifndef NO_GetThreadDpiAwarenessContext +JNIEXPORT jlong JNICALL OS_NATIVE(GetThreadDpiAwarenessContext) + (JNIEnv *env, jclass that) +{ + jlong rc = 0; + OS_NATIVE_ENTER(env, that, GetThreadDpiAwarenessContext_FUNC); + rc = (jlong)GetThreadDpiAwarenessContext(); + OS_NATIVE_EXIT(env, that, GetThreadDpiAwarenessContext_FUNC); + return rc; +} +#endif + #ifndef NO_GetTouchInputInfo JNIEXPORT jboolean JNICALL OS_NATIVE(GetTouchInputInfo) (JNIEnv *env, jclass that, jlong arg0, jint arg1, jlong arg2, jint arg3) @@ -8847,6 +8859,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(SetTextColor) } #endif +#ifndef NO_SetThreadDpiAwarenessContext +JNIEXPORT jlong JNICALL OS_NATIVE(SetThreadDpiAwarenessContext) + (JNIEnv *env, jclass that, jlong arg0) +{ + jlong rc = 0; + OS_NATIVE_ENTER(env, that, SetThreadDpiAwarenessContext_FUNC); + rc = (jlong)SetThreadDpiAwarenessContext((DPI_AWARENESS_CONTEXT)arg0); + OS_NATIVE_EXIT(env, that, SetThreadDpiAwarenessContext_FUNC); + return rc; +} +#endif + #ifndef NO_SetTimer JNIEXPORT jlong JNICALL OS_NATIVE(SetTimer) (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jint arg2, jlong arg3) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index 916f306226c..5f815fb1855 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -264,6 +264,7 @@ typedef enum { GetTextMetrics_FUNC, GetThemePartSize_FUNC, GetThemeTextExtent_FUNC, + GetThreadDpiAwarenessContext_FUNC, GetTouchInputInfo_FUNC, GetUpdateRect_FUNC, GetUpdateRgn_FUNC, @@ -660,6 +661,7 @@ typedef enum { SetScrollInfo_FUNC, SetStretchBltMode_FUNC, SetTextColor_FUNC, + SetThreadDpiAwarenessContext_FUNC, SetTimer_FUNC, SetWindowLong_FUNC, SetWindowLongPtr_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index c1a89199544..4aea53b3c5c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -369,6 +369,10 @@ public class OS extends C { public static final short DMDUP_SIMPLEX = 1; public static final short DMDUP_VERTICAL = 2; public static final short DMDUP_HORIZONTAL = 3; + public static final int DPI_AWARENESS_CONTEXT_UNAWARE = 16; + public static final int DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17; + public static final int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18; + public static final int DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34; public static final int DSTINVERT = 0x550009; public static final int DT_BOTTOM = 0x8; public static final int DT_CALCRECT = 0x400; @@ -4345,6 +4349,9 @@ public static int HRESULT_FROM_WIN32(int x) { /** @param hdc cast=(HDC) */ public static final native int SetPolyFillMode (long hdc, int iPolyFillMode); public static final native boolean SetProcessDPIAware (); +/** @param dpiContext cast=(DPI_AWARENESS_CONTEXT) */ +public static final native long SetThreadDpiAwarenessContext (long dpiContext); +public static final native long GetThreadDpiAwarenessContext (); /** @method flags=no_gen */ public static final native int SetPreferredAppMode(int mode); /** @param lprc flags=no_in */