[PATCH] This patch fixes context menu crashes for edit controls as apparent in vb apps.
Michael Martin
martinmnet at hotmail.com
Sun Jun 7 05:24:57 CDT 2009
The following patch fixes 18130. In my tests, context menu for the Edit window control does not send the WM_COMMAND message.
Please comment.
dlls/user32/edit.c | 70 ++++++++++++++++++++-------------------------------
1 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index eadcc3d..601ffa5 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -3357,43 +3357,6 @@ static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
/*********************************************************************
*
- * WM_COMMAND
- *
- */
-static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND control)
-{
- if (code || control)
- return;
-
- switch (id) {
- case EM_UNDO:
- SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
- break;
- case WM_CUT:
- SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
- break;
- case WM_COPY:
- SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
- break;
- case WM_PASTE:
- SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
- break;
- case WM_CLEAR:
- SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
- break;
- case EM_SETSEL:
- EDIT_EM_SetSel(es, 0, (UINT)-1, FALSE);
- EDIT_EM_ScrollCaret(es);
- break;
- default:
- ERR("unknown menu item, please report\n");
- break;
- }
-}
-
-
-/*********************************************************************
- *
* WM_CONTEXTMENU
*
* Note: the resource files resource/sysres_??.rc cannot define a
@@ -3414,6 +3377,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
HMENU popup = GetSubMenu(menu, 0);
UINT start = es->selection_start;
UINT end = es->selection_end;
+ BOOL selectedMenuItem;
ORDER_UINT(start, end);
@@ -3440,7 +3404,33 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y)
y = rc.top + (rc.bottom - rc.top) / 2;
}
- TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, es->hwndSelf, NULL);
+ selectedMenuItem = TrackPopupMenu(popup, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TMPRETURNCMD, x, y, 0, es->hwndSelf, NULL);
+ switch (selectedMenuItem) {
+ case 0:
+ break;
+ case EM_UNDO:
+ SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
+ break;
+ case WM_CUT:
+ SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
+ break;
+ case WM_COPY:
+ SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
+ break;
+ case WM_PASTE:
+ SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
+ break;
+ case WM_CLEAR:
+ SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
+ break;
+ case EM_SETSEL:
+ EDIT_EM_SetSel(es, 0, (UINT)-1, FALSE);
+ EDIT_EM_ScrollCaret(es);
+ break;
+ default:
+ ERR("unknown menu item, please report\n");
+ break;
+ }
DestroyMenu(menu);
}
@@ -5192,10 +5182,6 @@ static LRESULT EditWndProc_common( HWND hwnd, UINT msg,
EDIT_WM_Clear(es);
break;
- case WM_COMMAND:
- EDIT_WM_Command(es, HIWORD(wParam), LOWORD(wParam), (HWND)lParam);
- break;
-
case WM_CONTEXTMENU:
EDIT_WM_ContextMenu(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
break;
_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090607/f8cdaa2a/attachment-0001.htm>
More information about the wine-patches
mailing list