Skip to content

Commit a8df03e

Browse files
committed
hammer: Do not apply DPI twice
1 parent b7e1ad7 commit a8df03e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

hammer/childfrm.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,14 @@ BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext)
561561
// Calculate the size of each view within the splitter,
562562
//
563563
// Our DPI behavior is not initialized yet, so fallback to parent one.
564-
se::windows::ui::CDpiWindowBehavior parentDpiBehavior{false};
565-
parentDpiBehavior.OnCreateWindow(lpcs->hwndParent);
564+
const int scaled = se::windows::ui::CDpiWindowBehavior::ScaleByDpi
565+
(
566+
USER_DEFAULT_SCREEN_DPI, 3, ::GetDpiForWindow(lpcs->hwndParent)
567+
);
566568

567569
CRect r;
568570
GetClientRect(r);
569-
CSize sizeView(r.Width() / 2 - parentDpiBehavior.ScaleOnX(3), r.Height() / 2 - parentDpiBehavior.ScaleOnY(3));
570-
571-
parentDpiBehavior.OnDestroyWindow();
571+
CSize sizeView(r.Width()/2 - scaled, r.Height()/2 - scaled);
572572

573573
//
574574
// Create the 4 views as they were when the user last closed the app.

0 commit comments

Comments
 (0)