From a2acc6a448fcc00a6f69406af1bf733f5fff8912 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Sat, 14 Nov 1998 01:42:42 +0000 Subject: [PATCH] fix gtklayout so that it removes children properly. add a few more debugging messages to nsWidget and nsWindow --- widget/src/gtk/gtklayout.c | 1 + widget/src/gtk/nsWidget.cpp | 9 ++++----- widget/src/gtk/nsWindow.cpp | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/widget/src/gtk/gtklayout.c b/widget/src/gtk/gtklayout.c index 418d1eac809..c6b215da547 100644 --- a/widget/src/gtk/gtklayout.c +++ b/widget/src/gtk/gtklayout.c @@ -538,6 +538,7 @@ gtk_layout_remove (GtkContainer *container, child = tmp_list->data; if (child->widget == widget) break; + tmp_list=tmp_list->next; } if (tmp_list) diff --git a/widget/src/gtk/nsWidget.cpp b/widget/src/gtk/nsWidget.cpp index f0d0ed12e23..ca74b146e55 100644 --- a/widget/src/gtk/nsWidget.cpp +++ b/widget/src/gtk/nsWidget.cpp @@ -87,7 +87,8 @@ nsIWidget *nsWidget::GetParent(void) NS_METHOD nsWidget::Show(PRBool bState) { - g_print("nsWidget::Show(%6d) - %s %p\n", bState, mWidget->name, this); + g_print("nsWidget::Show(%6d) - %s %p\n", bState, mWidget->name, this); + if (bState) { if (mWidget) { gtk_widget_show(mWidget); @@ -348,10 +349,8 @@ void *nsWidget::GetNativeData(PRUint32 aDataType) { switch(aDataType) { case NS_NATIVE_WINDOW: - if (GTK_IS_LAYOUT(mWidget)) - return (void *)GTK_LAYOUT(mWidget)->bin_window; - else - return (void *)mWidget->window; + // return (void *)GTK_LAYOUT(mWidget)->bin_window; + return (void *)mWidget->parent->window; case NS_NATIVE_DISPLAY: return (void *)GDK_DISPLAY(); case NS_NATIVE_WIDGET: diff --git a/widget/src/gtk/nsWindow.cpp b/widget/src/gtk/nsWindow.cpp index 9ea1c84cb91..5ca8ba4c7bc 100644 --- a/widget/src/gtk/nsWindow.cpp +++ b/widget/src/gtk/nsWindow.cpp @@ -146,10 +146,9 @@ NS_METHOD nsWindow::CreateNative(GtkWidget *parentWidget) mVBox = gtk_vbox_new(FALSE, 0); gtk_widget_show (mVBox); gtk_container_add(GTK_CONTAINER(mainWindow), mVBox); - - gtk_widget_show (mWidget); gtk_box_pack_start(GTK_BOX(mVBox), mWidget, TRUE, TRUE, 0); } + gtk_widget_show(mWidget); // Force cursor to default setting gtk_widget_set_name(mWidget, "nsWindow"); mCursor = eCursor_select;