summaryrefslogtreecommitdiff
path: root/gtk/gtkplug.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-10-03 20:53:30 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-10-03 20:53:30 +0000
commitef33adff83617e2c937052316b9fb925d4972252 (patch)
treec6badff88c8dca205f9013043ab12c7f68db5903 /gtk/gtkplug.c
parent6cb79658c2a64d01f6e488f065eb2d265be97414 (diff)
downloadgtk+-ef33adff83617e2c937052316b9fb925d4972252.tar.gz
Add a 'type' parameter, make public.
Thu Oct 3 14:13:33 2002 Owen Taylor <otaylor@redhat.com> * gdk/gdkevents.c (gdk_event_new): Add a 'type' parameter, make public. * gdk/gdkevents.c (gdk_event_copy): Copy the screen. * gdk/gdkevents.c gdk/linux-fb/gdkmain-fb.c gdk/x11/gdkevents-x11.c gdk/win32/gdkevents-win32.c: _gdk_event_new() => gdk_event_new(). * gdk/win32/gdkevents-win32.c (real_window_procedure): Fix event_private->screen breakage that results from evil encapsulation breakage here. * gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkcontainer.c gtk/gtkdialog.c gtk/gtkdnd.c gtk/gtkdrawingarea.c gtk/gtkimcontextsimple.c gtk/gtklist.c gtk/gtkmenu.c gtk/gtknotebook.c gtk/gtkplug.c gtk/gtkselection.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeview.c gtk/gtkviewport.c gtk/gtkwindow-decorate.c gtk/gtkwindow.c tests/testgtk.c: Remove most usage of stack-allocated GdkEvent structures. * gtk/gtktreeview.c: Use a cut-and-paste of the full send_focus_event() from gtkwindow.c that does the necessary notification of the ::has-focus property and setting of the HAS_FOCUS flag.x * gtk/gtkdnd.c: Clean up some mess/duplicated code; removing an extraneous use of a GdkEvent.
Diffstat (limited to 'gtk/gtkplug.c')
-rw-r--r--gtk/gtkplug.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 68554ec738..0ba21ce5a6 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -247,6 +247,24 @@ _gtk_plug_add_to_socket (GtkPlug *plug,
g_signal_emit_by_name (G_OBJECT (socket), "plug_added", 0);
}
+static void
+send_delete_event (GtkWidget *widget)
+{
+ GdkEvent *event = gdk_event_new (GDK_DELETE);
+
+ event->any.window = g_object_ref (widget->window);
+ event->any.send_event = FALSE;
+
+ gtk_widget_ref (widget);
+
+ if (!gtk_widget_event (widget, event))
+ gtk_widget_destroy (widget);
+
+ gtk_widget_unref (widget);
+
+ gdk_event_free (event);
+}
+
/**
* _gtk_plug_remove_from_socket:
* @plug: a #GtkPlug
@@ -259,7 +277,6 @@ _gtk_plug_remove_from_socket (GtkPlug *plug,
GtkSocket *socket)
{
GtkWidget *widget;
- GdkEvent event;
gboolean result;
gboolean widget_was_visible;
@@ -298,14 +315,8 @@ _gtk_plug_remove_from_socket (GtkPlug *plug,
if (!result)
gtk_widget_destroy (GTK_WIDGET (socket));
- event.any.type = GDK_DELETE;
- event.any.window = g_object_ref (widget->window);
- event.any.send_event = FALSE;
-
- if (!gtk_widget_event (widget, &event))
- gtk_widget_destroy (widget);
-
- g_object_unref (event.any.window);
+ send_delete_event (widget);
+
g_object_unref (plug);
if (widget_was_visible && GTK_WIDGET_VISIBLE (socket))
@@ -1110,18 +1121,7 @@ gtk_plug_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
*/
if (xre->parent == GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen)))
- {
- GdkEvent event;
-
- event.any.type = GDK_DELETE;
- event.any.window = g_object_ref (widget->window);
- event.any.send_event = FALSE;
-
- if (!gtk_widget_event (widget, &event))
- gtk_widget_destroy (widget);
-
- g_object_unref (event.any.window);
- }
+ send_delete_event (widget);
}
else
goto done;