Huw Davies : riched20: Implement EM_SETREADONLY using EM_SETOPTIONS.

Alexandre Julliard julliard at winehq.org
Mon Mar 15 16:59:12 CDT 2021


Module: wine
Branch: master
Commit: 5d75cac480f1ab14b923137784a0a7583d986018
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5d75cac480f1ab14b923137784a0a7583d986018

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Mar 15 10:03:20 2021 +0000

riched20: Implement EM_SETREADONLY using EM_SETOPTIONS.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c  |  8 --------
 dlls/riched20/txthost.c | 11 ++++-------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 994e91ce3d5..4988f6e0746 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3779,14 +3779,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
     
     return 0;
   }
-  case EM_SETREADONLY:
-  {
-    if (wParam)
-      editor->styleFlags |= ES_READONLY;
-    else
-      editor->styleFlags &= ~ES_READONLY;
-    return 1;
-  }
   case EM_SETEVENTMASK:
   {
     DWORD nOldMask = editor->nEventMask;
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 278b0a64379..5bd11c5aba2 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -1002,14 +1002,11 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
     }
     case EM_SETREADONLY:
     {
-        DWORD style;
+        DWORD op = wparam ? ECOOP_OR : ECOOP_AND;
+        DWORD mask = wparam ? ECO_READONLY : ~ECO_READONLY;
 
-        res = ME_HandleMessage( editor, msg, wparam, lparam, unicode, &hr );
-        style = GetWindowLongW( hwnd, GWL_STYLE );
-        style &= ~ES_READONLY;
-        if (wparam) style |= ES_READONLY;
-        SetWindowLongW( hwnd, GWL_STYLE, style );
-        return res;
+        SendMessageW( hwnd, EM_SETOPTIONS, op, mask );
+        return 1;
     }
     case WM_SETTEXT:
     {




More information about the wine-cvs mailing list