Skip to content

Commit 7d4fba6

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] add GetDpiForWindow OS call
This commit adds the OS call for GetDpiForWindow.
1 parent 7be6e97 commit 7d4fba6

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,6 +2510,26 @@ JNIEXPORT jint JNICALL OS_NATIVE(GetDpiForMonitor)
25102510
}
25112511
#endif
25122512

2513+
#ifndef NO_GetDpiForWindow
2514+
JNIEXPORT jint JNICALL OS_NATIVE(GetDpiForWindow)
2515+
(JNIEnv *env, jclass that, jlong arg0)
2516+
{
2517+
jint rc = 0;
2518+
OS_NATIVE_ENTER(env, that, GetDpiForWindow_FUNC);
2519+
/*
2520+
rc = (jint)GetDpiForWindow(arg0);
2521+
*/
2522+
{
2523+
OS_LOAD_FUNCTION(fp, GetDpiForWindow)
2524+
if (fp) {
2525+
rc = (jint)((jint (CALLING_CONVENTION*)(jlong))fp)(arg0);
2526+
}
2527+
}
2528+
OS_NATIVE_EXIT(env, that, GetDpiForWindow_FUNC);
2529+
return rc;
2530+
}
2531+
#endif
2532+
25132533
#ifndef NO_GetFocus
25142534
JNIEXPORT jlong JNICALL OS_NATIVE(GetFocus)
25152535
(JNIEnv *env, jclass that)

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/* Libraries for dynamic loaded functions */
2121
#define GetDpiForMonitor_LIB "shcore.dll"
22+
#define GetDpiForWindow_LIB "user32.dll"
2223
#define RtlGetVersion_LIB "ntdll.dll"
2324
#define OpenThemeDataForDpi_LIB "uxtheme.dll"
2425
#define GetSystemMetricsForDpi_LIB "user32.dll"

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ typedef enum {
203203
GetDlgItem_FUNC,
204204
GetDoubleClickTime_FUNC,
205205
GetDpiForMonitor_FUNC,
206+
GetDpiForWindow_FUNC,
206207
GetFocus_FUNC,
207208
GetFontLanguageInfo_FUNC,
208209
GetForegroundWindow_FUNC,

bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,8 @@ public static int HRESULT_FROM_WIN32(int x) {
28142814
public static final native int GetDoubleClickTime ();
28152815
/** @method flags=dynamic */
28162816
public static final native int GetDpiForMonitor (long hmonitor, int dpiType, int [] dpiX, int [] dpiY);
2817+
/** @method flags=dynamic */
2818+
public static final native int GetDpiForWindow (long hWnd);
28172819
public static final native long GetFocus ();
28182820
/** @param hdc cast=(HDC) */
28192821
public static final native int GetFontLanguageInfo (long hdc);

0 commit comments

Comments
 (0)