diff options
Diffstat (limited to 'alf/alf.cpp')
| -rw-r--r-- | alf/alf.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp index deffd1a..30a998c 100644 --- a/alf/alf.cpp +++ b/alf/alf.cpp @@ -174,16 +174,24 @@ ALF_GetModalResult(HWND win) } int -ALF_CentipointsToPixels(HWND win, int cptValue) +ALF_CentipointsToPixels(int cptValue, int dpi) { - return (int)SendMessage(win, ALF_WM_CENTIPOINTTOPX, (WPARAM)cptValue, 0); + return MulDiv(cptValue, dpi, 7200); +} + +int +ALF_GetDpi(HWND window) +{ + return (int)SendMessage(window, ALF_WM_GETDPI, 0, 0); } void ALF_ResizeWindow(HWND win, int cptWidth, int cptHeight) { - int pxwidth = ALF_CentipointsToPixels(win, cptWidth); - int pxheight = ALF_CentipointsToPixels(win, cptHeight); + int dpi = ALF_GetDpi(win); + + int pxwidth = ALF_CentipointsToPixels(cptWidth, dpi); + int pxheight = ALF_CentipointsToPixels(cptHeight, dpi); ALF_ResizeWindowPx(win, pxwidth, pxheight); } @@ -408,7 +416,7 @@ ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) if (!GetParent(hwnd)) return FALSE; - return msg == ALF_WM_CENTIPOINTTOPX + return msg == ALF_WM_GETDPI || msg == WM_COMMAND || msg == WM_NOTIFY || msg == WM_MEASUREITEM || msg == WM_DRAWITEM || msg == WM_CTLCOLORBTN || msg == WM_CTLCOLOREDIT |
