Skip to content
Snippets Groups Projects
Commit 8032b14c authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Some cleanup, make SDL hyper turbo DPI aware as well.

parent 21c62012
No related branches found
No related tags found
No related merge requests found
Pipeline #5860 passed
......@@ -240,11 +240,12 @@ int init_sdl_video(void)
// code that tells windows we're High DPI aware so it doesn't scale our windows
// taken from Yamagi Quake II
typedef enum D3_PROCESS_DPI_AWARENESS {
enum D3_PROCESS_DPI_AWARENESS {
D3_PROCESS_DPI_UNAWARE = 0,
D3_PROCESS_SYSTEM_DPI_AWARE = 1,
D3_PROCESS_PER_MONITOR_DPI_AWARE = 2
} YQ2_PROCESS_DPI_AWARENESS;
D3_PROCESS_PER_MONITOR_DPI_AWARE = 2,
D3_PROCESS_PER_MONITOR_DPI_AWARE_V2 = 3,
};
/* For Vista, Win7 and Win8 */
BOOL(WINAPI *SetProcessDPIAware)(void) = NULL;
......@@ -252,12 +253,16 @@ int init_sdl_video(void)
/* Win8.1 and later */
HRESULT(WINAPI *SetProcessDpiAwareness)(enum D3_PROCESS_DPI_AWARENESS dpiAwareness) = NULL;
/* Win10v1703 and later */
HRESULT(WINAPI *SetProcessDpiAwarenessContext)(enum D3_PROCESS_DPI_AWARENESS dpiAwareness) = NULL;
const char* user32dll[] = {"User32", NULL};
dll_handle userDLL = xp_dlopen(user32dll, RTLD_LAZY, 0);
if (userDLL)
{
SetProcessDPIAware = xp_dlsym(userDLL, SetProcessDPIAware);
SetProcessDpiAwarenessContext = xp_dlsym(userDLL, SetProcessDpiAwarenessContext);
}
......@@ -269,7 +274,11 @@ int init_sdl_video(void)
SetProcessDpiAwareness = xp_dlsym(shcoreDLL, SetProcessDpiAwareness);
}
if (SetProcessDpiAwareness) {
if (SetProcessDpiAwarenessContext) {
if (!SetProcessDpiAwarenessContext(D3_PROCESS_PER_MONITOR_DPI_AWARE_V2))
SetProcessDpiAwarenessContext(D3_PROCESS_PER_MONITOR_DPI_AWARE);
}
else if (SetProcessDpiAwareness) {
SetProcessDpiAwareness(D3_PROCESS_PER_MONITOR_DPI_AWARE);
}
else if (SetProcessDPIAware) {
......
......@@ -429,10 +429,8 @@ gdi_handle_wm_char(WPARAM wParam, LPARAM lParam)
uint8_t ch;
uint16_t repeat;
uint16_t i;
bool alt;
repeat = lParam & 0xffff;
alt = lParam & (1 << 29);
if (IS_HIGH_SURROGATE(wParam)) {
highpair = wParam;
return 0;
......@@ -527,10 +525,6 @@ gdi_handle_mouse_wheel(int16_t distance, LPARAM lParam)
static LRESULT
gdi_handle_activate(HWND hwnd, WPARAM wParam)
{
static LPCTSTR lc = IDC_IBEAM;
uint16_t lw = wParam & 0xffff;
// TODO: We may need to read the state of CTRL and SHIFT keys for extended key input...
return 0;
}
......@@ -1169,12 +1163,12 @@ gdi_init(int mode)
// code that tells windows we're High DPI aware so it doesn't scale our windows
// taken from Yamagi Quake II
typedef enum D3_PROCESS_DPI_AWARENESS {
enum D3_PROCESS_DPI_AWARENESS {
D3_PROCESS_DPI_UNAWARE = 0,
D3_PROCESS_SYSTEM_DPI_AWARE = 1,
D3_PROCESS_PER_MONITOR_DPI_AWARE = 2,
D3_PROCESS_PER_MONITOR_DPI_AWARE_V2 = 3,
} YQ2_PROCESS_DPI_AWARENESS;
};
/* For Vista, Win7 and Win8 */
BOOL(WINAPI *SetProcessDPIAware)(void) = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment