Skip to content

Commit d7ef86a

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

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,6 +2510,18 @@ 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+
rc = (jint)GetDpiForWindow((HWND)arg0);
2520+
OS_NATIVE_EXIT(env, that, GetDpiForWindow_FUNC);
2521+
return rc;
2522+
}
2523+
#endif
2524+
25132525
#ifndef NO_GetFocus
25142526
JNIEXPORT jlong JNICALL OS_NATIVE(GetFocus)
25152527
(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 "shcore.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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,10 @@ 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+
/**
2818+
* @param hWnd cast=(HWND)
2819+
*/
2820+
public static final native int GetDpiForWindow (long hWnd);
28172821
public static final native long GetFocus ();
28182822
/** @param hdc cast=(HDC) */
28192823
public static final native int GetFontLanguageInfo (long hdc);

0 commit comments

Comments
 (0)