From dd1460d664f7266920b07527f25f87ec8233daaf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Sep 2013 10:58:24 +0000 Subject: valid options initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@6225 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clcutils.cpp | 15 ++++----------- src/modules/clist/contacts.cpp | 3 +-- src/modules/clist/genmenuopt.cpp | 3 +-- 3 files changed, 6 insertions(+), 15 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 4de2705787..e6ad8acf57 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -67,7 +67,6 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClcContact *hitcontact = NULL; ClcGroup *hitgroup = NULL; int indent, i; - HFONT hFont; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); if (flags) @@ -79,20 +78,16 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * ClientToScreen(hwnd, &pt); HWND hwndParent = hwnd, hwndTemp; - do - { + do { hwndTemp = hwndParent; hwndParent = (HWND)GetWindowLongPtr(hwndTemp, GWLP_HWNDPARENT); POINT pt1 = pt; ScreenToClient(hwndParent, &pt1); - HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), - pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); + HWND h = ChildWindowFromPointEx(hwndParent ? hwndParent : GetDesktopWindow(), pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); if (h != hwndTemp) - { if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX)) return -1; - } } while (hwndParent); @@ -164,11 +159,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * return hit; } } + HDC hdc = GetDC(hwnd); - if (hitcontact->type == CLCIT_GROUP) - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont); - else - hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont); + HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont); SIZE textSize; GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize); diff --git a/src/modules/clist/contacts.cpp b/src/modules/clist/contacts.cpp index ff2763964c..cc95f496c6 100644 --- a/src/modules/clist/contacts.cpp +++ b/src/modules/clist/contacts.cpp @@ -487,8 +487,7 @@ static INT_PTR CALLBACK ContactOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lPara static int ContactOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -1000000000; odp.hInstance = hInst; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTACT); diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 8c4b35dafe..d290d4cd7f 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -857,8 +857,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int GenMenuOptInit(WPARAM wParam, LPARAM) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; odp.position = -1000000000; -- cgit v1.2.3