From eb706aae8bf5659a8aae37db31f88c3b605b8b1f Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Tue, 8 Jan 2019 23:13:32 +0100 Subject: reingineer compat layer not totally sure whether that's actually better --- alf/alfbutton.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'alf/alfbutton.cpp') diff --git a/alf/alfbutton.cpp b/alf/alfbutton.cpp index 95e8e8d..b0458b2 100644 --- a/alf/alfbutton.cpp +++ b/alf/alfbutton.cpp @@ -7,8 +7,6 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT (void)uIdSubclass; (void)dwRefData; - ALFAPP app = (ALFAPP)dwRefData; - if (uMsg == ALF_WM_QUERYSIZE) { HDC hdc = GetDC(hwnd); HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); @@ -32,9 +30,9 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT HeapFree(GetProcessHeap(), 0, textbuf); - int xpadding = app->compatFn->GetSystemMetricsForDpi(SM_CXEDGE, + int xpadding = ALF_Compat_GetSystemMetricsForDpi(SM_CXEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; - int ypadding = app->compatFn->GetSystemMetricsForDpi(SM_CYEDGE, + int ypadding = ALF_Compat_GetSystemMetricsForDpi(SM_CYEDGE, ALF_CentipointsToPixels(GetParent(hwnd), 7200)) * 2 + 6; SIZE *pSize = (SIZE*)(void*)lParam; @@ -58,7 +56,7 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT RECT *p = (RECT *)lParam; - int padding = app->compatFn->IsAppThemed() ? 0 : 1; + int padding = ALF_Compat_IsAppThemed() ? 0 : 1; return (LRESULT)DeferWindowPos((HDWP)wParam, hwnd, NULL, @@ -66,10 +64,10 @@ ALF__ButtonSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT p->right - p->left, p->bottom - p->top - 2*padding, SWP_NOZORDER|SWP_NOACTIVATE); } else if (uMsg == WM_DESTROY) { - app->compatFn->RemoveWindowSubclass(hwnd, ALF__ButtonSubclassProc, 0); + ALF_Compat_RemoveWindowSubclass(hwnd, ALF__ButtonSubclassProc, 0); } - return app->compatFn->DefSubclassProc(hwnd, uMsg, wParam, lParam); + return ALF_Compat_DefSubclassProc(hwnd, uMsg, wParam, lParam); } HWND @@ -85,9 +83,7 @@ ALF_AddButton(HWND win, WORD id, UINT x, UINT y, const TCHAR *text) (HINSTANCE)GetWindowLongPtr(win, GWLP_HINSTANCE), NULL); - ALFAPP app = ALF_ApplicationFromWindow(win); - - app->compatFn->SetWindowSubclass(hwndButton, ALF__ButtonSubclassProc, 0, (DWORD_PTR)app); + ALF_Compat_SetWindowSubclass(hwndButton, ALF__ButtonSubclassProc, 0, 0); SetWindowPos(hwndButton, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED); ALFWidgetLayoutParams p; -- cgit v1.2.3