Implement wxGetMouseState
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2526,21 +2526,51 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
|
||||
return wxFindWindowAtPoint(pt);
|
||||
}
|
||||
|
||||
// Get the current mouse position.
|
||||
wxPoint wxGetMousePosition()
|
||||
void wxGetMouseState(int& rootX, int& rootY, unsigned& maskReturn)
|
||||
{
|
||||
Display *display = wxGlobalDisplay();
|
||||
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
|
||||
Window rootReturn, childReturn;
|
||||
int rootX, rootY, winX, winY;
|
||||
unsigned int maskReturn;
|
||||
int winX, winY;
|
||||
|
||||
XQueryPointer (display,
|
||||
rootWindow,
|
||||
&rootReturn,
|
||||
&childReturn,
|
||||
&rootX, &rootY, &winX, &winY, &maskReturn);
|
||||
return wxPoint(rootX, rootY);
|
||||
}
|
||||
|
||||
// Get the current mouse position.
|
||||
wxPoint wxGetMousePosition()
|
||||
{
|
||||
int x, y;
|
||||
unsigned mask;
|
||||
|
||||
wxGetMouseState(x, y, mask);
|
||||
return wxPoint(x, y);
|
||||
}
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
int x, y;
|
||||
unsigned mask;
|
||||
|
||||
wxGetMouseState(x, y, mask);
|
||||
|
||||
ms.SetX(x);
|
||||
ms.SetY(y);
|
||||
|
||||
ms.SetLeftDown(mask & Button1Mask);
|
||||
ms.SetMiddleDown(mask & Button2Mask);
|
||||
ms.SetRightDown(mask & Button3Mask);
|
||||
|
||||
ms.SetControlDown(mask & ControlMask);
|
||||
ms.SetShiftDown(mask & ShiftMask);
|
||||
ms.SetAltDown(mask & Mod1Mask);
|
||||
ms.SetMetaDown(mask & Mod2Mask);
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user