- // As with WM_HELP above, this message is propagated upwards
- // the parent chain by DefWindowProc() itself, so we should
- // always mark it as processed to prevent it from doing this
- // as this would result in duplicate calls to event handlers.
- processed = true;
+ // Ignore the events that are propagated from a child window by
+ // DefWindowProc(): as wxContextMenuEvent is already propagated
+ // upwards the window hierarchy by us, not doing this would
+ // result in duplicate events being sent.
+ WXHWND hWnd = (WXHWND)wParam;
+ if ( hWnd != m_hWnd )
+ {
+ wxWindowMSW *win = FindItemByHWND(hWnd);
+ if ( win && IsDescendant(win) )
+ {
+ // We had already generated wxContextMenuEvent when we
+ // got WM_CONTEXTMENU for that window.
+ processed = true;
+ break;
+ }
+ }