]> git.saurik.com Git - wxWidgets.git/blobdiff - src/dfb/window.cpp
implemented DrawPoint in terms of DrawLine (for now)
[wxWidgets.git] / src / dfb / window.cpp
index 532bf24b929d55819a465eeb713d9786a1763e8a..f2b090be72e044f10191c960c1c71af2afdcb366 100644 (file)
@@ -126,6 +126,10 @@ bool wxWindowDFB::Create(wxWindow *parent,
     if ( parent )
         parent->AddChild(this);
 
+    // set the size to something bogus initially, in case some code tries to
+    // create wxWindowDC before SetSize() is called below:
+    m_rect.width = m_rect.height = 1;
+
     int x, y, w, h;
     x = pos.x, y = pos.y;
     if ( x == -1  ) x = 0;
@@ -141,23 +145,21 @@ bool wxWindowDFB::Create(wxWindow *parent,
 // surface access
 // ---------------------------------------------------------------------------
 
-IDirectFBSurfacePtr wxWindowDFB::ObtainDfbSurface() const
+wxIDirectFBSurfacePtr wxWindowDFB::ObtainDfbSurface() const
 {
     wxCHECK_MSG( m_parent, NULL, _T("parentless window?") );
 
-    IDirectFBSurfacePtr parentSurface(m_parent->GetDfbSurface());
+    wxIDirectFBSurfacePtr parentSurface(m_parent->GetDfbSurface());
     wxCHECK_MSG( parentSurface, NULL, _T("invalid parent surface") );
 
     wxRect r(GetRect());
     AdjustForParentClientOrigin(r.x, r.y, 0);
     DFBRectangle rect = { r.x, r.y, r.width, r.height };
 
-    IDirectFBSurfacePtr surface;
-    DFB_CALL( parentSurface->GetSubSurface(parentSurface, &rect, &surface) );
-    return surface;
+    return parentSurface->GetSubSurface(&rect);
 }
 
-IDirectFBSurfacePtr wxWindowDFB::GetDfbSurface()
+wxIDirectFBSurfacePtr wxWindowDFB::GetDfbSurface()
 {
     if ( !m_surface )
     {
@@ -192,9 +194,9 @@ void wxWindowDFB::SetFocus()
 
 #warning "FIXME: implement in terms of DWET_{GOT,LOST}FOCUS"
 
-    IDirectFBWindowPtr dfbwin(m_tlw->GetDirectFBWindow());
+    wxIDirectFBWindowPtr dfbwin(m_tlw->GetDirectFBWindow());
 #warning "FIXME: RequestFocus() may only be called on visible TLW"
-    if ( !DFB_CALL( dfbwin->RequestFocus(dfbwin) ) )
+    if ( !dfbwin->RequestFocus() )
         return;
 
     gs_focusedWindow = this;
@@ -368,10 +370,10 @@ void wxWindowDFB::WarpPointer(int x, int y)
     if ( x >= w ) x = w-1;
     if ( y >= h ) y = h-1;
 
-    IDirectFBDisplayLayerPtr layer = wxDfbGetDisplayLayer();
+    wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer());
     wxCHECK_RET( layer, _T("no display layer") );
 
-    layer->WarpCursor(layer, x, y);
+    layer->WarpCursor(x, y);
 }
 
 // Set this window to be the child of 'parent'.
@@ -644,11 +646,10 @@ void wxWindowDFB::Thaw()
 
 void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
 {
-    if ( IsFrozen() )
-        return; // don't paint anything if the window is frozen
+    wxCHECK_RET( !IsFrozen() && IsShown(), _T("shouldn't be called") );
 
     wxLogTrace(TRACE_PAINT,
-               _T("%p ('%s'): paiting region [x=%i,y=%i,w=%i,h=%i]"),
+               _T("%p ('%s'): painting region [x=%i,y=%i,w=%i,h=%i]"),
                this, GetName().c_str(),
                rect.x, rect.y, rect.width, rect.height);
 
@@ -692,6 +693,9 @@ void wxWindowDFB::PaintWindow(const wxRect& rect, bool eraseBackground)
     {
         wxWindow *child = *i;
 
+        if ( child->IsFrozen() || !child->IsShown() )
+            continue; // don't paint anything if the window is frozen or hidden
+
         // compute child's area to repaint
         wxRect childrect(child->GetRect());
         childrect.Offset(origin);