[ros-diffs] [gedmurphy] 30442: add part of the patch from bug 2805 with some minor changes See issue #2805 for more details.

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Wed Nov 14 14:05:52 CET 2007


Author: gedmurphy
Date: Wed Nov 14 16:05:51 2007
New Revision: 30442

URL: http://svn.reactos.org/svn/reactos?rev=30442&view=rev
Log:
add part of the patch from bug 2805 with some minor changes
See issue #2805 for more details.

Modified:
    trunk/reactos/base/applications/charmap/charmap.c
    trunk/reactos/base/applications/charmap/map.c

Modified: trunk/reactos/base/applications/charmap/charmap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/charmap/charmap.c?rev=30442&r1=30441&r2=30442&view=diff
==============================================================================
--- trunk/reactos/base/applications/charmap/charmap.c (original)
+++ trunk/reactos/base/applications/charmap/charmap.c Wed Nov 14 16:05:51 2007
@@ -68,9 +68,8 @@
                  (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 @@
                          0,
                          (LPARAM)lpFontName);
         }
+
+        HeapFree(GetProcessHeap(),
+                 0,
+                 lpFontName);
     }
 }
 
@@ -250,12 +253,23 @@
             }
             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 @@
         }
         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);

Modified: trunk/reactos/base/applications/charmap/map.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/charmap/map.c?rev=30442&r1=30441&r2=30442&view=diff
==============================================================================
--- trunk/reactos/base/applications/charmap/map.c (original)
+++ trunk/reactos/base/applications/charmap/map.c Wed Nov 14 16:05:51 2007
@@ -211,19 +211,16 @@
 
     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 @@
         }
 
         case FM_SETFONT:
-        {
-            LPWSTR lpFontName = (LPWSTR)lParam;
-
-            SetFont(infoPtr,
-                    lpFontName);
-
-            HeapFree(GetProcessHeap(),
-                     0,
-                     lpFontName);
-
-            break;
-        }
+            SetFont(infoPtr, (LPWSTR)lParam);
+            break;
 
         case FM_GETCHAR:
         {




More information about the Ros-diffs mailing list