use a different method to prevent an early size_allocate,
removing child has undesirable size effects, such as unsetting the default widget git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -774,22 +774,16 @@ bool wxTopLevelWindowGTK::Show( bool show )
|
|||||||
// what wxWidgets expects it to be without an obvious change in the
|
// what wxWidgets expects it to be without an obvious change in the
|
||||||
// window size immediately after it becomes visible.
|
// window size immediately after it becomes visible.
|
||||||
|
|
||||||
// Realize m_widget, so m_widget->window can be used. Realizing causes
|
// Realize m_widget, so m_widget->window can be used. Realizing normally
|
||||||
// the widget tree to be size_allocated, which generates size events in
|
// causes the widget tree to be size_allocated, which generates size
|
||||||
// the wrong order. So temporarily remove child from m_widget while
|
// events in the wrong order. However, the size_allocates will not be
|
||||||
// realizing.
|
// done if the allocation is not the default (1,1).
|
||||||
GtkWidget* child = GTK_BIN(m_widget)->child;
|
const int alloc_width = m_widget->allocation.width;
|
||||||
if (child)
|
if (alloc_width == 1)
|
||||||
{
|
m_widget->allocation.width = 2;
|
||||||
g_object_ref(child);
|
|
||||||
gtk_container_remove(GTK_CONTAINER(m_widget), child);
|
|
||||||
}
|
|
||||||
gtk_widget_realize(m_widget);
|
gtk_widget_realize(m_widget);
|
||||||
if (child)
|
if (alloc_width == 1)
|
||||||
{
|
m_widget->allocation.width = 1;
|
||||||
gtk_container_add(GTK_CONTAINER(m_widget), child);
|
|
||||||
g_object_unref(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_deferShow =
|
m_deferShow =
|
||||||
deferShow = gdk_x11_screen_supports_net_wm_hint(
|
deferShow = gdk_x11_screen_supports_net_wm_hint(
|
||||||
@@ -1004,11 +998,8 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const wxSize& decorSize)
|
|||||||
m_height += diff.y;
|
m_height += diff.y;
|
||||||
if (m_width < 0) m_width = 0;
|
if (m_width < 0) m_width = 0;
|
||||||
if (m_height < 0) m_height = 0;
|
if (m_height < 0) m_height = 0;
|
||||||
if (!m_deferShow)
|
m_oldClientWidth = 0;
|
||||||
{
|
gtk_widget_queue_resize(m_wxwindow);
|
||||||
m_oldClientWidth = 0;
|
|
||||||
gtk_widget_queue_resize(m_wxwindow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_deferShow)
|
if (m_deferShow)
|
||||||
|
Reference in New Issue
Block a user