Commit eef38289 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

GTK_RESIZE_NEEDED is a private flag now.

Mon Feb  2 04:15:08 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkcontainer.h:
        * gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
          (gtk_container_register_toplevel): new function.
          (gtk_container_unregister_toplevel): new function.

        * gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.

        * gtk/gtkmenu.c: call gtk_container_register_toplevel in
          gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
          hack. new default handler gtk_menu_destroy for calling
          gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.

        * gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.

        * gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
          (object).

        * gtk/gtkprivate.h: new file that will not be automatically included.
          it holds the private flags for GtkWidget along with it's SET/UNSET
          and examination macros.

        * gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
          GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
          replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
          removed the gtk_widget_set_parent(, NULL) hack for toplevels.
          upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.

        * gtk/gtkwidget.h: split up the widget flags into a public and a private
          portion. added an extra field private_flags to GtkWidget without making
          it bigger by using an alignment gap of 16 bit. macro cleanups.

        * gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
          for calling gtk_container_unregister_toplevel. removed the
          gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
          instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.

        * gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
          removal that cut off the handler list -> living_objects == 0
          with testgtk. made some warnings more descriptive.
          new function gtk_signal_connect_object_while_alive, which
          will automatically destroy the connection once one of the objects
          is destroyed. didn't include this before removal of the above
          mentioned bug.

* reflected refcounting revolution in ChangeLog
parent 81fe3604
......@@ -149,6 +149,7 @@ gtkinclude_HEADERS = \
gtkpaned.h \
gtkpixmap.h \
gtkpreview.h \
gtkprivate.h \
gtkprogressbar.h \
gtkradiobutton.h \
gtkradiomenuitem.h \
......
......@@ -17,6 +17,7 @@
*/
#include <string.h>
#include "gtkcontainer.h"
#include "gtkprivate.h"
#include "gtksignal.h"
......@@ -215,12 +216,15 @@ gtk_container_destroy (GtkObject *object)
{
GSList *node;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_CONTAINER (object));
for (node = GTK_CONTAINER (object)->resize_widgets; node; node = node->next)
{
GtkWidget *child;
child = (GtkWidget*) node->data;
GTK_WIDGET_UNSET_FLAGS (child, GTK_RESIZE_NEEDED);
GTK_PRIVATE_UNSET_FLAGS (child, GTK_RESIZE_NEEDED);
}
g_slist_free (GTK_CONTAINER (object)->resize_widgets);
GTK_CONTAINER (object)->resize_widgets = NULL;
......@@ -466,6 +470,18 @@ gtk_container_children (GtkContainer *container)
return g_list_reverse (children);
}
void
gtk_container_register_toplevel (GtkContainer *container)
{
gtk_widget_ref (GTK_WIDGET (container));
gtk_object_sink (GTK_OBJECT (container));
}
void
gtk_container_unregister_toplevel (GtkContainer *container)
{
gtk_widget_unref (GTK_WIDGET (container));
}
static void
gtk_container_marshal_signal_1 (GtkObject *object,
......
......@@ -43,6 +43,7 @@ struct _GtkContainer
GtkWidget widget;
GtkWidget *focus_child;
gint16 border_width;
guint auto_resize : 1;
guint need_resize : 1;
......@@ -72,29 +73,32 @@ struct _GtkContainerClass
guint gtk_container_get_type (void);
void gtk_container_border_width (GtkContainer *container,
gint border_width);
void gtk_container_add (GtkContainer *container,
GtkWidget *widget);
void gtk_container_remove (GtkContainer *container,
GtkWidget *widget);
void gtk_container_disable_resize (GtkContainer *container);
void gtk_container_enable_resize (GtkContainer *container);
void gtk_container_block_resize (GtkContainer *container);
void gtk_container_unblock_resize (GtkContainer *container);
gint gtk_container_need_resize (GtkContainer *container);
void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_foreach_interp (GtkContainer *container,
GtkCallbackMarshal callback,
gpointer callback_data,
GtkDestroyNotify notify);
gint gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
GList* gtk_container_children (GtkContainer *container);
guint gtk_container_get_type (void);
void gtk_container_border_width (GtkContainer *container,
gint border_width);
void gtk_container_add (GtkContainer *container,
GtkWidget *widget);
void gtk_container_remove (GtkContainer *container,
GtkWidget *widget);
void gtk_container_disable_resize (GtkContainer *container);
void gtk_container_enable_resize (GtkContainer *container);
void gtk_container_block_resize (GtkContainer *container);
void gtk_container_unblock_resize (GtkContainer *container);
gint gtk_container_need_resize (GtkContainer *container);
void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_foreach_interp (GtkContainer *container,
GtkCallbackMarshal callback,
gpointer callback_data,
GtkDestroyNotify notify);
gint gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
GList* gtk_container_children (GtkContainer *container);
void gtk_container_register_toplevel (GtkContainer *container);
void gtk_container_unregister_toplevel (GtkContainer *container);
#ifdef __cplusplus
}
......
......@@ -31,6 +31,7 @@
#include "gtkvscrollbar.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
/* Private type definitions
......@@ -439,14 +440,14 @@ gtk_main_iteration_do (gboolean blocking)
{
gtk_widget_event (grab_widget, event);
if (event_widget == grab_widget)
GTK_WIDGET_SET_FLAGS (event_widget, GTK_LEAVE_PENDING);
GTK_PRIVATE_SET_FLAGS (event_widget, GTK_LEAVE_PENDING);
}
break;
case GDK_LEAVE_NOTIFY:
if (event_widget && GTK_WIDGET_LEAVE_PENDING (event_widget))
{
GTK_WIDGET_UNSET_FLAGS (event_widget, GTK_LEAVE_PENDING);
GTK_PRIVATE_UNSET_FLAGS (event_widget, GTK_LEAVE_PENDING);
gtk_widget_event (event_widget, event);
}
else if (grab_widget && GTK_WIDGET_IS_SENSITIVE (grab_widget))
......@@ -1194,11 +1195,11 @@ gtk_print (gchar *str)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/*
* gtk_signal_connect (GTK_OBJECT (window), "destroy",
* (GtkSignalFunc) gtk_widget_destroyed,
* &window);
*/
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) gtk_widget_destroyed,
&window);
gtk_window_set_title (GTK_WINDOW (window), "Messages");
box1 = gtk_vbox_new (FALSE, 0);
......
......@@ -28,6 +28,7 @@
static void gtk_menu_class_init (GtkMenuClass *klass);
static void gtk_menu_init (GtkMenu *menu);
static void gtk_menu_destroy (GtkObject *object);
static void gtk_menu_show (GtkWidget *widget);
static void gtk_menu_map (GtkWidget *widget);
static void gtk_menu_unmap (GtkWidget *widget);
......@@ -50,6 +51,7 @@ static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
static void gtk_menu_show_all (GtkWidget *widget);
static void gtk_menu_hide_all (GtkWidget *widget);
static GtkMenuShellClass *parent_class = NULL;
guint
gtk_menu_get_type ()
......@@ -78,13 +80,18 @@ gtk_menu_get_type ()
static void
gtk_menu_class_init (GtkMenuClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GtkMenuShellClass *menu_shell_class;
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
parent_class = gtk_type_class (gtk_menu_shell_get_type ());
object_class->destroy = gtk_menu_destroy;
widget_class->show = gtk_menu_show;
widget_class->map = gtk_menu_map;
......@@ -108,7 +115,7 @@ gtk_menu_class_init (GtkMenuClass *class)
static void
gtk_menu_init (GtkMenu *menu)
{
GTK_WIDGET_SET_FLAGS (menu, GTK_ANCHORED | GTK_TOPLEVEL);
GTK_WIDGET_SET_FLAGS (menu, GTK_TOPLEVEL);
menu->parent_menu_item = NULL;
menu->old_active_menu_item = NULL;
......@@ -118,8 +125,19 @@ gtk_menu_init (GtkMenu *menu)
GTK_MENU_SHELL (menu)->menu_flag = TRUE;
/* gtk_container_add (gtk_root, GTK_WIDGET (menu)); */
gtk_widget_set_parent (GTK_WIDGET (menu), NULL);
gtk_container_register_toplevel (GTK_CONTAINER (menu));
}
static void
gtk_menu_destroy (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_MENU (object));
gtk_container_unregister_toplevel (GTK_CONTAINER (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
GtkWidget*
......@@ -292,7 +310,6 @@ gtk_menu_map (GtkWidget *widget)
menu = GTK_MENU (widget);
menu_shell = GTK_MENU_SHELL (widget);
GTK_WIDGET_SET_FLAGS (menu_shell, GTK_MAPPED);
GTK_WIDGET_UNSET_FLAGS (menu_shell, GTK_UNMAPPED);
gtk_widget_size_request (widget, &widget->requisition);
......@@ -357,7 +374,6 @@ gtk_menu_unmap (GtkWidget *widget)
g_return_if_fail (GTK_IS_MENU (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
GTK_WIDGET_SET_FLAGS (widget, GTK_UNMAPPED);
gdk_window_hide (widget->window);
}
......@@ -560,9 +576,6 @@ gtk_menu_expose (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (!GTK_WIDGET_UNMAPPED (widget))
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_menu_paint (widget);
......
......@@ -105,7 +105,9 @@ gtk_object_debug (void)
printf ("%d living objects\n", obj_count);
for (node = living_objs; node; node = node->next)
{
GtkObject *obj = (GtkObject *)node->data;
GtkObject *obj;
obj = (GtkObject*) node->data;
/*
printf ("%p: %s %d %s\n",
obj, gtk_type_name (GTK_OBJECT_TYPE (obj)),
......@@ -186,6 +188,25 @@ gtk_object_class_init (GtkObjectClass *class)
class->finalize = gtk_object_finalize;
}
/*****************************************
* gtk_object_real_destroy:
*
* arguments:
*
* results:
*****************************************/
static void
gtk_object_real_destroy (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
/* FIXME: gtk_signal_handlers_destroy (object); */
/* object->klass = gtk_type_class (gtk_destroyed_get_type ()); */
}
/*****************************************
* gtk_object_init:
*
......@@ -197,7 +218,8 @@ gtk_object_class_init (GtkObjectClass *class)
static void
gtk_object_init (GtkObject *object)
{
object->flags = GTK_FLOATING;
GTK_OBJECT_FLAGS (object) = GTK_FLOATING;
object->ref_count = 1;
object->object_data = NULL;
......@@ -474,26 +496,11 @@ gtk_object_destroy (GtkObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
gtk_signal_emit (object, object_signals[DESTROY]);
}
/*****************************************
* gtk_object_real_destroy:
*
* arguments:
*
* results:
*****************************************/
static void
gtk_object_real_destroy (GtkObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
gtk_signal_handlers_destroy (object);
/* object->klass = gtk_type_class (gtk_destroyed_get_type ()); */
if (!GTK_OBJECT_DESTROYED (object))
{
GTK_OBJECT_SET_FLAGS (object, GTK_DESTROYED);
gtk_signal_emit (object, object_signals[DESTROY]);
}
}
/*****************************************
......
......@@ -28,18 +28,6 @@ extern "C" {
#endif /* __cplusplus */
/* GtkObject only uses the first 3 bits of the "flags" field.
* They refer to the following flags.
* GtkWidget uses the remaining bits. Though this is a kinda nasty
* break up, it does make the size of GtkWidget smaller.
*/
enum
{
GTK_FLOATING = 1 << 0,
GTK_RESERVED_1 = 1 << 1,
GTK_RESERVED_2 = 1 << 2
};
/* The debugging versions of the casting macros make sure the cast is "ok"
* before proceeding, but they are definately slower than their less
......@@ -47,48 +35,62 @@ enum
*/
#ifdef NDEBUG
#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) obj)
#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) klass)
#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) (obj))
#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) (klass))
#else /* NDEBUG */
#define GTK_CHECK_CAST(obj,cast_type,cast) \
((cast*) gtk_object_check_cast ((GtkObject*) obj, cast_type))
((cast*) gtk_object_check_cast ((GtkObject*) (obj), cast_type))
#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) \
((cast*) gtk_object_check_class_cast ((GtkObjectClass*) klass, cast_type))
((cast*) gtk_object_check_class_cast ((GtkObjectClass*) (klass), cast_type))
#endif /* NDEBUG */
/* Determines whether 'obj' is a type of 'otype'.
*/
#define GTK_CHECK_TYPE(obj,otype) (gtk_type_is_a (((GtkObject*) obj)->klass->type, otype))
#define GTK_CHECK_TYPE(obj,otype) (gtk_type_is_a (((GtkObject*) (obj))->klass->type, otype))
/* Macro for casting a pointer to a GtkObject pointer.
*/
#define GTK_OBJECT(obj) GTK_CHECK_CAST (obj, gtk_object_get_type (), GtkObject)
#define GTK_OBJECT(obj) GTK_CHECK_CAST ((obj), gtk_object_get_type (), GtkObject)
/* Macros for extracting various fields from GtkObject and
* GtkObjectClass.
/* Macros for extracting various fields from GtkObject and GtkObjectClass.
*/
#define GTK_OBJECT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_object_get_type (), GtkObjectClass)
#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags)
#define GTK_OBJECT_FLOATING(obj) (GTK_OBJECT_FLAGS (obj) & GTK_FLOATING)
#define GTK_OBJECT_DESTROY(obj) (GTK_OBJECT (obj)->klass->destroy)
#define GTK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_object_get_type (), GtkObjectClass))
#define GTK_OBJECT_TYPE(obj) (GTK_OBJECT (obj)->klass->type)
#define GTK_OBJECT_SIGNALS(obj) (GTK_OBJECT (obj)->klass->signals)
#define GTK_OBJECT_NSIGNALS(obj) (GTK_OBJECT (obj)->klass->nsignals)
/* Macro for testing whether "obj" is of type GtkObject.
/* GtkObject only uses the first 4 bits of the flags field.
* GtkWidget uses the remaining bits. Though this is a kinda nasty
* break up, it does make the size of GtkWidget smaller.
*/
enum
{
GTK_DESTROYED = 1 << 0,
GTK_FLOATING = 1 << 1,
GTK_RESERVED_1 = 1 << 2,
GTK_RESERVED_2 = 1 << 3
};
/* Macros for extracting the object_flags from GtkObject.
*/
#define GTK_IS_OBJECT(obj) GTK_CHECK_TYPE (obj, gtk_object_get_type ())
#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags)
#define GTK_OBJECT_DESTROYED(obj) (GTK_OBJECT_FLAGS (obj) & GTK_DESTROYED)
#define GTK_OBJECT_FLOATING(obj) (GTK_OBJECT_FLAGS (obj) & GTK_FLOATING)
/* Macros for setting and clearing bits in the "flags" field of GtkObject.
/* Macros for setting and clearing bits in the object_flags field of GtkObject.
*/
#define GTK_OBJECT_SET_FLAGS(obj,flag) (GTK_OBJECT_FLAGS (obj) |= (flag))
#define GTK_OBJECT_UNSET_FLAGS(obj,flag) (GTK_OBJECT_FLAGS (obj) &= ~(flag))
#define GTK_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
#define GTK_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END
/* Macro for testing whether "obj" is of type GtkObject.
*/
#define GTK_IS_OBJECT(obj) (GTK_CHECK_TYPE ((obj), gtk_object_get_type ()))
typedef struct _GtkObjectClass GtkObjectClass;
......@@ -99,10 +101,16 @@ typedef struct _GtkObjectClass GtkObjectClass;
*/
struct _GtkObject
{
/* 32 bits of flags. GtkObject only uses 3 of these bits and
/* A pointer to the objects class. This will actually point to
* the derived objects class struct (which will be derived from
* GtkObjectClass).
*/
GtkObjectClass *klass;
/* 32 bits of flags. GtkObject only uses 4 of these bits and
* GtkWidget uses the rest. This is done because structs are
* aligned on 4 or 8 byte boundaries. If bitfields were used
* both here and in GtkWidget much space would be wasted.
* aligned on 4 or 8 byte boundaries. If a new bitfield were
* used in GtkWidget much space would be wasted.
*/
guint32 flags;
......@@ -111,12 +119,6 @@ struct _GtkObject
*/
guint ref_count;
/* A pointer to the objects class. This will actually point to
* the derived objects class struct (which will be derived from
* GtkObjectClass).
*/
GtkObjectClass *klass;
/* The list of signal handlers and other data
* fields for this object.
*/
......
......@@ -140,7 +140,7 @@ static GHashTable *signal_info_hash_table = NULL;
static gint next_signal = 1;
static gint next_handler_id = 1;
static const char *handler_key = "signal_handlers";
static const gchar *handler_key = "gtk-signal-handlers";
static GMemChunk *handler_mem_chunk = NULL;
static GMemChunk *emission_mem_chunk = NULL;
......@@ -532,6 +532,59 @@ gtk_signal_connect_object_after (GtkObject *object,
TRUE, FALSE);
}
typedef struct _GtkDisconnectInfo GtkDisconnectInfo;
struct _GtkDisconnectInfo
{
GtkObject *object1;
gint disconnect_handler1;
gint signal_handler;
GtkObject *object2;
gint disconnect_handler2;
};
static gint
gtk_alive_disconnecter (GtkDisconnectInfo *info)
{
g_return_val_if_fail (info != NULL, 0);
gtk_signal_disconnect (info->object1, info->disconnect_handler1);
gtk_signal_disconnect (info->object1, info->signal_handler);
gtk_signal_disconnect (info->object2, info->disconnect_handler2);
g_free (info);
return 0;
}
void
gtk_signal_connect_object_while_alive (GtkObject *object,
const gchar *signal,
GtkSignalFunc func,
GtkObject *alive_object)
{
GtkDisconnectInfo *info;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
g_return_if_fail (signal != NULL);
g_return_if_fail (func != NULL);
g_return_if_fail (alive_object != NULL);
g_return_if_fail (GTK_IS_OBJECT (alive_object));
info = g_new (GtkDisconnectInfo, 1);
info->object1 = object;
info->object2 = alive_object;
info->signal_handler = gtk_signal_connect_object (object, signal, func, alive_object);
info->disconnect_handler1 = gtk_signal_connect_object (info->object1,
"destroy",
GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
(GtkObject*) info);
info->disconnect_handler2 = gtk_signal_connect_object (info->object2,
"destroy",
GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
(GtkObject*) info);
}
void
gtk_signal_disconnect (GtkObject *object,
gint anid)
......@@ -554,8 +607,7 @@ gtk_signal_disconnect (GtkObject *object,
if (prev)
prev->next = tmp->next;
else
gtk_object_set_data (object, handler_key, tmp->next);
gtk_signal_handler_unref (tmp, object);
gtk_signal_handler_unref (tmp, object);
return;
}
......@@ -563,7 +615,7 @@ gtk_signal_disconnect (GtkObject *object,
tmp = tmp->next;
}
g_warning ("could not find handler (%d)", anid);
g_warning ("gtk_signal_disconnect(): could not find handler (%d)", anid);
}
void
......@@ -594,7 +646,7 @@ gtk_signal_disconnect_by_data (GtkObject *object,
}
if (!found_one)
g_warning ("could not find handler containing data (0x%0lX)", (long) data);
g_warning ("gtk_signal_disconnect_by_data(): could not find handler containing data (0x%0lX)", (long) data);
}
void
......@@ -621,7 +673,7 @@ gtk_signal_handler_block (GtkObject *object,
tmp = tmp->next;
}
g_warning ("could not find handler (%d)", anid);
g_warning ("gtk_signal_handler_block(): could not find handler (%d)", anid);
}
void
......@@ -651,7 +703,7 @@ gtk_signal_handler_block_by_data (GtkObject *object,
}
if (!found_one)
g_warning ("could not find handler containing data (0x%0lX)", (long) data);
g_warning ("gtk_signal_handler_block_by_data(): could not find handler containing data (0x%0lX)", (long) data);
}
void
......@@ -678,7 +730,7 @@ gtk_signal_handler_unblock (GtkObject *object,
tmp = tmp->next;
}
g_warning ("could not find handler (%d)", anid);
g_warning ("gtk_signal_handler_unblock(): could not find handler (%d)", anid);
}
void
......@@ -708,7 +760,7 @@ gtk_signal_handler_unblock_by_data (GtkObject *object,
}
if (!found_one)
g_warning ("could not find handler containing data (0x%0lX)", (long) data);
g_warning ("gtk_signal_handler_unblock_by_data(): could not find handler containing data (0x%0lX)", (long) data);
}
void
......
......@@ -108,6 +108,12 @@ gint gtk_signal_connect_interp (GtkObject *object,
gpointer data,
GtkDestroyNotify destroy_func,
gint after);
void gtk_signal_connect_object_while_alive (GtkObject *object,
const gchar *signal,
GtkSignalFunc func,
GtkObject *alive_object);
void gtk_signal_disconnect (GtkObject *object,
gint anid);
void gtk_signal_disconnect_by_data (GtkObject *object,
......
......@@ -24,6 +24,7 @@
#include "gtksignal.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
#include "gdk/gdk.h"
#include "gdk/gdkx.h"
......@@ -881,7 +882,7 @@ gtk_widget_init (GtkWidget *widget)
GdkColormap *colormap;
GdkVisual *visual;
GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE | GTK_PARENT_SENSITIVE);
GTK_PRIVATE_FLAGS (widget) = 0;
widget->state = GTK_STATE_NORMAL;
widget->saved_state = GTK_STATE_NORMAL;
widget->name = NULL;
......@@ -894,6 +895,8 @@ gtk_widget_init (GtkWidget *widget)
widget->window = NULL;
widget->parent = NULL;
GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE | GTK_PARENT_SENSITIVE);
widget->style = gtk_widget_peek_style ();
gtk_style_ref (widget->style);
......@@ -1227,7 +1230,7 @@ gtk_widget_hide_all (GtkWidget *widget)
if (toplevel != widget)
GTK_CONTAINER (toplevel)->resize_widgets =
g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RESIZE_NEEDED);
GTK_PRIVATE_UNSET_FLAGS (widget, GTK_RESIZE_NEEDED);
}
widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
......@@ -1310,11 +1313,10 @@ gtk_widget_realize (GtkWidget *widget)
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[REALIZE]);
if (GTK_WIDGET_HAS_SHAPE_MASK(widget))
if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
{
shape_info = gtk_object_get_data (GTK_OBJECT (widget),
shape_info_key);
g_assert (shape_info != 0);
gdk_window_shape_combine_mask (widget->window,
shape_info->shape_mask,
shape_info->offset_x,
......@@ -1396,7 +1398,7 @@ gtk_widget_queue_draw (GtkWidget *widget)
parent = parent->parent;
}
GTK_WIDGET_SET_FLAGS (widget, GTK_REDRAW_PENDING);
GTK_PRIVATE_SET_FLAGS (widget, GTK_REDRAW_PENDING);
if (gtk_widget_redraw_queue == NULL)
gtk_idle_add ((GtkFunction) gtk_widget_idle_draw, NULL);
......@@ -1436,13 +1438,13 @@ gtk_widget_queue_resize (GtkWidget *widget)
g_return_if_fail (widget != NULL);
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_ANCHORED (toplevel))
if (GTK_WIDGET_TOPLEVEL (toplevel))
{
if (GTK_WIDGET_VISIBLE (toplevel))
{
if (!GTK_WIDGET_RESIZE_PENDING (toplevel))
{
GTK_WIDGET_SET_FLAGS (toplevel, GTK_RESIZE_PENDING);
GTK_PRIVATE_SET_FLAGS (toplevel, GTK_RESIZE_PENDING);
if (gtk_widget_resize_queue == NULL)
gtk_idle_add ((GtkFunction) gtk_widget_idle_sizer, NULL);
gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel);
......@@ -1450,7 +1452,7 @@ gtk_widget_queue_resize (GtkWidget *widget)
if (!GTK_WIDGET_RESIZE_NEEDED (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_RESIZE_NEEDED);
GTK_PRIVATE_SET_FLAGS (widget, GTK_RESIZE_NEEDED);
GTK_CONTAINER (toplevel)->resize_widgets =
g_slist_prepend (GTK_CONTAINER (toplevel)->resize_widgets, widget);
}
......@@ -1881,7 +1883,7 @@ gtk_widget_reparent (GtkWidget *widget,
{
/* Set a flag so that gtk_widget_unparent doesn't unrealize widget
*/
GTK_WIDGET_SET_FLAGS (widget, GTK_IN_REPARENT);
GTK_PRIVATE_SET_FLAGS (widget, GTK_IN_REPARENT);
}
gtk_widget_ref (widget);
......@@ -1917,6 +1919,8 @@ gtk_widget_reparent (GtkWidget *widget,
}
else
gdk_window_reparent (widget->window, gtk_widget_get_parent_window (widget), 0, 0);
GTK_PRIVATE_UNSET_FLAGS (widget, GTK_IN_REPARENT);
}
}
}
......@@ -2230,18 +2234,6 @@ gtk_widget_set_parent (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_assert (widget->parent == NULL);
if (GTK_WIDGET_TOPLEVEL (widget))
{
g_assert (parent == NULL);
g_assert (!GTK_WIDGET_TOPLEVEL_ONSCREEN (widget));
gtk_widget_ref (widget);
gtk_object_sink (GTK_OBJECT (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_TOPLEVEL_ONSCREEN);
return;
}
g_return_if_fail (parent != NULL);
gtk_widget_ref (widget);
......@@ -2259,7 +2251,7 @@ gtk_widget_set_parent (GtkWidget *widget,
while (parent->parent != NULL)
parent = parent->parent;
if (GTK_WIDGET_ANCHORED (parent))
if (GTK_WIDGET_TOPLEVEL (parent))
{
if (!GTK_WIDGET_USER_STYLE (widget))
{
......@@ -2347,7 +2339,7 @@ gtk_widget_set_style (GtkWidget *widget,
{
g_return_if_fail (widget != NULL);
GTK_WIDGET_SET_FLAGS (widget, GTK_USER_STYLE);
GTK_PRIVATE_SET_FLAGS (widget, GTK_USER_STYLE);
gtk_widget_set_style_internal (widget, style);
}
......@@ -3085,13 +3077,13 @@ gtk_widget_real_destroy (GtkObject *object)
if (GTK_WIDGET_REDRAW_PENDING (widget))
{
gtk_widget_redraw_queue = g_slist_remove (gtk_widget_redraw_queue, widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REDRAW_PENDING);
GTK_PRIVATE_UNSET_FLAGS (widget, GTK_REDRAW_PENDING);
}
if (GTK_WIDGET_RESIZE_PENDING (widget))
{
gtk_widget_resize_queue = g_slist_remove (gtk_widget_resize_queue, widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RESIZE_PENDING);
GTK_PRIVATE_UNSET_FLAGS (widget, GTK_RESIZE_PENDING);
}
if (GTK_WIDGET_RESIZE_NEEDED (widget))
......@@ -3101,23 +3093,18 @@ gtk_widget_real_destroy (GtkObject *object)
toplevel = gtk_widget_get_toplevel (widget);
GTK_CONTAINER (toplevel)->resize_widgets =
g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RESIZE_NEEDED);
GTK_PRIVATE_UNSET_FLAGS (widget, GTK_RESIZE_NEEDED);
}
if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
gtk_widget_shape_combine_mask (widget, NULL, -1, -1);
gtk_grab_remove (widget);
gtk_selection_remove_all (widget);
gtk_widget_unrealize (widget);
if (widget->parent)
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);