simplify Refresh(), ancestors of a mapped window have to be mapped also, no point in checking

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2011-10-31 05:36:51 +00:00
parent 6d50fadaea
commit c968ba805b

View File

@@ -3593,44 +3593,29 @@ bool wxWindowGTK::ScrollPages(int pages)
void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground),
const wxRect *rect) const wxRect *rect)
{ {
if ( !m_widget ) if (m_widget == NULL || !gtk_widget_get_mapped(m_widget))
{
// it is valid to call Refresh() for a window which hasn't been created
// yet, it simply doesn't do anything in this case
return;
}
if (!m_wxwindow)
{
if (rect)
gtk_widget_queue_draw_area( m_widget, rect->x, rect->y, rect->width, rect->height );
else
gtk_widget_queue_draw( m_widget );
}
else
{
// Just return if the widget or one of its ancestors isn't mapped
GtkWidget *w;
for (w = m_wxwindow; w != NULL; w = gtk_widget_get_parent(w))
if (!gtk_widget_get_mapped (w))
return; return;
GdkWindow* window = GTKGetDrawingWindow(); if (m_wxwindow)
{
GdkWindow* window = gtk_widget_get_window(m_wxwindow);
if (rect) if (rect)
{ {
int x = rect->x; GdkRectangle r = { rect->x, rect->y, rect->width, rect->height };
if (GetLayoutDirection() == wxLayout_RightToLeft) if (GetLayoutDirection() == wxLayout_RightToLeft)
x = GetClientSize().x - x - rect->width; r.x = gdk_window_get_width(window) - r.x - rect->width;
GdkRectangle r;
r.x = rect->x;
r.y = rect->y;
r.width = rect->width;
r.height = rect->height;
gdk_window_invalidate_rect(window, &r, true); gdk_window_invalidate_rect(window, &r, true);
} }
else else
gdk_window_invalidate_rect(window, NULL, true); gdk_window_invalidate_rect(window, NULL, true);
} }
else
{
if (rect)
gtk_widget_queue_draw_area(m_widget, rect->x, rect->y, rect->width, rect->height);
else
gtk_widget_queue_draw(m_widget);
}
} }
void wxWindowGTK::Update() void wxWindowGTK::Update()