riched32: implements WM_UNICHAR for richedit in editor

Hongbo Ni hongbo at njstar.com
Wed Jul 23 06:55:46 CDT 2008


riched32: implements WM_UNICHAR for richedit in editor.c

---
 dlls/riched20/editor.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 9bed787..6c390fb 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -140,7 +140,7 @@
   + WM_SETTEXT (resets undo stack !) (proper style?) ANSI&Unicode
   - WM_STYLECHANGING
   - WM_STYLECHANGED (things like read-only flag)
-  - WM_UNICHAR
+  + WM_UNICHAR
 
   Notifications
 
@@ -2094,7 +2094,6 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
   UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX)
   UNSUPPORTED_MSG(WM_STYLECHANGING)
   UNSUPPORTED_MSG(WM_STYLECHANGED)
-/*  UNSUPPORTED_MSG(WM_UNICHAR) FIXME missing in Wine headers */
 
 /* Messages specific to Richedit controls */
 
@@ -3242,6 +3241,27 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
     }
     return 0;
   }
+  case WM_UNICHAR:
+    if(wParam == UNICODE_NOCHAR)
+        return unicode? TRUE:FALSE;
+    else if(unicode)
+    {
+        UINT uc = wParam;
+        if(uc <= 0x000FFFFF)
+        {
+            if(uc > 0xFFFF) /* convert to surrogates */
+            {
+                WCHAR wc;
+                uc -= (UINT)0x00010000;
+                wc =(WCHAR)(uc >> 10) + 0xD800;
+                SendMessageW(editor->hWnd, WM_CHAR, (WPARAM)wc, 0);
+                uc =(WCHAR)(uc & 0x0000003FF) + 0xDC00;
+            }
+            SendMessageW(editor->hWnd, WM_CHAR, (WPARAM)uc, 0);
+        }
+        return 0; /* should return zero if processes this message */
+    }
+    break;
   case EM_STOPGROUPTYPING:
     ME_CommitUndo(editor); /* End coalesced undos for typed characters */
     return 0;
-- 
1.5.6.1.1071.g76fb





More information about the wine-patches mailing list