[PATCH 1/4] riched20: Add support for TXTBIT_ALLOWBEEP.

Huw Davies huw at codeweavers.com
Wed Mar 31 06:23:03 CDT 2021


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/riched20/editor.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index fe05d1e7444..deb0a93c8dc 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -279,6 +279,11 @@ ME_Paragraph *editor_end_para( ME_TextEditor *editor )
     return &editor->pBuffer->pLast->member.para;
 }
 
+static BOOL editor_beep( ME_TextEditor *editor, UINT type )
+{
+    return editor->props & TXTBIT_ALLOWBEEP && MessageBeep( type );
+}
+
 static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStream *stream, ME_Style *style)
 {
   WCHAR *pText;
@@ -2281,7 +2286,7 @@ static BOOL paste_special(ME_TextEditor *editor, UINT cf, REPASTESPECIAL *ps, BO
     /* Protect read-only edit control from modification */
     if (editor->props & TXTBIT_READONLY)
     {
-        if (!check_only) MessageBeep(MB_ICONERROR);
+        if (!check_only) editor_beep( editor, MB_ICONERROR );
         return FALSE;
     }
 
@@ -2379,7 +2384,7 @@ static BOOL copy_or_cut( ME_TextEditor *editor, BOOL cut )
 
     count -= offs;
     hr = editor_copy_or_cut( editor, cut, sel_start, count, NULL );
-    if (FAILED( hr )) MessageBeep( MB_ICONERROR );
+    if (FAILED( hr )) editor_beep( editor, MB_ICONERROR );
 
     return SUCCEEDED( hr );
 }
@@ -2422,7 +2427,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
 
         if (editor->props & TXTBIT_READONLY)
         {
-            MessageBeep(MB_ICONERROR);
+            editor_beep( editor, MB_ICONERROR );
             return TRUE;
         }
 
@@ -2683,7 +2688,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
 
   if (editor->props & TXTBIT_READONLY)
   {
-    MessageBeep(MB_ICONERROR);
+    editor_beep( editor, MB_ICONERROR );
     return 0; /* FIXME really 0 ? */
   }
 
@@ -2737,7 +2742,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags )
       if (para_in_table( para ) && cursor.run->nFlags & MERF_ENDPARA && from == to)
       {
         /* Text should not be inserted at the end of the table. */
-        MessageBeep(-1);
+        editor_beep( editor, -1 );
         return 0;
       }
     }
@@ -2951,7 +2956,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
   ed->total_rows = 0;
   ITextHost_TxGetPropertyBits( ed->texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY |
                                TXTBIT_USEPASSWORD | TXTBIT_HIDESELECTION | TXTBIT_SAVESELECTION |
-                               TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_DISABLEDRAG,
+                               TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_ALLOWBEEP |
+                               TXTBIT_DISABLEDRAG,
                                &ed->props );
   ITextHost_TxGetScrollBars( ed->texthost, &ed->scrollbars );
   ed->pBuffer = ME_MakeText();
-- 
2.23.0




More information about the wine-devel mailing list