]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/window.cpp
Don't emit bogus size events if a child window
[wxWidgets.git] / src / x11 / window.cpp
index f2b103189ca2051dfcf08492a20520efece50e0a..7c5cc615f21c2869ffb4623a8459a3769ec73b1d 100644 (file)
     #include "wx/timer.h"
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/timer.h"
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
+    #include "wx/scrolbar.h"
+    #include "wx/listbox.h"
+    #include "wx/scrolwin.h"
+    #include "wx/layout.h"
+    #include "wx/menuitem.h"
 #endif
 
 #endif
 
-#include "wx/layout.h"
-#include "wx/listbox.h"
-#include "wx/scrolwin.h"
-#include "wx/scrolbar.h"
 #include "wx/module.h"
 #include "wx/module.h"
-#include "wx/menuitem.h"
 #include "wx/fontutil.h"
 #include "wx/univ/renderer.h"
 
 #include "wx/fontutil.h"
 #include "wx/univ/renderer.h"
 
@@ -1111,7 +1111,7 @@ void wxWindowX11::GetTextExtent(const wxString& string,
 
     int direction, ascent, descent2;
     XCharStruct overall;
 
     int direction, ascent, descent2;
     XCharStruct overall;
-    int slen = string.Len();
+    int slen = string.length();
 
     XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
                  &direction, &ascent, &descent2, &overall);
 
     XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
                  &direction, &ascent, &descent2, &overall);
@@ -1626,28 +1626,59 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt)
     return wxFindWindowAtPoint(wxGetMousePosition());
 }
 
     return wxFindWindowAtPoint(wxGetMousePosition());
 }
 
-// Get the current mouse position.
-wxPoint wxGetMousePosition()
+void wxGetMouseState(int& rootX, int& rootY, unsigned& maskReturn)
 {
 #if wxUSE_NANOX
     /* TODO */
 {
 #if wxUSE_NANOX
     /* TODO */
-    return wxPoint(0, 0);
+    rootX = rootY = 0;
+    maskReturn = 0;
 #else
     Display *display = wxGlobalDisplay();
     Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
     Window rootReturn, childReturn;
 #else
     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);
 
     XQueryPointer (display,
                    rootWindow,
                    &rootReturn,
                    &childReturn,
                    &rootX, &rootY, &winX, &winY, &maskReturn);
-    return wxPoint(rootX, rootY);
 #endif
 }
 
 #endif
 }
 
+// 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;
+}
+
 
 // ----------------------------------------------------------------------------
 // wxNoOptimize: switch off size optimization
 
 // ----------------------------------------------------------------------------
 // wxNoOptimize: switch off size optimization