From 8b43f34cf011d8646601580729f86ffc2d866dd2 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Wed, 14 Nov 2007 13:05:51 +0000 Subject: [PATCH] add part of the patch from bug 2805 with some minor changes See issue #2805 for more details. svn path=/trunk/; revision=30442 --- reactos/base/applications/charmap/charmap.c | 43 ++++++++------------- reactos/base/applications/charmap/map.c | 35 ++++++----------- 2 files changed, 28 insertions(+), 50 deletions(-) diff --git a/reactos/base/applications/charmap/charmap.c b/reactos/base/applications/charmap/charmap.c index 7e4846c13b2..f7373183f27 100644 --- a/reactos/base/applications/charmap/charmap.c +++ b/reactos/base/applications/charmap/charmap.c @@ -68,9 +68,8 @@ FillFontStyleComboList(HWND hwndCombo) (WPARAM)hFont, 0); + ZeroMemory(&lf, sizeof(lf)); lf.lfCharSet = DEFAULT_CHARSET; - lf.lfFaceName[0] = L'\0'; // all fonts - lf.lfPitchAndFamily = 0; hdc = GetDC(hwndCombo); @@ -123,6 +122,10 @@ ChangeMapFont(HWND hDlg) 0, (LPARAM)lpFontName); } + + HeapFree(GetProcessHeap(), + 0, + lpFontName); } } @@ -250,12 +253,23 @@ DlgProc(HWND hDlg, } return TRUE; } - break; case WM_COMMAND: { switch(LOWORD(wParam)) { + case IDC_FONTMAP: + { + switch (HIWORD(wParam)) + { + case FM_SETCHAR: + AddCharToSelection(GetDlgItem(hDlg, IDC_TEXTBOX), + LOWORD(lParam)); + break; + } + } + break; + case IDC_FONTCOMBO: { if (HIWORD(wParam) == CBN_SELCHANGE) @@ -303,29 +317,6 @@ DlgProc(HWND hDlg, } break; - case WM_NOTIFY: - { - LPMAPNOTIFY lpnm = (LPMAPNOTIFY)lParam; - - switch (lpnm->hdr.idFrom) - { - case IDC_FONTMAP: - { - switch (lpnm->hdr.code) - { - case FM_SETCHAR: - { - AddCharToSelection(GetDlgItem(hDlg, IDC_TEXTBOX), - lpnm->ch); - } - break; - } - } - break; - } - } - break; - case WM_CLOSE: if (hSmIcon) DestroyIcon(hSmIcon); diff --git a/reactos/base/applications/charmap/map.c b/reactos/base/applications/charmap/map.c index 6b3825d50a2..358e5350e93 100644 --- a/reactos/base/applications/charmap/map.c +++ b/reactos/base/applications/charmap/map.c @@ -211,19 +211,16 @@ NotifyParentOfSelection(PMAP infoPtr, if (infoPtr->hParent != NULL) { - MAPNOTIFY mnmh; - - mnmh.hdr.hwndFrom = infoPtr->hMapWnd; - mnmh.hdr.idFrom = GetWindowLongPtr(infoPtr->hMapWnd, - GWLP_ID); - mnmh.hdr.code = code; - - mnmh.ch = ch; - - Ret = SendMessageW(infoPtr->hParent, - WM_NOTIFY, - (WPARAM)mnmh.hdr.idFrom, - (LPARAM)&mnmh); + DWORD dwIdc = GetWindowLongPtr(infoPtr->hMapWnd, GWLP_ID); + /* + * Push directly into the event queue instead of waiting + * the parent to be unlocked. + * High word of LPARAM is still available for future needs... + */ + Ret = PostMessage(infoPtr->hParent, + WM_COMMAND, + MAKELPARAM((WORD)dwIdc, (WORD)code), + (LPARAM)LOWORD(ch)); } return Ret; @@ -509,18 +506,8 @@ MapWndProc(HWND hwnd, } case FM_SETFONT: - { - LPWSTR lpFontName = (LPWSTR)lParam; - - SetFont(infoPtr, - lpFontName); - - HeapFree(GetProcessHeap(), - 0, - lpFontName); - + SetFont(infoPtr, (LPWSTR)lParam); break; - } case FM_GETCHAR: {