Skip to content

Commit

Permalink
Try to correct function pointer prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
krono committed Apr 28, 2017
1 parent aa47a62 commit 65bbdf3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions platforms/win32/vm/sqWin32Window.c
Expand Up @@ -1770,7 +1770,15 @@ typedef double (*getDpi_t)(void);
/*
* Lazy-loaded GetDpiForMonitor, which is not on Windows7 and Windows8
*/
typedef HRESULT (*thisGetDpiForMonitor_t)(HMONITOR,UINT,UINT *,UINT *);
// enum duplicated from ShellScalingApi.
typedef enum this_MONITOR_DPI_TYPE {
thisMDT_EFFECTIVE_DPI = 0,
thisMDT_ANGULAR_DPI = 1,
thisMDT_RAW_DPI = 2,
thisMDT_DEFAULT = MDT_EFFECTIVE_DPI
} thisMONITOR_DPI_TYPE;

typedef HRESULT (*thisGetDpiForMonitor_t)(HMONITOR,thisMONITOR_DPI_TYPE,UINT *,UINT *);
static thisGetDpiForMonitor_t thisGetDpiForMonitor = NULL;

/*
Expand All @@ -1790,7 +1798,7 @@ static double getDpiMonitor(void)
if (!thisGetDpiForMonitor) { return 0.0; }

if ((hMonitor = MonitorFromWindow(stWindow, MONITOR_DEFAULTTONULL))) {
if (thisGetDpiForMonitor(hMonitor, 0, &hdpi, &vdpi) == S_OK && hdpi > 0 && vdpi > 0) {
if (thisGetDpiForMonitor(hMonitor, thisMDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK && hdpi > 0 && vdpi > 0) {
return (double) vdpi;
}
}
Expand Down

0 comments on commit 65bbdf3

Please sign in to comment.