1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Made DPI dynamic to fix errors where running on Win7 failed

This commit is contained in:
Brian Fiete 2019-09-18 08:15:17 -07:00
parent c0b73cdd6f
commit cde78bc8c5
2 changed files with 18 additions and 1 deletions

View file

@ -1016,12 +1016,22 @@ static int WinBFReportHook( int reportType, char *message, int *returnValue )
extern HINSTANCE gDLLInstance;
typedef UINT(NTAPI *GetDpiForWindow_t)(HWND);
static GetDpiForWindow_t gGetDpiForWindow = NULL;
static HMODULE gUserDll = NULL;
WinBFApp::WinBFApp()
{
#ifndef BF_MINGW
//_CrtSetReportHook(WinBFReportHook);
#endif
if (gUserDll == NULL)
{
gUserDll = ::LoadLibraryA("user32.dll");
gGetDpiForWindow = (GetDpiForWindow_t)::GetProcAddress(gUserDll, "GetDpiForWindow");
}
mRunning = false;
mRenderDevice = NULL;
@ -1341,6 +1351,13 @@ bool WinBFWindow::IsMouseCaptured()
return (mHWnd != NULL) && (GetCapture() == mHWnd);
}
int WinBFWindow::GetDPI()
{
if (gGetDpiForWindow != NULL)
return (int)gGetDpiForWindow(mHWnd);
return 96; // Default DPI
}
uint32 WinBFApp::GetClipboardFormat(const StringImpl& format)
{
if (format == "text")