riched20: WM_CONTEXTMENU fix for custom context menus [RESUBMISSION]

Mark Lu excelblue at gmail.com
Sat Sep 2 22:08:46 CDT 2006


ChangeLog:
* Fixed context menu display for editors with custom context menus.

Author: Hippocrates Sendoukas <hsendoukas at hotmail.com>
Submitter: Mark Lu <excelblue at gmail.com>

This is a resubmission due to problems with line breaks earlier.

-- 
Mark Lu
-------------- next part --------------
From 7e3fd85fec0622de4487bf79f3196531725befb7 Mon Sep 17 00:00:00 2001
From: kilgore <excelblue at wave.(none)>
Date: Sat, 2 Sep 2006 13:53:09 -0700
Subject: riched20: WM_CONTEXTMENU fix

ChangeLog:
* Fixed context menu display for editors with custom context menus.

Author: Hippocrates Sendoukas <hsendoukas at hotmail.com>
Submitter: Mark Lu <excelblue at gmail.com>

---
 dlls/riched20/editor.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index fa43e1f..2b20377 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1077,13 +1077,13 @@ ME_KeyDown(ME_TextEditor *editor, WORD n
   return FALSE;
 }
 
-static void ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
+static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
 {
   CHARRANGE selrange;
   HMENU menu;
   int seltype = 0;
   if(!editor->lpOleCallback)
-    return;
+    return FALSE;
   ME_GetSelection(editor, (int *)&selrange.cpMin, (int *)&selrange.cpMax);
   if(selrange.cpMin == selrange.cpMax)
     seltype |= SEL_EMPTY;
@@ -1099,6 +1099,7 @@ static void ME_ShowContextMenu(ME_TextEd
     TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, GetParent(editor->hWnd), NULL);
     DestroyMenu(menu);
   }
+  return TRUE;
 }
 
 ME_TextEditor *ME_MakeEditor(HWND hWnd) {
@@ -2335,7 +2336,10 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
     ME_SelectWord(editor);
     break;
   case WM_CONTEXTMENU:
-    ME_ShowContextMenu(editor, (short)LOWORD(lParam), (short)HIWORD(lParam));
+    if (!ME_ShowContextMenu(editor, (short)LOWORD(lParam), (short)HIWORD(lParam)))
+    {
+	goto do_default;
+    }
     break;
   case WM_PAINT:
     if (editor->bRedraw)
-- 
1.4.1.1


More information about the wine-patches mailing list