X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed2fbeb835854c97d176f8bdfd6f06a84273f5d7..2ea6c1f77a260bef70d4a699df6c1d5ad1487f6a:/src/motif/window.cpp diff --git a/src/motif/window.cpp b/src/motif/window.cpp index e23a9c5906..d5b4b71854 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/motif/windows.cpp +// Name: src/motif/window.cpp // Purpose: wxWindow // Author: Julian Smart // Modified by: @@ -39,10 +39,10 @@ #include "wx/settings.h" #include "wx/scrolwin.h" #include "wx/layout.h" + #include "wx/menuitem.h" #endif #include "wx/module.h" -#include "wx/menuitem.h" #include "wx/evtloop.h" #if wxUSE_DRAG_AND_DROP @@ -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 & Mod3Mask); + ms.SetMetaDown(mask & Mod1Mask); + + return ms; }