]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/window.cpp
fixed memory leak in RestoreState
[wxWidgets.git] / src / x11 / window.cpp
index 13b0e790db9610a6aa42828983ca8fb9c67a7e26..2e2df49db87ac9102ed8a3bc714b0a68b9c8d55c 100644 (file)
@@ -160,6 +160,8 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
     if (pos2.y == wxDefaultCoord)
         pos2.y = 0;
 
+    AdjustForParentClientOrigin(pos2.x, pos2.y);
+
 #if wxUSE_TWO_WINDOWS
     bool need_two_windows =
         ((( wxSUNKEN_BORDER | wxRAISED_BORDER | wxSIMPLE_BORDER | wxHSCROLL | wxVSCROLL ) & m_windowStyle) != 0);
@@ -818,6 +820,7 @@ void wxWindowX11::DoClientToScreen(int *x, int *y) const
     Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display));
     Window thisWindow = (Window) m_clientWindow;
 
+    Window childWindow;
     int xx = x ? *x : 0;
     int yy = y ? *y : 0;
     XTranslateCoordinates(display, thisWindow, rootWindow,
@@ -1119,7 +1122,7 @@ void wxWindowX11::GetTextExtent(const wxString& string,
     XCharStruct overall;
     int slen = string.length();
 
-    XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
+    XTextExtents((XFontStruct*) pFontStruct, (const char*) string.c_str(), slen,
                  &direction, &ascent, &descent2, &overall);
 
     if ( x )
@@ -1462,6 +1465,22 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
                     eventType = wxEVT_RIGHT_DOWN;
                     button = 3;
                 }
+                else if ( xevent->xbutton.button == Button4 ||
+                            xevent->xbutton.button == Button5 )
+                {
+                    // this is the same value as used under wxMSW
+                    static const int WHEEL_DELTA = 120;
+
+                    eventType = wxEVT_MOUSEWHEEL;
+                    button = xevent->xbutton.button;
+
+                    wxevent.m_linesPerAction = 3;
+                    wxevent.m_wheelDelta = WHEEL_DELTA;
+
+                    // Button 4 means mousewheel up, 5 means down
+                    wxevent.m_wheelRotation = button == Button4 ? WHEEL_DELTA
+                                                                : -WHEEL_DELTA;
+                }
 
                 // check for a double click
                 // TODO: where can we get this value from?