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:
@@ -289,6 +289,10 @@ Sets *x and *y to the position at which the event occurred.
|
|||||||
|
|
||||||
Returns the physical mouse position in pixels.
|
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}
|
\membersection{wxMouseEvent::GetLogicalPosition}\label{wxmouseeventgetlogicalposition}
|
||||||
|
|
||||||
|
@@ -155,11 +155,6 @@ void wxRemoveHandleAssociation(wxWindowMSW *win);
|
|||||||
extern void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win);
|
extern void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win);
|
||||||
wxWindow *wxFindWinFromHandle(WXHWND hWnd);
|
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
|
// get the text metrics for the current font
|
||||||
static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win);
|
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
|
// special case of VK_APPS: treat it the same as right mouse
|
||||||
// click because both usually pop up a context menu
|
// click because both usually pop up a context menu
|
||||||
case VK_APPS:
|
case VK_APPS:
|
||||||
{
|
processed = HandleMouseEvent(WM_RBUTTONDOWN, -1, -1, 0);
|
||||||
WPARAM flags;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
TranslateKbdEventToMouse(this, &x, &y, &flags);
|
|
||||||
processed = HandleMouseEvent(WM_RBUTTONDOWN, x, y, flags);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif // VK_APPS
|
#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
|
// special case of VK_APPS: treat it the same as right mouse button
|
||||||
if ( wParam == VK_APPS )
|
if ( wParam == VK_APPS )
|
||||||
{
|
{
|
||||||
WPARAM flags;
|
processed = HandleMouseEvent(WM_RBUTTONUP, -1, -1, 0);
|
||||||
int x, y;
|
|
||||||
|
|
||||||
TranslateKbdEventToMouse(this, &x, &y, &flags);
|
|
||||||
processed = HandleMouseEvent(WM_RBUTTONUP, x, y, flags);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // VK_APPS
|
#endif // VK_APPS
|
||||||
@@ -5716,26 +5701,6 @@ const char *wxGetMessageName(int message)
|
|||||||
}
|
}
|
||||||
#endif //__WXDEBUG__
|
#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)
|
static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win)
|
||||||
{
|
{
|
||||||
// prepare the DC
|
// prepare the DC
|
||||||
|
Reference in New Issue
Block a user