]> Pileus Git - ~andy/gtk/commitdiff
new function to perform the same actions as gtk_list_remove_items, but
authorTim Janik <timj@gimp.org>
Thu, 5 Feb 1998 03:53:41 +0000 (03:53 +0000)
committerTim Janik <timj@src.gnome.org>
Thu, 5 Feb 1998 03:53:41 +0000 (03:53 +0000)
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!

15 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/refcounting.txt
gdk/gdk.c
gdk/x11/gdkmain-x11.c
gtk/gtklist.c
gtk/gtklist.h
gtk/gtkmain.c
gtk/gtkwidget.c
gtk/gtkwidget.h

index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index b6661bda6374d7f99f71a04a4f8b43eb9ef0ed91..cb37785d775d09ebb162ef83c34d56286ea8fc76 100644 (file)
@@ -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
index 2315db62d2741b13595960dcb7e12a4c134df4cd..aa8823e22553a96a242dc0e54410733829c2de9e 100644 (file)
@@ -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
 
index ad62f9bc6877e8dd3b31fc64ee4015e3f4f49ca9..5caa6cdd6a63922dd4fe82927a26afaf35ee2595 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.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)
                {
index ad62f9bc6877e8dd3b31fc64ee4015e3f4f49ca9..5caa6cdd6a63922dd4fe82927a26afaf35ee2595 100644 (file)
@@ -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)
                {
index b5c63a20c4655245ed6c22d946093f0c3971e91f..d9050b2feb8905d33cc8c1f5b2790e5f47803f12 100644 (file)
@@ -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,26 +355,40 @@ 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,
index addfe8cdb25c38fdda97a20f4687de23bbc5b293..99a09080361cff471ce22b914e2f9078be841920 100644 (file)
@@ -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
index 9e73d7732e280e256bd23669ced4ae834d1ee0f1..c069f62cdbdb132afdce506cd7d45843087e5aba 100644 (file)
@@ -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);
     }
index f042ea46addbdbcf0d0dfbfd8740534d3245523b..95e712a0d199003a0fbc864fb97bce6ca038a0a8 100644 (file)
@@ -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
index 9874e10e7dedad8f0b8ee08bdaf43ebfc450b15a..ed8fe58a92fa1102abb15662e2b90815b3eb3d35 100644 (file)
@@ -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);