diff options
author | Tim Janik <timj@gimp.org> | 1998-02-05 03:53:41 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-02-05 03:53:41 +0000 |
commit | 9258a7aecb1dfdff5fb0c91dee4c1a9a1d3cf13c (patch) | |
tree | dc0d64f09d14108d1aebc5a6f69ddc1e359f08b6 | |
parent | f82814760ece61d9c7e500bbaae2696ec84cc50c (diff) | |
download | gtk+-9258a7aecb1dfdff5fb0c91dee4c1a9a1d3cf13c.tar.gz |
new function to perform the same actions as gtk_list_remove_items, but
Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtklist.h:
* gtk/gtklist.c (gtk_list_remove_items_no_unref): new function
to perform the same actions as gtk_list_remove_items, but
supply the removed widgets with an additional reference count.
* gtk/gtkmain.c (gtk_main_iteration_do): ignore events
with event_widget == NULL, since they are bogus events
from destroyed GdkWindows, exept for the case where
event->type==GDK_PROPERTY_NOTIFY. Always handle expired
timeout functions when returning from this function.
* gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events
if event->window == NULL. Also, if this function couldn't handle
the event for any reason (including failing assumptions), make
the return value to look as if the event had been handled to
avoid further processing (and warnings).
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: remove gtk_widget_sink, because there is
no point in providing such a function.
* gdk/gdk.c (gdk_init): changed options `-name' and `-class'
to `--name' and `--class', because the old names would
confuse getopt(). these arguments have been introduced in the
changes from gtk+970916 to gtk+970925 without a ChangeLog entry,
changing argument names is painful, it would be nice if people
would care about compatibility and consistency in the first place!
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 39 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 39 | ||||
-rw-r--r-- | docs/refcounting.txt | 8 | ||||
-rw-r--r-- | gdk/gdk.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 4 | ||||
-rw-r--r-- | gtk/gtklist.c | 49 | ||||
-rw-r--r-- | gtk/gtklist.h | 54 | ||||
-rw-r--r-- | gtk/gtkmain.c | 68 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 24 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 1 |
15 files changed, 389 insertions, 96 deletions
@@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b6661bda63..cb37785d77 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,4 +1,42 @@ +Thu Feb 5 02:13:08 1998 Tim Janik <timj@gimp.org> + + * gtk/gtklist.h: + * gtk/gtklist.c (gtk_list_remove_items_no_unref): new function + to perform the same actions as gtk_list_remove_items, but + supply the removed widgets with an additional reference count. + + * gtk/gtkmain.c (gtk_main_iteration_do): ignore events + with event_widget == NULL, since they are bogus events + from destroyed GdkWindows, exept for the case where + event->type==GDK_PROPERTY_NOTIFY. Always handle expired + timeout functions when returning from this function. + + * gtk/gtkwidget.c (gtk_widget_event): ignore GDK_EXPOSE events + if event->window == NULL. Also, if this function couldn't handle + the event for any reason (including failing assumptions), make + the return value to look as if the event had been handled to + avoid further processing (and warnings). + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: remove gtk_widget_sink, because there is + no point in providing such a function. + + * gdk/gdk.c (gdk_init): changed options `-name' and `-class' + to `--name' and `--class', because the old names would + confuse getopt(). these arguments have been introduced in the + changes from gtk+970916 to gtk+970925 without a ChangeLog entry, + changing argument names is painful, it would be nice if people + would care about compatibility and consistency in the first place! + Tue Feb 3 15:09:55 1998 Tim Janik <timj@gimp.org> + + * docs/widget_system.txt: new file containing notes about + the inner workings of the widget system of GTK+, a widget + flag description and certain invariants about widget states. + + * docs/refcounting.txt: moved file (previously REFCOUNTING) + introducing The Reference Counting Scheme of GDK an GTK+. + lots of additions/corrections. * gtk/gtksignal.c (gtk_signal_real_emit): for the emission of AFTER signals, fetch the objects signals via @@ -280,7 +318,6 @@ Sat Jan 31 23:55:03 1998 Tim Janik <timj@gimp.org> * gtk/testgtk.c: some changes because of all the above ;) ->>>>>>> 1.103 Sat Jan 31 21:26:27 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c: Added a new GTK_IN_REPARENT flag and revised diff --git a/docs/refcounting.txt b/docs/refcounting.txt index 2315db62d2..aa8823e225 100644 --- a/docs/refcounting.txt +++ b/docs/refcounting.txt @@ -278,6 +278,13 @@ Example code sequences that require reference wraps: gtk_widget_unref (GTK_WIDGET (tmp->data)); g_slist_free_1 (tmp); } + + /* Alternatively to the removal above you could just use + * gtk_list_remove_items_no_unref() which will add the additional + * reference count to the widget. + */ + gtk_list_remove_items_no_unref (list, item_list); + gtk_list_prepend_items (other_list, item_list); Now a (hopefully) complete list of functions that require @@ -308,7 +315,6 @@ Events that a likely to trigger a missing check for the window pointer currently are (and correspond to the trailing signals): GDK_SELECTION_CLEAR GtkWidget::selection_clear_event -GDK_EXPOSE GtkWidget::expose_event GDK_FOCUS_CHANGE GtkWidget::focus_in_event GtkWidget::focus_out_event @@ -331,7 +331,7 @@ gdk_init (int *argc, (*argv)[i] = NULL; } } - else if (strcmp ("-name", (*argv)[i]) == 0) + else if (strcmp ("--name", (*argv)[i]) == 0) { if ((i + 1) < *argc) { @@ -340,7 +340,7 @@ gdk_init (int *argc, (*argv)[i] = NULL; } } - else if (strcmp ("-class", (*argv)[i]) == 0) + else if (strcmp ("--class", (*argv)[i]) == 0) { if ((i + 1) < *argc) { diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index ad62f9bc68..5caa6cdd6a 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -331,7 +331,7 @@ gdk_init (int *argc, (*argv)[i] = NULL; } } - else if (strcmp ("-name", (*argv)[i]) == 0) + else if (strcmp ("--name", (*argv)[i]) == 0) { if ((i + 1) < *argc) { @@ -340,7 +340,7 @@ gdk_init (int *argc, (*argv)[i] = NULL; } } - else if (strcmp ("-class", (*argv)[i]) == 0) + else if (strcmp ("--class", (*argv)[i]) == 0) { if ((i + 1) < *argc) { diff --git a/gtk/gtklist.c b/gtk/gtklist.c index b5c63a20c4..d9050b2feb 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -314,37 +314,40 @@ gtk_list_prepend_items (GtkList *list, gtk_list_insert_items (list, items, 0); } -void -gtk_list_remove_items (GtkList *list, - GList *items) +static void +gtk_list_remove_items_internal (GtkList *list, + GList *items, + gboolean no_unref) { GtkWidget *widget; GList *selected_widgets; GList *tmp_list; - + g_return_if_fail (list != NULL); g_return_if_fail (GTK_IS_LIST (list)); - + tmp_list = items; selected_widgets = NULL; widget = NULL; - + while (tmp_list) { widget = tmp_list->data; tmp_list = tmp_list->next; - + if (widget->state == GTK_STATE_SELECTED) selected_widgets = g_list_prepend (selected_widgets, widget); - + list->children = g_list_remove (list->children, widget); - + if (GTK_WIDGET_MAPPED (widget)) gtk_widget_unmap (widget); - + + if (no_unref) + gtk_widget_ref (widget); gtk_widget_unparent (widget); } - + if (selected_widgets) { tmp_list = selected_widgets; @@ -352,27 +355,41 @@ gtk_list_remove_items (GtkList *list, { widget = tmp_list->data; tmp_list = tmp_list->next; - + gtk_list_unselect_child (list, widget); } - + gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]); } - + g_list_free (selected_widgets); - + if (list->children && !list->selection && (list->selection_mode == GTK_SELECTION_BROWSE)) { widget = list->children->data; gtk_list_select_child (list, widget); } - + if (GTK_WIDGET_VISIBLE (list)) gtk_widget_queue_resize (GTK_WIDGET (list)); } void +gtk_list_remove_items (GtkList *list, + GList *items) +{ + gtk_list_remove_items_internal (list, items, FALSE); +} + +void +gtk_list_remove_items_no_unref (GtkList *list, + GList *items) +{ + gtk_list_remove_items_internal (list, items, TRUE); +} + +void gtk_list_clear_items (GtkList *list, gint start, gint end) diff --git a/gtk/gtklist.h b/gtk/gtklist.h index addfe8cdb2..99a0908036 100644 --- a/gtk/gtklist.h +++ b/gtk/gtklist.h @@ -64,32 +64,34 @@ struct _GtkListClass }; -guint gtk_list_get_type (void); -GtkWidget* gtk_list_new (void); -void gtk_list_insert_items (GtkList *list, - GList *items, - gint position); -void gtk_list_append_items (GtkList *list, - GList *items); -void gtk_list_prepend_items (GtkList *list, - GList *items); -void gtk_list_remove_items (GtkList *list, - GList *items); -void gtk_list_clear_items (GtkList *list, - gint start, - gint end); -void gtk_list_select_item (GtkList *list, - gint item); -void gtk_list_unselect_item (GtkList *list, - gint item); -void gtk_list_select_child (GtkList *list, - GtkWidget *child); -void gtk_list_unselect_child (GtkList *list, - GtkWidget *child); -gint gtk_list_child_position (GtkList *list, - GtkWidget *child); -void gtk_list_set_selection_mode (GtkList *list, - GtkSelectionMode mode); +guint gtk_list_get_type (void); +GtkWidget* gtk_list_new (void); +void gtk_list_insert_items (GtkList *list, + GList *items, + gint position); +void gtk_list_append_items (GtkList *list, + GList *items); +void gtk_list_prepend_items (GtkList *list, + GList *items); +void gtk_list_remove_items (GtkList *list, + GList *items); +void gtk_list_remove_items_no_unref (GtkList *list, + GList *items); +void gtk_list_clear_items (GtkList *list, + gint start, + gint end); +void gtk_list_select_item (GtkList *list, + gint item); +void gtk_list_unselect_item (GtkList *list, + gint item); +void gtk_list_select_child (GtkList *list, + GtkWidget *child); +void gtk_list_unselect_child (GtkList *list, + GtkWidget *child); +gint gtk_list_child_position (GtkList *list, + GtkWidget *child); +void gtk_list_set_selection_mode (GtkList *list, + GtkSelectionMode mode); #ifdef __cplusplus diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 9e73d7732e..c069f62cdb 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -324,19 +324,39 @@ gtk_main_iteration_do (gboolean blocking) gdk_event_free (event); gdk_event_free (next_event); next_event = NULL; - - return done; + + goto event_handling_done; } - - /* Push the event onto a stack of current events for - * gtk_current_event_get(). - */ - current_events = g_list_prepend (current_events, event); /* Find the widget which got the event. We store the widget * in the user_data field of GdkWindow's. + * Ignore the event if we don't have a widget for it, except + * for GDK_PROPERTY_NOTIFY events which are handled specialy. + * Though this happens rarely, bogus events can occour + * for e.g. destroyed GdkWindows. */ event_widget = gtk_get_event_widget (event); + if (!event_widget) + { + /* To handle selection INCR transactions, we select + * PropertyNotify events on the requestor window and create + * a corresponding (fake) GdkWindow so that events get + * here. There won't be a widget though, so we have to handle + * them specially + */ + if (event->type == GDK_PROPERTY_NOTIFY) + gtk_selection_incr_event (event->any.window, + &event->property); + + gdk_event_free (event); + + goto event_handling_done; + } + + /* Push the event onto a stack of current events for + * gtk_current_event_get(). + */ + current_events = g_list_prepend (current_events, event); /* If there is a grab in effect... */ @@ -383,20 +403,6 @@ gtk_main_iteration_do (gboolean blocking) break; case GDK_PROPERTY_NOTIFY: - /* To handle selection INCR transactions, we select - * PropertyNotify events on the requestor window and create - * a corresponding (fake) GdkWindow so that events get - * here. There won't be a widget though, so we have to handle - * them specially - */ - - if (event_widget == NULL) - { - gtk_selection_incr_event (event->any.window, - &event->property); - break; - } - /* otherwise fall through */ case GDK_EXPOSE: case GDK_NO_EXPOSE: case GDK_FOCUS_CHANGE: @@ -436,21 +442,21 @@ gtk_main_iteration_do (gboolean blocking) break; case GDK_ENTER_NOTIFY: - if (grab_widget && GTK_WIDGET_IS_SENSITIVE (grab_widget)) + if (GTK_WIDGET_IS_SENSITIVE (grab_widget)) { gtk_widget_event (grab_widget, event); if (event_widget == grab_widget) GTK_PRIVATE_SET_FLAG (event_widget, GTK_LEAVE_PENDING); } break; - + case GDK_LEAVE_NOTIFY: - if (event_widget && GTK_WIDGET_LEAVE_PENDING (event_widget)) + if (GTK_WIDGET_LEAVE_PENDING (event_widget)) { GTK_PRIVATE_UNSET_FLAG (event_widget, GTK_LEAVE_PENDING); gtk_widget_event (event_widget, event); } - else if (grab_widget && GTK_WIDGET_IS_SENSITIVE (grab_widget)) + else if (GTK_WIDGET_IS_SENSITIVE (grab_widget)) gtk_widget_event (grab_widget, event); break; } @@ -458,7 +464,7 @@ gtk_main_iteration_do (gboolean blocking) tmp_list = current_events; current_events = g_list_remove_link (current_events, tmp_list); g_list_free_1 (tmp_list); - + gdk_event_free (event); } else @@ -467,7 +473,9 @@ gtk_main_iteration_do (gboolean blocking) gtk_handle_idle (); } - /* Handle a timeout functions that may have expired. +event_handling_done: + + /* Handle timeout functions that may have expired. */ gtk_handle_timeouts (); @@ -490,7 +498,7 @@ void gtk_grab_add (GtkWidget *widget) { g_return_if_fail (widget != NULL); - + if (!GTK_WIDGET_HAS_GRAB (widget)) { GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_GRAB); @@ -504,11 +512,11 @@ void gtk_grab_remove (GtkWidget *widget) { g_return_if_fail (widget != NULL); - + if (GTK_WIDGET_HAS_GRAB (widget)) { GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_GRAB); - + grabs = g_slist_remove (grabs, widget); gtk_widget_unref (widget); } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index f042ea46ad..95e712a0d1 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1675,7 +1675,7 @@ gtk_widget_event (GtkWidget *widget, gint return_val; gint signal_num; - g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (widget != NULL, TRUE); gtk_widget_ref (widget); return_val = FALSE; @@ -1709,9 +1709,6 @@ gtk_widget_event (GtkWidget *widget, case GDK_DESTROY: signal_num = DESTROY_EVENT; break; - case GDK_EXPOSE: - signal_num = EXPOSE_EVENT; - break; case GDK_KEY_PRESS: signal_num = KEY_PRESS_EVENT; break; @@ -1781,6 +1778,16 @@ gtk_widget_event (GtkWidget *widget, case GDK_CLIENT_EVENT: signal_num = CLIENT_EVENT; break; + case GDK_EXPOSE: + /* there is no sense in providing a widget with bogus expose events + */ + if (!event->any.window) + { + gtk_widget_unref (widget); + return TRUE; + } + signal_num = EXPOSE_EVENT; + break; default: g_warning ("could not determine signal number for event: %d", event->type); gtk_widget_unref (widget); @@ -2223,7 +2230,8 @@ gtk_widget_set_parent (GtkWidget *widget, GtkStateData data; g_return_if_fail (widget != NULL); - g_assert (widget->parent == NULL); + g_return_if_fail (widget->parent == NULL); + g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget)); g_return_if_fail (parent != NULL); /* keep this function in sync with gtk_menu_attach_to_widget() @@ -3824,12 +3832,6 @@ gtk_widget_dnd_data_set (GtkWidget *widget, gdk_window_dnd_data_set (widget->window, event, data, data_numbytes); } -void -gtk_widget_sink (GtkWidget *widget) -{ - gtk_object_sink (GTK_OBJECT (widget)); -} - #undef gtk_widget_ref #undef gtk_widget_unref diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 9874e10e7d..ed8fe58a92 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -351,7 +351,6 @@ GtkWidget* gtk_widget_new (guint type, GtkWidget* gtk_widget_newv (guint type, guint nargs, GtkArg *args); -void gtk_widget_sink (GtkWidget *widget); void gtk_widget_ref (GtkWidget *widget); void gtk_widget_unref (GtkWidget *widget); void gtk_widget_destroy (GtkWidget *widget); |