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
This commit is contained in:
Vadim Zeitlin 2004-09-27 20:52:10 +00:00
parent 1eef64d836
commit ae177b45b2
2 changed files with 6 additions and 37 deletions

View File

@ -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}

View File

@ -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