]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/control.cpp
added forward declaration of FrameSite apparently needed by mingw32 4.3
[wxWidgets.git] / src / gtk / control.cpp
index c2959403d6a35f86d00d34c27f9fef6007dd91e5..06ca9c1de723bc7a52c05152223cd643af3d1dc9 100644 (file)
@@ -60,13 +60,18 @@ wxSize wxControl::DoGetBestSize() const
     // Do not return any arbitrary default value...
     wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
 
-    GtkRequisition req;
-    req.width = 2;
-    req.height = 2;
-    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
-        (m_widget, &req );
-
-    wxSize best(req.width, req.height);
+    wxSize best;
+    if (m_wxwindow)
+    {
+        // this is not a native control, size_request is likely to be (0,0)
+        best = wxControlBase::DoGetBestSize();
+    }
+    else
+    {
+        GtkRequisition req;
+        GTK_WIDGET_GET_CLASS(m_widget)->size_request(m_widget, &req);
+        best.Set(req.width, req.height);
+    }
     CacheBestSize(best);
     return best;
 }
@@ -297,7 +302,7 @@ void wxControl::OnInternalIdle()
         GTKUpdateCursor();
     }
 
-    if ( wxUpdateUIEvent::CanUpdate(this) )
+    if ( wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen() )
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }