Index: common/releasever.h |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | #define DXGLMAJORVER 0
|
7 | 7 | #define DXGLMINORVER 5
|
8 | 8 | #define DXGLPOINTVER 13
|
9 | | -#define DXGLBETA 1
|
| 9 | +#define DXGLBETA 0
|
10 | 10 |
|
11 | 11 | #define STR2(x) #x
|
12 | 12 | #define STR(x) STR2(x)
|
Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -2446,6 +2446,48 @@ |
2447 | 2447 | return TRUE;
|
2448 | 2448 | }
|
2449 | 2449 |
|
| 2450 | +DWORD GetDPISupportLevel()
|
| 2451 | +{
|
| 2452 | + HMODULE hSHCore = NULL;
|
| 2453 | + HMODULE hUser32 = NULL;
|
| 2454 | + HRESULT(WINAPI *_SetProcessDpiAwareness)(DWORD value) = NULL;
|
| 2455 | + BOOL(WINAPI *_SetProcessDpiAwarenessContext)(HANDLE value) = NULL;
|
| 2456 | + DWORD level = 0;
|
| 2457 | + // Vista or higher - supports DWM and DPI scaling
|
| 2458 | + if (osver.dwMajorVersion >= 6) level = 1;
|
| 2459 | + else return level;
|
| 2460 | + // 8.1 or higher - Supports Per-Monitor scaling
|
| 2461 | + hSHCore = LoadLibrary(_T("SHCore.dll"));
|
| 2462 | + if (hSHCore)
|
| 2463 | + {
|
| 2464 | + _SetProcessDpiAwareness =
|
| 2465 | + (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
|
| 2466 | + if (_SetProcessDpiAwareness) level = 2;
|
| 2467 | + else
|
| 2468 | + {
|
| 2469 | + FreeLibrary(hSHCore);
|
| 2470 | + return level;
|
| 2471 | + }
|
| 2472 | + FreeLibrary(hSHCore);
|
| 2473 | + }
|
| 2474 | + else return level;
|
| 2475 | + // v1703 or higher - Support Per-Monitor scaling v2
|
| 2476 | + hUser32 = LoadLibrary(_T("User32.dll"));
|
| 2477 | + if (hUser32)
|
| 2478 | + {
|
| 2479 | + _SetProcessDpiAwarenessContext =
|
| 2480 | + (BOOL(WINAPI*)(HANDLE))GetProcAddress(hUser32, "SetProcessDpiAwarenessContext");
|
| 2481 | + if (_SetProcessDpiAwarenessContext) level = 3;
|
| 2482 | + else
|
| 2483 | + {
|
| 2484 | + FreeLibrary(hUser32);
|
| 2485 | + return level;
|
| 2486 | + }
|
| 2487 | + FreeLibrary(hUser32);
|
| 2488 | + }
|
| 2489 | + return level;
|
| 2490 | +}
|
| 2491 | +
|
2450 | 2492 | LRESULT CALLBACK DXGLCfgCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
2451 | 2493 | {
|
2452 | 2494 | PIXELFORMATDESCRIPTOR pfd =
|
— | — | @@ -2513,6 +2555,7 @@ |
2514 | 2556 | NMHDR *nm;
|
2515 | 2557 | TCHAR abouttext[1024];
|
2516 | 2558 | int newtab;
|
| 2559 | + DWORD dpisupport;
|
2517 | 2560 | TCITEM tab;
|
2518 | 2561 | switch (Msg)
|
2519 | 2562 | {
|
— | — | @@ -3018,12 +3061,24 @@ |
3019 | 3062 | if (cfg->NoResizeWindow) SendDlgItemMessage(hTabs[3], IDC_NOAUTOSIZE, BM_SETCHECK, BST_CHECKED, 0);
|
3020 | 3063 | else SendDlgItemMessage(hTabs[3], IDC_NOAUTOSIZE, BM_SETCHECK, BST_UNCHECKED, 0);
|
3021 | 3064 | // DPI
|
| 3065 | + dpisupport = GetDPISupportLevel();
|
3022 | 3066 | _tcscpy(buffer, _T("Disabled"));
|
3023 | 3067 | SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
3024 | | - _tcscpy(buffer, _T("Enabled"));
|
| 3068 | + if (dpisupport >= 2) _tcscpy(buffer, _T("Per-monitor"));
|
| 3069 | + else _tcscpy(buffer, _T("Enabled"));
|
3025 | 3070 | SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
3026 | 3071 | _tcscpy(buffer, _T("Windows AppCompat"));
|
3027 | 3072 | SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 3073 | + if (dpisupport >= 2)
|
| 3074 | + {
|
| 3075 | + _tcscpy(buffer, _T("System"));
|
| 3076 | + SendDlgItemMessage(hTabs[0], IDC_DPISCALE, CB_ADDSTRING, 2, (LPARAM)buffer);
|
| 3077 | + }
|
| 3078 | + if (dpisupport >= 3)
|
| 3079 | + {
|
| 3080 | + _tcscpy(buffer, _T("Per-monitor V2"));
|
| 3081 | + SendDlgItemMessage(hTabs[0], IDC_DPISCALE, CB_ADDSTRING, 2, (LPARAM)buffer);
|
| 3082 | + }
|
3028 | 3083 | SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);
|
3029 | 3084 | // Paths
|
3030 | 3085 | EnableWindow(GetDlgItem(hTabs[3], IDC_PATHLABEL), FALSE);
|