When we receive an unexpected destroy notify on one of our windows, don't

Thu Sep  2 16:33:59 1999  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkwindow.c: When we receive an unexpected
	destroy notify on one of our windows, don't just
	warn about it, also mark our windows as destroyed.

	* gtk/gtkmain.c: Ignore unexpected destroy notifies
	for children, for toplevel windows handle them
	like delete_event.

	* gtk/gtkplug.c: Add an unrealize handler so that
	we unref plug->socket_window when we are done
	with it.
This commit is contained in:
Owen Taylor
1999-09-03 20:08:13 +00:00
committed by Owen Taylor
parent 3abc634152
commit 22a15408bb
11 changed files with 142 additions and 11 deletions

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -1,3 +1,17 @@
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness

View File

@@ -699,10 +699,10 @@ gdk_window_destroy_notify (GdkWindow *window)
if (!private->destroyed)
{
if (private->window_type == GDK_WINDOW_FOREIGN)
gdk_window_internal_destroy (window, FALSE, FALSE);
else
if (private->window_type != GDK_WINDOW_FOREIGN)
g_warning ("GdkWindow %#lx unexpectedly destroyed", private->xwindow);
gdk_window_internal_destroy (window, FALSE, FALSE);
}
gdk_xid_table_remove (private->xwindow);

View File

@@ -699,10 +699,10 @@ gdk_window_destroy_notify (GdkWindow *window)
if (!private->destroyed)
{
if (private->window_type == GDK_WINDOW_FOREIGN)
gdk_window_internal_destroy (window, FALSE, FALSE);
else
if (private->window_type != GDK_WINDOW_FOREIGN)
g_warning ("GdkWindow %#lx unexpectedly destroyed", private->xwindow);
gdk_window_internal_destroy (window, FALSE, FALSE);
}
gdk_xid_table_remove (private->xwindow);

View File

@@ -685,11 +685,17 @@ gtk_main_do_event (GdkEvent *event)
break;
case GDK_DESTROY:
gtk_widget_ref (event_widget);
gtk_widget_event (event_widget, event);
if (!GTK_OBJECT_DESTROYED (event_widget))
gtk_widget_destroy (event_widget);
gtk_widget_unref (event_widget);
/* Unexpected GDK_DESTROY from the outside, ignore for
* child windows, handle like a GDK_DELETE for toplevels
*/
if (!event_widget->parent)
{
gtk_widget_ref (event_widget);
if (!gtk_widget_event (event_widget, event) &&
!GTK_OBJECT_DESTROYED (event_widget))
gtk_widget_destroy (event_widget);
gtk_widget_unref (event_widget);
}
break;
case GDK_PROPERTY_NOTIFY:

View File

@@ -33,6 +33,7 @@ static void gtk_plug_class_init (GtkPlugClass *klass);
static void gtk_plug_init (GtkPlug *plug);
static void gtk_plug_realize (GtkWidget *widget);
static void gtk_plug_unrealize (GtkWidget *widget);
static gint gtk_plug_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static void gtk_plug_forward_key_press (GtkPlug *plug, GdkEventKey *event);
@@ -44,6 +45,8 @@ static void gtk_plug_set_focus (GtkWindow *window,
/* From Tk */
#define EMBEDDED_APP_WANTS_FOCUS NotifyNormal+20
static GtkWindowClass *parent_class = NULL;
guint
gtk_plug_get_type ()
{
@@ -77,7 +80,10 @@ gtk_plug_class_init (GtkPlugClass *class)
widget_class = (GtkWidgetClass *)class;
window_class = (GtkWindowClass *)class;
parent_class = gtk_type_class (gtk_window_get_type ());
widget_class->realize = gtk_plug_realize;
widget_class->unrealize = gtk_plug_unrealize;
widget_class->key_press_event = gtk_plug_key_press_event;
widget_class->focus_in_event = gtk_plug_focus_in_event;
widget_class->focus_out_event = gtk_plug_focus_out_event;
@@ -119,6 +125,27 @@ gtk_plug_new (guint32 socket_id)
return GTK_WIDGET (plug);
}
static void
gtk_plug_unrealize (GtkWidget *widget)
{
GtkPlug *plug;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PLUG (widget));
plug = GTK_PLUG (widget);
if (plug->socket_window != NULL)
{
gdk_window_set_user_data (plug->socket_window, NULL);
gdk_window_unref (plug->socket_window);
plug->socket_window = NULL;
}
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
static void
gtk_plug_realize (GtkWidget *widget)
{