Added setting of Windows DPI-aware flag.

master
Camilla Berglund ago%!(EXTRA string=12 years)
parent 3897a174b5
commit 54d1d14f59
  1. 10
      src/win32_init.c
  2. 10
      src/win32_platform.h

@ -79,6 +79,13 @@ static GLboolean initLibraries(void)
} }
#endif // _GLFW_NO_DLOAD_WINMM #endif // _GLFW_NO_DLOAD_WINMM
_glfw.win32.user32.instance = LoadLibrary(L"user32.dll");
if (_glfw.win32.user32.instance)
{
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
}
return GL_TRUE; return GL_TRUE;
} }
@ -162,6 +169,9 @@ int _glfwPlatformInit(void)
if (!initLibraries()) if (!initLibraries())
return GL_FALSE; return GL_FALSE;
if (_glfw_SetProcessDPIAware)
_glfw_SetProcessDPIAware();
#ifdef __BORLANDC__ #ifdef __BORLANDC__
// With the Borland C++ compiler, we want to disable FPU exceptions // With the Borland C++ compiler, we want to disable FPU exceptions
// (this is recommended for OpenGL applications under Windows) // (this is recommended for OpenGL applications under Windows)

@ -100,6 +100,10 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
#define _glfw_timeGetTime timeGetTime #define _glfw_timeGetTime timeGetTime
#endif // _GLFW_NO_DLOAD_WINMM #endif // _GLFW_NO_DLOAD_WINMM
// user32.dll function pointer typedefs
typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
#define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
// We use versioned window class names in order not to cause conflicts // We use versioned window class names in order not to cause conflicts
// between applications using different versions of GLFW // between applications using different versions of GLFW
@ -180,6 +184,12 @@ typedef struct _GLFWlibraryWin32
} winmm; } winmm;
#endif // _GLFW_NO_DLOAD_WINMM #endif // _GLFW_NO_DLOAD_WINMM
// user32.dll
struct {
HINSTANCE instance;
SETPROCESSDPIAWARE_T SetProcessDPIAware;
} user32;
struct { struct {
char* name; char* name;
} joystick[GLFW_JOYSTICK_LAST + 1]; } joystick[GLFW_JOYSTICK_LAST + 1];

Loading…
Cancel
Save