From ae177b45b258b4985ee8c9ce7848bcb4f1266f80 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 27 Sep 2004 20:52:10 +0000 Subject: [PATCH] set click coordinates to (-1, -1) if right mouse button event was generated from the keyboard git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/mouseevt.tex | 4 ++++ src/msw/window.cpp | 39 ++------------------------------------ 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/docs/latex/wx/mouseevt.tex b/docs/latex/wx/mouseevt.tex index 03d2f74f6d..2b061529c5 100644 --- a/docs/latex/wx/mouseevt.tex +++ b/docs/latex/wx/mouseevt.tex @@ -289,6 +289,10 @@ Sets *x and *y to the position at which the event occurred. Returns the physical mouse position in pixels. +Note that if the mouse event has been artificially generated from a special +keyboard combination (e.g. under Windows when the ``menu'' key is pressed), the +returned position is \texttt{wxDefaultPosition}. + \membersection{wxMouseEvent::GetLogicalPosition}\label{wxmouseeventgetlogicalposition} diff --git a/src/msw/window.cpp b/src/msw/window.cpp index bb0520b14b..d90ee63d4d 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -155,11 +155,6 @@ void wxRemoveHandleAssociation(wxWindowMSW *win); extern void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win); wxWindow *wxFindWinFromHandle(WXHWND hWnd); -// this magical function is used to translate VK_APPS key presses to right -// mouse clicks -static void TranslateKbdEventToMouse(wxWindowMSW *win, - int *x, int *y, WPARAM *flags); - // get the text metrics for the current font static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win); @@ -2662,13 +2657,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l // special case of VK_APPS: treat it the same as right mouse // click because both usually pop up a context menu case VK_APPS: - { - WPARAM flags; - int x, y; - - TranslateKbdEventToMouse(this, &x, &y, &flags); - processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, flags); - } + processed = HandleMouseEvent(WM_RBUTTONDOWN, -1, -1, 0); break; #endif // VK_APPS @@ -2687,11 +2676,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l // special case of VK_APPS: treat it the same as right mouse button if ( wParam == VK_APPS ) { - WPARAM flags; - int x, y; - - TranslateKbdEventToMouse(this, &x, &y, &flags); - processed = HandleMouseEvent(WM_RBUTTONUP, x, y, flags); + processed = HandleMouseEvent(WM_RBUTTONUP, -1, -1, 0); } else #endif // VK_APPS @@ -5716,26 +5701,6 @@ const char *wxGetMessageName(int message) } #endif //__WXDEBUG__ -static void TranslateKbdEventToMouse(wxWindowMSW *win, - int *x, int *y, WPARAM *flags) -{ - // construct the key mask - WPARAM& fwKeys = *flags; - - fwKeys = MK_RBUTTON; - if ( wxIsCtrlDown() ) - fwKeys |= MK_CONTROL; - if ( wxIsShiftDown() ) - fwKeys |= MK_SHIFT; - - // simulate right mouse button click - DWORD dwPos = ::GetMessagePos(); - *x = GET_X_LPARAM(dwPos); - *y = GET_Y_LPARAM(dwPos); - - win->ScreenToClient(x, y); -} - static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win) { // prepare the DC -- 2.47.2