moved codes of DPI Support
This commit is contained in:
parent
bb671a9674
commit
72b59fc22e
@ -38,6 +38,19 @@ namespace hgl
|
||||
int win_left, win_top;
|
||||
int win_width, win_height;
|
||||
|
||||
|
||||
WindowCreateExteraParams createParams;
|
||||
|
||||
{
|
||||
context = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;
|
||||
previousDpiContext = SetThreadDpiAwarenessContext(context);
|
||||
|
||||
createParams.bEnableNonClientDpiScaling = FALSE;
|
||||
createParams.bChildWindowDpiIsolation = TRUE;
|
||||
|
||||
previousDpiHostingBehavior = SetThreadDpiHostingBehavior(DPI_HOSTING_BEHAVIOR_MIXED);
|
||||
}
|
||||
|
||||
{
|
||||
RECT win_rect;
|
||||
|
||||
@ -54,8 +67,11 @@ namespace hgl
|
||||
|
||||
if (width && height)
|
||||
{
|
||||
win_left = (GetSystemMetrics(SM_CXSCREEN) - win_width) / 2;
|
||||
win_top = (GetSystemMetrics(SM_CYSCREEN) - win_height) / 2;
|
||||
const uint32 screen_width=GetSystemMetrics(SM_CXSCREEN);
|
||||
const uint32 screen_height=GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
win_left = (screen_width - win_width) / 2;
|
||||
win_top = (screen_height - win_height) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -63,18 +79,6 @@ namespace hgl
|
||||
win_top = CW_USEDEFAULT;
|
||||
}
|
||||
|
||||
WindowCreateExteraParams createParams;
|
||||
|
||||
{
|
||||
context = DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;
|
||||
previousDpiContext = SetThreadDpiAwarenessContext(context);
|
||||
|
||||
createParams.bEnableNonClientDpiScaling = FALSE;
|
||||
createParams.bChildWindowDpiIsolation = TRUE;
|
||||
|
||||
previousDpiHostingBehavior = SetThreadDpiHostingBehavior(DPI_HOSTING_BEHAVIOR_MIXED);
|
||||
}
|
||||
|
||||
win_hwnd = CreateWindowExW(0,
|
||||
WIN_CLASS_NAME, // class name
|
||||
win_name.c_str(), // app name
|
||||
|
Loading…
x
Reference in New Issue
Block a user