]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed client<->window coords translations in DoMoveWindow and DoSetSize
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 23 Sep 2006 17:23:25 +0000 (17:23 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 23 Sep 2006 17:23:25 +0000 (17:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/dfb/window.cpp

index e205d4f89bcf5e1d9a27b13126c3ba2cc3a21926..121ffb80a5bcd85a1f6de709c41836d713004b41 100644 (file)
@@ -460,10 +460,21 @@ void wxWindowDFB::DoGetClientSize(int *x, int *y) const
 
 void wxWindowDFB::DoMoveWindow(int x, int y, int width, int height)
 {
+    // NB: [x,y] arguments are in (parent's) window coordinates, while
+    //     m_rect.{x,y} are in (parent's) client coordinates. That's why we
+    //     offset by parentOrigin in some places below
+
+    wxPoint parentOrigin(0, 0);
+    AdjustForParentClientOrigin(parentOrigin.x, parentOrigin.y);
+
     wxRect oldpos(m_rect);
+    oldpos.Offset(parentOrigin);
+
     wxRect newpos(x, y, width, height);
 
+    // input [x,y] is in window coords, but we store client coords in m_rect:
     m_rect = newpos;
+    m_rect.Offset(-parentOrigin);
 
     // window's position+size changed and so did the subsurface that covers it
     InvalidateDfbSurface();
@@ -472,9 +483,6 @@ void wxWindowDFB::DoMoveWindow(int x, int y, int width, int height)
     {
         // queue both former and new position of the window for repainting:
         wxWindow *parent = GetParent();
-        wxPoint origin(parent->GetClientAreaOrigin());
-        oldpos.Offset(origin);
-        newpos.Offset(origin);
         parent->RefreshRect(oldpos);
         parent->RefreshRect(newpos);
     }
@@ -508,8 +516,6 @@ void wxWindowDFB::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         return;
     }
 
-    AdjustForParentClientOrigin(x, y, sizeFlags);
-
     wxSize size(-1, -1);
     if ( width == -1 )
     {
@@ -557,6 +563,7 @@ void wxWindowDFB::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     if ( m_rect.x != x || m_rect.y != y ||
          m_rect.width != width || m_rect.height != height )
     {
+        AdjustForParentClientOrigin(x, y, sizeFlags);
         DoMoveWindow(x, y, width, height);
 
         wxSize newSize(width, height);