diff options
-rw-r--r-- | ChangeLog | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 59 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 59 | ||||
-rw-r--r-- | docs/Changes-1.4.txt | 33 | ||||
-rw-r--r-- | gdk/gdkinternals.h | 41 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 206 | ||||
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkevents-x11.c | 11 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 187 | ||||
-rw-r--r-- | gtk/gtkdnd.c | 52 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 21 | ||||
-rw-r--r-- | gtk/testgtk.c | 37 | ||||
-rw-r--r-- | tests/testgtk.c | 37 |
17 files changed, 807 insertions, 236 deletions
@@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 41451f3c8..a2d5bc477 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,60 @@ +Fri May 12 18:46:51 2000 Owen Taylor <otaylor@redhat.com> + + * docs/Changes-1.4.txt: A bit of editing. + + * gdk/gdkwindow.c (_gdk_window_clear_update_area) + * gdk/x11/gdkwindow-x11.c (gdk_window_hide): Add a function + to clear the update area for the window, and clear it + when hiding a window. + + * gdk/gdkwindow.c (gdk_window_begin_paint_region): Ignore + if window destroyed. + + * gdk/gdkwindow.c (gdk_window_end_paint): Likewise. + + * gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkinternals.h: Move + gdk_window_destroy() to the generic code, since there was a lot of + window-system-independent logic it in. Add a function: + + _gdk_window_destroy() + + to the internal API to destroy a window without unreferencing it. + Add a function: + + _gdk_windowing_window_destroy() + + That does the windowing-system-dependent part of destroying + the window. + +Fri May 12 11:07:41 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/testgtk.c: Fix various memory leaks of pixmaps. + +Fri May 12 11:06:10 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkwidget.c docs/Changes-1.4.txt (gtk_widget_shape_combine_mask): + Make gtk_widget_shape_combine_mask() keep a reference count on + the pixmap since it keeps it around. + +Fri May 12 10:53:29 2000 Owen Taylor <otaylor@redhat.com> + + * gdk/gdkwindow.c (gdk_window_process_updates_internal): Fix refcount + leak. + + * gdk/x11/gdkevents-x11.c (gdk_event_translate): Fix refcount + leak with event filters. + +Thu May 11 14:29:44 2000 Owen Taylor <otaylor@redhat.com> + + * gtk/gtkdnd.c (gtk_drag_dest_set_internal): Remove the + signal handlers with the right data arguments. (Fixes + some warnings when a widget was repeatedly set as a drag + destination.) + + * gdk/x11/gdkdnd-x11.c (gdk_window_register_dnd): Set data on the + window so we can avoid avoid setting the DND properties on the + toplevel window repeatedly. + 2000-05-13 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkwin32.h: Define more message types missing from @@ -71,7 +128,7 @@ Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. - * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references + * gtk/gtkcombo.c (gtk_combo_item_destroy): don't keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. diff --git a/docs/Changes-1.4.txt b/docs/Changes-1.4.txt index 1392394c7..d79f1cf1d 100644 --- a/docs/Changes-1.4.txt +++ b/docs/Changes-1.4.txt @@ -23,14 +23,17 @@ Incompatible Changes from GTK+-1.2 to GTK+-1.4: * GtkColorSelectionDialog has now been moved into it's own set of files, gtkcolorseldialog.c and gtkcolorseldialog.h. +* gtk_widget_shape_combine_mask() now keeps a reference count on the + mask pixmap that is passed in. + * Type system changes: - GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT) will not work anymore. As a replacement, (GTK_TYPE_IS_OBJECT (some_type)) can be used now. - The following types vanished: GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, - GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN. With them, the corresponding GtkARg - fields and field access macros vanished as well. + GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN. The corresponding GtkArg + fields and field access macros are also gone. - The following type aliases vanished: GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST. - The type macros GTK_TYPE_MAKE() and GTK_TYPE_SEQNO() vanished, use of @@ -60,14 +63,14 @@ Incompatible Changes from GTK+-1.2 to GTK+-1.4: over usage of gtk_type_unique(). * Object system changes: - GtkObject derives from GObject, it is not the basic object type anymore. + GtkObject derives from GObject, so is not the basic object type anymore. This imposes the following source incompatible changes: - GtkObject has no klass field anymore, an object's class can be retrived with the object's coresponding GTK_<OBJECT>_GET_CLASS (object) macro. - GtkObjectClass has no type field anymore, a class's type can be retrived with the GTK_CLASS_TYPE (class) macro. - - GtkObjectClass does not introduce the finalize() or shutdown() method - anymore. While shutdown() is intended for Gtk internal use only, finalize() + - GtkObjectClass does not introduce the finalize() and shutdown() methods + anymore. While shutdown() is intended for GTK+ internal use only, finalize() is required by a variety of object implementations. GObjectClass.finalize should be overriden here, e.g.: static void gtk_label_finalize (GObject *gobject) @@ -82,20 +85,24 @@ Incompatible Changes from GTK+-1.2 to GTK+-1.4: gobject_class->finalize = gtk_label_finalize; } - - the GtkObject::destroy signal can be emitted multiple times on an object - now. ::destroy implementations have to take this into account by - conditionalising freeing/release of assorted resources, e.g.: + + - the GtkObject::destroy signal can now be emitted multiple times on an object. + ::destroy implementations should check that make sure that they take this + into account, by checking to make sure that resources are there before + freeing them. For example: if (object->foo_data) - { + { g_free (object->foo_data); object->foo_data = NULL; } - Also, ::destroy implementations have to release peding object references, - that is, code portions commonly found in finalize implementations like: + + Also, ::destroy implementations have to release object references that + the object holds. Code in finalize implementations such as: if (object->adjustment) { gtk_object_unref (object->adjustment); object->adjustment = NULL; } - have to be moved into the ::destroy implementations. - This is required to break object reference cycles at destruction time. + have to be moved into the ::destroy implementations. The reason for doing + this is that all object reference cycles should be broken at destruction + time. diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index b7a633637..925a36ab4 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -129,16 +129,20 @@ void gdk_im_close (void); void gdk_ic_cleanup (void); #endif /* USE_XIM */ -GdkWindow* _gdk_window_alloc (void); -void _gdk_window_draw_image (GdkDrawable *drawable, - GdkGC *gc, - GdkImage *image, - gint xsrc, - gint ysrc, - gint xdest, - gint ydest, - gint width, - gint height); +GdkWindow* _gdk_window_alloc (void); +void _gdk_window_draw_image (GdkDrawable *drawable, + GdkGC *gc, + GdkImage *image, + gint xsrc, + gint ysrc, + gint xdest, + gint ydest, + gint width, + gint height); +void _gdk_window_destroy (GdkWindow *window, + gboolean foreign_destroy); +void _gdk_window_clear_update_area (GdkWindow *window); + /***************************************** * Interfaces provided by windowing code * @@ -187,6 +191,23 @@ void _gdk_windowing_window_clear_area_e (GdkWindow *window, gboolean _gdk_windowing_window_queue_antiexpose (GdkWindow *window, GdkRegion *area); +/* Called to do the windowing system specific part of gdk_window_destroy(), + * + * window: The window being destroyed + * recursing: If TRUE, then this is being called because a parent + * was destroyed. This generally means that the call to the windowing system + * to destroy the window can be omitted, since it will be destroyed as a result + * of the parent being destroyed. Unless @foreign_destroy + * + * foreign_destroy: If TRUE, the window or a parent was destroyed by some external + * agency. The window has already been destroyed and no windowing + * system calls should be made. (This may never happen for some + * windowing systems.) + */ +void _gdk_windowing_window_destroy (GdkWindow *window, + gboolean recursing, + gboolean foreign_destroy); + /************************************ * Initialization and exit routines * ************************************/ diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index a05063665..7e2ff38fa 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -106,6 +106,7 @@ static void gdk_window_draw_lines (GdkDrawable *drawable, GdkPoint *points, gint npoints); +static void gdk_window_free_paint_stack (GdkWindow *window); /* All drawing operations on windows are forwarded through the following * class to enable the automatic-backing-store feature. @@ -170,6 +171,142 @@ _gdk_window_alloc (void) return window; } +/** + * _gdk_window_destroy_heirarchy: + * @window: a #GdkWindow + * @recursing: If TRUE, then this is being called because a parent + * was destroyed. This generally means that the call to the windowing system + * to destroy the window can be omitted, since it will be destroyed as a result + * of the parent being destroyed. Unless @foreign_destroy + * + * foreign_destroy: If TRUE, the window or a parent was destroyed by some external + * agency. The window has already been destroyed and no windowing + * system calls should be made. (This may never happen for some + * windowing systems.) + * + * Internal function to destroy a window. Like gdk_window_destroy(), but does not + * drop the reference count created by gdk_window_new(). + **/ +static void +_gdk_window_destroy_heirarchy (GdkWindow *window, + gboolean recursing, + gboolean foreign_destroy) +{ + GdkWindowPrivate *private; + GdkWindowPrivate *temp_private; + GdkWindow *temp_window; + GList *children; + GList *tmp; + + g_return_if_fail (window != NULL); + + private = (GdkWindowPrivate*) window; + + switch (private->drawable.window_type) + { + case GDK_WINDOW_TOPLEVEL: + case GDK_WINDOW_CHILD: + case GDK_WINDOW_DIALOG: + case GDK_WINDOW_TEMP: + case GDK_WINDOW_FOREIGN: + if (!GDK_DRAWABLE_DESTROYED (window)) + { + private->mapped = FALSE; + private->drawable.destroyed = TRUE; + + _gdk_windowing_window_destroy (window, recursing, foreign_destroy); + + if (private->parent) + { + GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent; + if (parent_private->children) + parent_private->children = g_list_remove (parent_private->children, window); + } + + _gdk_window_clear_update_area (window); + gdk_window_free_paint_stack (window); + + if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG) + { + gdk_pixmap_unref (private->bg_pixmap); + private->bg_pixmap = NULL; + } + + if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN) + { + children = tmp = private->children; + private->children = NULL; + + while (tmp) + { + temp_window = tmp->data; + tmp = tmp->next; + + temp_private = (GdkWindowPrivate*) temp_window; + if (temp_private) + _gdk_window_destroy_heirarchy (temp_window, TRUE, foreign_destroy); + } + + g_list_free (children); + } + + if (private->filters) + { + tmp = private->filters; + + while (tmp) + { + g_free (tmp->data); + tmp = tmp->next; + } + + g_list_free (private->filters); + private->filters = NULL; + } + + if (private->drawable.colormap) + { + gdk_colormap_unref (private->drawable.colormap); + private->drawable.colormap = NULL; + } + } + break; + + case GDK_WINDOW_ROOT: + g_error ("attempted to destroy root window"); + break; + + case GDK_WINDOW_PIXMAP: + g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)"); + break; + } +} + +/** + * _gdk_window_destroy: + * @window: a #GdkWindow + * foreign_destroy: If TRUE, the window or a parent was destroyed by some external + * agency. The window has already been destroyed and no windowing + * system calls should be made. (This may never happen for some + * windowing systems.) + * + * Internal function to destroy a window. Like gdk_window_destroy(), but does not + * drop the reference count created by gdk_window_new(). + **/ +void +_gdk_window_destroy (GdkWindow *window, + gboolean foreign_destroy) +{ + _gdk_window_destroy_heirarchy (window, FALSE, foreign_destroy); +} + +void +gdk_window_destroy (GdkWindow *window) +{ + _gdk_window_destroy_heirarchy (window, FALSE, FALSE); + gdk_drawable_unref (window); +} + void gdk_window_set_user_data (GdkWindow *window, gpointer user_data) @@ -451,6 +588,9 @@ gdk_window_begin_paint_region (GdkWindow *window, g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window)); + if (GDK_DRAWABLE_DESTROYED (window)) + return; + paint = g_new (GdkWindowPaint, 1); paint->region = gdk_region_copy (region); @@ -542,6 +682,10 @@ gdk_window_end_paint (GdkWindow *window) g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window)); + + if (GDK_DRAWABLE_DESTROYED (window)) + return; + g_return_if_fail (private->paint_stack != NULL); paint = private->paint_stack->data; @@ -583,6 +727,32 @@ gdk_window_end_paint (GdkWindow *window) } static void +gdk_window_free_paint_stack (GdkWindow *window) +{ + GdkWindowPrivate *private = (GdkWindowPrivate *)window; + + if (private->paint_stack) + { + GSList *tmp_list = private->paint_stack; + + while (tmp_list) + { + GdkWindowPaint *paint = tmp_list->data; + if (tmp_list == private->paint_stack) + gdk_drawable_unref (paint->pixmap); + + gdk_region_destroy (paint->region); + g_free (paint); + + tmp_list = tmp_list->next; + } + + g_slist_free (private->paint_stack); + private->paint_stack = NULL; + } +} + +static void gdk_window_get_offsets (GdkWindow *window, gint *x_offset, gint *y_offset) @@ -622,7 +792,7 @@ gdk_window_get_offsets (GdkWindow *window, } static void -gdk_window_draw_destroy (GdkDrawable *drawable) +gdk_window_draw_destroy (GdkDrawable *drawable) { _gdk_windowing_window_class.destroy (drawable); } @@ -1061,7 +1231,7 @@ gdk_window_process_updates_internal (GdkWindow *window) save_region = _gdk_windowing_window_queue_antiexpose (window, update_area); event.expose.type = GDK_EXPOSE; - event.expose.window = gdk_window_ref ((GdkWindow *)private); + event.expose.window = gdk_window_ref (window); event.expose.count = 0; gdk_region_get_clipbox (update_area, &event.expose.area); @@ -1069,6 +1239,8 @@ gdk_window_process_updates_internal (GdkWindow *window) { (*gdk_event_func) (&event, gdk_event_data); } + + gdk_window_unref (window); } if (!save_region) @@ -1143,6 +1315,9 @@ gdk_window_invalidate_rect (GdkWindow *window, g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window)); + if (GDK_DRAWABLE_DESTROYED (window)) + return; + if (private->update_area) { gdk_region_union_with_rect (private->update_area, rect); @@ -1201,6 +1376,9 @@ gdk_window_invalidate_region (GdkWindow *window, g_return_if_fail (window != NULL); g_return_if_fail (GDK_IS_WINDOW (window)); + if (GDK_DRAWABLE_DESTROYED (window)) + return; + if (private->input_only) return; @@ -1274,6 +1452,30 @@ gdk_window_get_update_area (GdkWindow *window) return NULL; } +/** + * _gdk_window_clear_update_area: + * @window: a #GdkWindow. + * + * Internal function to clear the update area for a window. This + * is called when the window is hidden or destroyed. + **/ +void +_gdk_window_clear_update_area (GdkWindow *window) +{ + GdkWindowPrivate *private = (GdkWindowPrivate *)window; + + g_return_if_fail (window != NULL); + g_return_if_fail (GDK_IS_WINDOW (window)); + + if (private->update_area) + { + update_windows = g_slist_remove (update_windows, window); + + gdk_region_destroy (private->update_area); + private->update_area = NULL; + } +} + void gdk_window_freeze_updates (GdkWindow *window) { diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 287a65dc5..8509b3220 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -3240,6 +3240,11 @@ gdk_window_register_dnd (GdkWindow *window) g_return_if_fail (window != NULL); + if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered"))) + return; + else + gdk_drawable_set_data (window, "gdk-dnd-registered", GINT_TO_POINTER(TRUE), NULL); + /* Set Motif drag receiver information property */ if (!motif_drag_receiver_info_atom) diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 9f2945317..b71e34977 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -320,7 +320,8 @@ gdk_event_translate (GdkEvent *event, if (result != GDK_FILTER_CONTINUE) { - return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; + return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; + goto done; } } @@ -352,7 +353,10 @@ gdk_event_translate (GdkEvent *event, result = gdk_event_apply_filters (xevent, event, window_private->filters); if (result != GDK_FILTER_CONTINUE) - return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; + { + return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE; + goto done; + } } #endif @@ -1200,7 +1204,8 @@ gdk_event_translate (GdkEvent *event, break; } - + + done: if (return_val) { if (event->any.window) diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 9011ac6e1..b7945760c 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -34,6 +34,7 @@ #include "gdkwindow.h" #include "gdkinputprivate.h" #include "gdkprivate-x11.h" +#include "gdkregion.h" #include "gdkinternals.h" #include "MwmUtil.h" @@ -85,10 +86,18 @@ gdk_x11_window_destroy (GdkDrawable *drawable) { if (!GDK_DRAWABLE_DESTROYED (drawable)) { - if (GDK_DRAWABLE_TYPE (drawable) == GDK_WINDOW_FOREIGN) - gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable)); + if (GDK_DRAWABLE_TYPE (drawable) != GDK_WINDOW_FOREIGN) + { + g_warning ("losing last reference to undestroyed window\n"); + _gdk_window_destroy (drawable, FALSE); + } else - g_warning ("losing last reference to undestroyed window\n"); + /* We use TRUE here, to keep us from actually calling + * XDestroyWindow() on the window + */ + _gdk_window_destroy (drawable, TRUE); + + gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable)); } g_free (GDK_DRAWABLE_XDATA (drawable)); @@ -479,147 +488,50 @@ gdk_window_foreign_new (guint32 anid) return window; } -/* Call this function when you want a window and all its children to - * disappear. When xdestroy is true, a request to destroy the XWindow - * is sent out. When it is false, it is assumed that the XWindow has - * been or will be destroyed by destroying some ancestor of this - * window. - */ -static void -gdk_window_internal_destroy (GdkWindow *window, - gboolean xdestroy, - gboolean our_destroy) +void +_gdk_windowing_window_destroy (GdkWindow *window, + gboolean recursing, + gboolean foreign_destroy) { - GdkWindowPrivate *private; - GdkWindowPrivate *temp_private; - GdkWindow *temp_window; - GList *children; - GList *tmp; - - g_return_if_fail (window != NULL); - - private = (GdkWindowPrivate*) window; - - switch (private->drawable.window_type) + GdkWindowPrivate *private = (GdkWindowPrivate *)window; + + if (private->extension_events != 0) + gdk_input_window_destroy (window); + + if (private->drawable.window_type == GDK_WINDOW_FOREIGN) { - case GDK_WINDOW_TOPLEVEL: - case GDK_WINDOW_CHILD: - case GDK_WINDOW_DIALOG: - case GDK_WINDOW_TEMP: - case GDK_WINDOW_FOREIGN: - if (!private->drawable.destroyed) + if (!foreign_destroy && (private->parent != NULL)) { - if (private->parent) - { - GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent; - if (parent_private->children) - parent_private->children = g_list_remove (parent_private->children, window); - } - - if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG) - { - gdk_pixmap_unref (private->bg_pixmap); - private->bg_pixmap = NULL; - } + /* It's somebody else's window, but in our heirarchy, + * so reparent it to the root window, and then send + * it a delete event, as if we were a WM + */ + XClientMessageEvent xevent; - if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN) - { - children = tmp = private->children; - private->children = NULL; - - while (tmp) - { - temp_window = tmp->data; - tmp = tmp->next; - - temp_private = (GdkWindowPrivate*) temp_window; - if (temp_private) - gdk_window_internal_destroy (temp_window, FALSE, - our_destroy); - } - - g_list_free (children); - } + gdk_error_trap_push (); + gdk_window_hide (window); + gdk_window_reparent (window, NULL, 0, 0); - if (private->extension_events != 0) - gdk_input_window_destroy (window); + xevent.type = ClientMessage; + xevent.window = GDK_DRAWABLE_XID (window); + xevent.message_type = gdk_wm_protocols; + xevent.format = 32; + xevent.data.l[0] = gdk_wm_delete_window; + xevent.data.l[1] = CurrentTime; - if (private->filters) - { - tmp = private->filters; - - while (tmp) - { - g_free (tmp->data); - tmp = tmp->next; - } - - g_list_free (private->filters); - private->filters = NULL; - } - - if (private->drawable.window_type == GDK_WINDOW_FOREIGN) - { - if (our_destroy && (private->parent != NULL)) - { - /* It's somebody elses window, but in our heirarchy, - * so reparent it to the root window, and then send - * it a delete event, as if we were a WM - */ - XClientMessageEvent xevent; - - gdk_error_trap_push (); - gdk_window_hide (window); - gdk_window_reparent (window, NULL, 0, 0); - - xevent.type = ClientMessage; - xevent.window = GDK_DRAWABLE_XID (window); - xevent.message_type = gdk_wm_protocols; - xevent.format = 32; - xevent.data.l[0] = gdk_wm_delete_window; - xevent.data.l[1] = CurrentTime; - - XSendEvent (GDK_DRAWABLE_XDISPLAY (window), - GDK_DRAWABLE_XID (window), - False, 0, (XEvent *)&xevent); - gdk_flush (); - gdk_error_trap_pop (); - } - } - else if (xdestroy) - XDestroyWindow (GDK_DRAWABLE_XDISPLAY (window), - GDK_DRAWABLE_XID (window)); - - if (private->drawable.colormap) - gdk_colormap_unref (private->drawable.colormap); - - private->mapped = FALSE; - private->drawable.destroyed = TRUE; + XSendEvent (GDK_DRAWABLE_XDISPLAY (window), + GDK_DRAWABLE_XID (window), + False, 0, (XEvent *)&xevent); + gdk_flush (); + gdk_error_trap_pop (); } - break; - - case GDK_WINDOW_ROOT: - g_error ("attempted to destroy root window"); - break; - - case GDK_WINDOW_PIXMAP: - g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)"); - break; } + else if (!recursing && !foreign_destroy) + XDestroyWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window)); } -/* Like internal_destroy, but also destroys the reference created by - gdk_window_new. */ - -void -gdk_window_destroy (GdkWindow *window) -{ - gdk_window_internal_destroy (window, TRUE, TRUE); - gdk_drawable_unref (window); -} - -/* This function is called when the XWindow is really gone. */ - +/* This function is called when the XWindow is really gone. + */ void gdk_window_destroy_notify (GdkWindow *window) { @@ -630,7 +542,7 @@ gdk_window_destroy_notify (GdkWindow *window) if (GDK_DRAWABLE_TYPE(window) != GDK_WINDOW_FOREIGN) g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_DRAWABLE_XID (window)); - gdk_window_internal_destroy (window, FALSE, FALSE); + _gdk_window_destroy (window, TRUE); } gdk_xid_table_remove (GDK_DRAWABLE_XID (window)); @@ -663,11 +575,14 @@ gdk_window_hide (GdkWindow *window) GdkWindowPrivate *private; g_return_if_fail (window != NULL); - + private = (GdkWindowPrivate*) window; if (!private->drawable.destroyed) { private->mapped = FALSE; + + _gdk_window_clear_update_area (window); + XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window)); } diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 781a3aad9..74e40352e 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -841,6 +841,30 @@ gtk_drag_unhighlight (GtkWidget *widget) gtk_widget_queue_clear (widget); } +static void +gtk_drag_dest_set_internal (GtkWidget *widget, + GtkDragDestSite *site) +{ + GtkDragDestSite *old_site; + + g_return_if_fail (widget != NULL); + + /* HACK, do this in the destroy */ + old_site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); + if (old_site) + gtk_signal_disconnect_by_data (GTK_OBJECT (widget), old_site); + + if (GTK_WIDGET_REALIZED (widget)) + gtk_drag_dest_realized (widget); + + gtk_signal_connect (GTK_OBJECT (widget), "realize", + GTK_SIGNAL_FUNC (gtk_drag_dest_realized), site); + + gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest", + site, gtk_drag_dest_site_destroy); +} + + /************************************************************* * gtk_drag_dest_set: * Register a drop site, and possibly add default behaviors. @@ -864,17 +888,6 @@ gtk_drag_dest_set (GtkWidget *widget, g_return_if_fail (widget != NULL); - /* HACK, do this in the destroy */ - site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); - if (site) - gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site); - - if (GTK_WIDGET_REALIZED (widget)) - gtk_drag_dest_realized (widget); - - gtk_signal_connect (GTK_OBJECT (widget), "realize", - GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL); - site = g_new (GtkDragDestSite, 1); site->flags = flags; @@ -887,8 +900,7 @@ gtk_drag_dest_set (GtkWidget *widget, site->actions = actions; site->do_proxy = FALSE; - gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest", - site, gtk_drag_dest_site_destroy); + gtk_drag_dest_set_internal (widget, site); } /************************************************************* @@ -914,17 +926,6 @@ gtk_drag_dest_set_proxy (GtkWidget *widget, g_return_if_fail (widget != NULL); - /* HACK, do this in the destroy */ - site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest"); - if (site) - gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site); - - if (GTK_WIDGET_REALIZED (widget)) - gtk_drag_dest_realized (widget); - - gtk_signal_connect (GTK_OBJECT (widget), "realize", - GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL); - site = g_new (GtkDragDestSite, 1); site->flags = 0; @@ -938,8 +939,7 @@ gtk_drag_dest_set_proxy (GtkWidget *widget, site->proxy_protocol = protocol; site->proxy_coords = use_coordinates; - gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest", - site, gtk_drag_dest_site_destroy); + gtk_drag_dest_set_internal (widget, site); } /************************************************************* diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index c09e605e5..e30ca4aa6 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -4297,6 +4297,13 @@ gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info) g_mem_chunk_free (aux_info_mem_chunk, aux_info); } +static void +gtk_widget_shape_info_destroy (GtkWidgetShapeInfo *info) +{ + gdk_drawable_unref (info->shape_mask); + g_free (info); +} + /***************************************** * gtk_widget_shape_combine_mask: * set a shape for this widgets' gdk window, this allows for @@ -4327,21 +4334,17 @@ gtk_widget_shape_combine_mask (GtkWidget *widget, if (widget->window) gdk_window_shape_combine_mask (widget->window, NULL, 0, 0); - shape_info = gtk_object_get_data (GTK_OBJECT (widget), shape_info_key); gtk_object_remove_data (GTK_OBJECT (widget), shape_info_key); - g_free (shape_info); } else { GTK_PRIVATE_SET_FLAG (widget, GTK_HAS_SHAPE_MASK); - shape_info = gtk_object_get_data (GTK_OBJECT (widget), shape_info_key); - if (!shape_info) - { - shape_info = g_new (GtkWidgetShapeInfo, 1); - gtk_object_set_data (GTK_OBJECT (widget), shape_info_key, shape_info); - } - shape_info->shape_mask = shape_mask; + shape_info = g_new (GtkWidgetShapeInfo, 1); + gtk_object_set_data_full (GTK_OBJECT (widget), shape_info_key, shape_info, + (GDestroyNotify)gtk_widget_shape_info_destroy); + + shape_info->shape_mask = gdk_drawable_ref (shape_mask); shape_info->offset_x = offset_x; shape_info->offset_y = offset_y; diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 56dc6cb13..299226506 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -5064,12 +5064,15 @@ void create_ctree (void) gtk_widget_realize (window); - pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1, - &transparent, book_closed_xpm); - pixmap2 = gdk_pixmap_create_from_xpm_d (window->window, &mask2, - &transparent, book_open_xpm); - pixmap3 = gdk_pixmap_create_from_xpm_d (window->window, &mask3, - &transparent, mini_page_xpm); + if (!pixmap1) + pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1, + &transparent, book_closed_xpm); + if (!pixmap2) + pixmap2 = gdk_pixmap_create_from_xpm_d (window->window, &mask2, + &transparent, book_open_xpm); + if (!pixmap3) + pixmap3 = gdk_pixmap_create_from_xpm_d (window->window, &mask3, + &transparent, mini_page_xpm); gtk_widget_set_usize (GTK_WIDGET (ctree), 0, 300); @@ -6157,14 +6160,16 @@ create_notebook (void) gtk_container_set_border_width (GTK_CONTAINER (sample_notebook), 10); gtk_widget_realize (sample_notebook); - book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window, - &book_open_mask, - transparent, - book_open_xpm); - book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window, - &book_closed_mask, + if (!book_open) + book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window, + &book_open_mask, transparent, - book_closed_xpm); + book_open_xpm); + if (!book_closed) + book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window, + &book_closed_mask, + transparent, + book_closed_xpm); create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5); @@ -6748,8 +6753,10 @@ shape_create_icon (char *xpm_file, gtk_fixed_put (GTK_FIXED (fixed), pixmap, px,py); gtk_widget_show (pixmap); - gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px,py); - + gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px, py); + + gdk_drawable_unref (gdk_pixmap_mask); + gdk_drawable_unref (gdk_pixmap); gtk_signal_connect (GTK_OBJECT (window), "button_press_event", GTK_SIGNAL_FUNC (shape_pressed),NULL); diff --git a/tests/testgtk.c b/tests/testgtk.c index 56dc6cb13..299226506 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -5064,12 +5064,15 @@ void create_ctree (void) gtk_widget_realize (window); - pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1, - &transparent, book_closed_xpm); - pixmap2 = gdk_pixmap_create_from_xpm_d (window->window, &mask2, - &transparent, book_open_xpm); - pixmap3 = gdk_pixmap_create_from_xpm_d (window->window, &mask3, - &transparent, mini_page_xpm); + if (!pixmap1) + pixmap1 = gdk_pixmap_create_from_xpm_d (window->window, &mask1, + &transparent, book_closed_xpm); + if (!pixmap2) + pixmap2 = gdk_pixmap_create_from_xpm_d (window->window, &mask2, + &transparent, book_open_xpm); + if (!pixmap3) + pixmap3 = gdk_pixmap_create_from_xpm_d (window->window, &mask3, + &transparent, mini_page_xpm); gtk_widget_set_usize (GTK_WIDGET (ctree), 0, 300); @@ -6157,14 +6160,16 @@ create_notebook (void) gtk_container_set_border_width (GTK_CONTAINER (sample_notebook), 10); gtk_widget_realize (sample_notebook); - book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window, - &book_open_mask, - transparent, - book_open_xpm); - book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window, - &book_closed_mask, + if (!book_open) + book_open = gdk_pixmap_create_from_xpm_d (sample_notebook->window, + &book_open_mask, transparent, - book_closed_xpm); + book_open_xpm); + if (!book_closed) + book_closed = gdk_pixmap_create_from_xpm_d (sample_notebook->window, + &book_closed_mask, + transparent, + book_closed_xpm); create_pages (GTK_NOTEBOOK (sample_notebook), 1, 5); @@ -6748,8 +6753,10 @@ shape_create_icon (char *xpm_file, gtk_fixed_put (GTK_FIXED (fixed), pixmap, px,py); gtk_widget_show (pixmap); - gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px,py); - + gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px, py); + + gdk_drawable_unref (gdk_pixmap_mask); + gdk_drawable_unref (gdk_pixmap); gtk_signal_connect (GTK_OBJECT (window), "button_press_event", GTK_SIGNAL_FUNC (shape_pressed),NULL); |