reflect the presence of signal connections through unsetting

Sat May  9 00:03:12 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
        signal connections through unsetting GTK_CONNECTED.
        (gtk_signal_handler_insert): reflect the presence of signal connections
        through setting GTK_CONNECTED.
        (gtk_signal_real_emit): only check for handler emissions if the object
        has the GTK_CONNECTED flag set.
        (gtk_signal_handler_pending): don't check for pending handlers if the
        GTK_CONNECTED flag is not set for this object.

        * gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
        a GtkObject has signal handler connections.

        * gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
        set for this object call gtk_signal_handlers_destroy().

        * gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
        multiple processing of macro args.

        * gtk/gtktypeutils.c:
        * gtk/gtkobject.c:
        * gtk/gtkwidget.c:
        * gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
This commit is contained in:
Tim Janik 1998-05-08 23:20:48 +00:00 committed by Tim Janik
parent 6e99903a4e
commit 142c848308
13 changed files with 344 additions and 129 deletions

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -1,3 +1,28 @@
Sat May 9 00:03:12 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of
signal connections through unsetting GTK_CONNECTED.
(gtk_signal_handler_insert): reflect the presence of signal connections
through setting GTK_CONNECTED.
(gtk_signal_real_emit): only check for handler emissions if the object
has the GTK_CONNECTED flag set.
(gtk_signal_handler_pending): don't check for pending handlers if the
GTK_CONNECTED flag is not set for this object.
* gtk/gtkobject.h (enum): new flag GTK_CONNECTED to indicate whether
a GtkObject has signal handler connections.
* gtk/gtkobject.c (gtk_object_real_destroy): only if GTK_CONNECTED is
set for this object call gtk_signal_handlers_destroy().
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): deprecated macro, since it caused
multiple processing of macro args.
* gtk/gtktypeutils.c:
* gtk/gtkobject.c:
* gtk/gtkwidget.c:
* gtk/gtksignal.c: reverted GTK_TYPE_IS_A back to gtk_type_is_a.
Thu May 7 19:03:50 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_unique): asure that the type system has

View File

@ -231,7 +231,6 @@ gtk_object_init (GtkObject *object)
* Functions to end a GtkObject's life time
*
********************************************/
void
gtk_object_destroy (GtkObject *object)
{
@ -260,7 +259,8 @@ gtk_object_shutdown (GtkObject *object)
static void
gtk_object_real_destroy (GtkObject *object)
{
gtk_signal_handlers_destroy (object);
if (GTK_OBJECT_CONNECTED (object))
gtk_signal_handlers_destroy (object);
}
static void
@ -646,7 +646,7 @@ gtk_object_getv (GtkObject *object,
g_free (lookup_name);
continue;
}
else if (!GTK_TYPE_IS_A (object->klass->type, info->class_type))
else if (!gtk_type_is_a (object->klass->type, info->class_type))
{
g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
args[i].type = GTK_TYPE_INVALID;
@ -710,7 +710,7 @@ gtk_object_query_args (GtkType class_type,
*arg_flags = NULL;
g_return_val_if_fail (nargs != NULL, NULL);
*nargs = 0;
g_return_val_if_fail (GTK_TYPE_IS_A (class_type, gtk_object_get_type ()), NULL);
g_return_val_if_fail (gtk_type_is_a (class_type, gtk_object_get_type ()), NULL);
if (!arg_info_ht)
return NULL;
@ -850,7 +850,7 @@ gtk_object_setv (GtkObject *object,
g_warning ("invalid arg type for: \"%s\"\n", lookup_name);
arg_ok = FALSE;
}
else if (!GTK_TYPE_IS_A (object->klass->type, info->class_type))
else if (!gtk_type_is_a (object->klass->type, info->class_type))
{
g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
arg_ok = FALSE;
@ -1290,7 +1290,7 @@ gtk_object_check_cast (GtkObject *obj,
gtk_object_descriptive_type_name (cast_type));
return obj;
}
if (!GTK_TYPE_IS_A (obj->klass->type, cast_type))
if (!gtk_type_is_a (obj->klass->type, cast_type))
{
g_warning ("invalid cast from `%s' to `%s'",
gtk_object_descriptive_type_name (obj->klass->type),
@ -1326,7 +1326,7 @@ gtk_object_check_class_cast (GtkObjectClass *klass,
gtk_object_descriptive_type_name (cast_type));
return klass;
}
if (!GTK_TYPE_IS_A (klass->type, cast_type))
if (!gtk_type_is_a (klass->type, cast_type))
{
g_warning ("invalid class cast from `%s' to `%s'",
gtk_object_descriptive_type_name (klass->type),

View File

@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@ -38,7 +38,7 @@ extern "C" {
*/
#ifdef GTK_NO_CHECK_CASTS
#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) (obj))
#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) (obj))
#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) (klass))
#else /* !GTK_NO_CHECK_CASTS */
@ -54,7 +54,7 @@ extern "C" {
/* Determines whether `obj' and `klass' are a type of `otype'.
*/
#define GTK_CHECK_TYPE(obj,otype) ( \
#define GTK_CHECK_TYPE(obj,otype) ( \
GTK_TYPE_IS_A (((GtkObject*) (obj))->klass->type, (otype)) \
)
#define GTK_CHECK_CLASS_TYPE(klass,otype) ( \
@ -89,10 +89,10 @@ extern "C" {
/* Macros for extracting various fields from GtkObject and 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)
#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)
/* GtkObject only uses the first 4 bits of the flags field.
* Derived objects may use the remaining bits. Though this
* is a kinda nasty break up, it does make the size of
@ -100,22 +100,23 @@ extern "C" {
*/
enum
{
GTK_DESTROYED = 1 << 0,
GTK_FLOATING = 1 << 1,
GTK_RESERVED_1 = 1 << 2,
GTK_RESERVED_2 = 1 << 3,
GTK_OBJECT_FLAG_LAST = GTK_RESERVED_2
GTK_DESTROYED = 1 << 0,
GTK_FLOATING = 1 << 1,
GTK_CONNECTED = 1 << 2,
GTK_RESERVED_2 = 1 << 3,
GTK_OBJECT_FLAG_LAST = GTK_RESERVED_2
};
/* Macros for extracting the object_flags from GtkObject.
*/
#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)
#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)
#define GTK_OBJECT_CONNECTED(obj) (GTK_OBJECT_FLAGS (obj) & GTK_CONNECTED)
/* Macros for setting and clearing bits in the object_flags field of GtkObject.
*/
#define GTK_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
#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
/* GtkArg flag bits for gtk_object_add_arg_type
@ -131,7 +132,7 @@ enum
};
typedef struct _GtkObjectClass GtkObjectClass;
typedef struct _GtkObjectClass GtkObjectClass;
/* GtkObject is the base of the object hierarchy. It defines
@ -144,19 +145,19 @@ struct _GtkObject
* 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 a new bitfield were
* used in GtkWidget much space would be wasted.
*/
guint32 flags;
/* reference count.
* refer to the file REFCOUNTING on this issue.
*/
guint ref_count;
/* The list of signal handlers and other data
* fields for this object.
*/
@ -173,20 +174,20 @@ struct _GtkObjectClass
* one unique identifier per class.
*/
GtkType type;
/* The signals this object class handles. "signals" is an
* array of signal ID's.
*/
guint *signals;
/* The number of signals listed in "signals".
*/
guint nsignals;
/* The number of arguments per class.
*/
guint n_args;
/* The functions that will end an objects life time. In one way ore
* another all three of them are defined for all objects. If an
* object class overrides one of the methods in order to perform class
@ -197,7 +198,7 @@ struct _GtkObjectClass
*/
void (* shutdown) (GtkObject *object);
void (* destroy) (GtkObject *object);
void (* finalize) (GtkObject *object);
};
@ -207,11 +208,11 @@ struct _GtkObjectClass
*/
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
typedef void (*GtkSignalFunc) (void);
typedef void (*GtkSignalMarshaller) (GtkObject *object,
typedef void (*GtkSignalFunc) (void);
typedef void (*GtkSignalMarshaller) (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
gpointer func_data,
GtkArg *args);
/* Get the type identifier for GtkObject's.
@ -221,16 +222,16 @@ GtkType gtk_object_get_type (void);
/* Append "signals" to those already defined in "class".
*/
void gtk_object_class_add_signals (GtkObjectClass *klass,
guint *signals,
guint nsignals);
guint *signals,
guint nsignals);
/* Append a user defined signal without default handler to a class.
*/
guint gtk_object_class_add_user_signal (GtkObjectClass *klass,
const gchar *name,
guint gtk_object_class_add_user_signal (GtkObjectClass *klass,
const gchar *name,
GtkSignalMarshaller marshaller,
GtkType return_val,
guint nparams,
GtkType return_val,
guint nparams,
...);
GtkObject* gtk_object_new (GtkType type,
@ -239,16 +240,16 @@ GtkObject* gtk_object_new (GtkType type,
GtkObject* gtk_object_newv (GtkType type,
guint nargs,
GtkArg *args);
void gtk_object_sink (GtkObject *object);
void gtk_object_ref (GtkObject *object);
void gtk_object_unref (GtkObject *object);
void gtk_object_sink (GtkObject *object);
void gtk_object_ref (GtkObject *object);
void gtk_object_unref (GtkObject *object);
void gtk_object_weakref (GtkObject *object,
void gtk_object_weakref (GtkObject *object,
GtkDestroyNotify notify,
gpointer data);
void gtk_object_weakunref (GtkObject *object,
gpointer data);
void gtk_object_weakunref (GtkObject *object,
GtkDestroyNotify notify,
gpointer data);
gpointer data);
void gtk_object_destroy (GtkObject *object);
@ -281,9 +282,9 @@ void gtk_object_setv (GtkObject *object,
* It is the callers response to do a
* g_free (returned_args); g_free (*acess_masks).
*/
GtkArg* gtk_object_query_args (GtkType class_type,
GtkArg* gtk_object_query_args (GtkType class_type,
guint32 **arg_flags,
guint *nargs);
guint *nargs);
void gtk_object_add_arg_type (const gchar *arg_name,
GtkType arg_type,
@ -305,45 +306,45 @@ void gtk_object_set_data (GtkObject *object,
/* Like gtk_object_set_data, but takes an additional argument
* which is a function to be called when the data is removed.
*/
void gtk_object_set_data_full (GtkObject *object,
void gtk_object_set_data_full (GtkObject *object,
const gchar *key,
gpointer data,
gpointer data,
GtkDestroyNotify destroy);
/* Get the data associated with "key".
*/
gpointer gtk_object_get_data (GtkObject *object,
gpointer gtk_object_get_data (GtkObject *object,
const gchar *key);
/* Remove the data associated with "key". This call is
* equivalent to 'gtk_object_set_data' where 'data' is NULL.
*/
void gtk_object_remove_data (GtkObject *object,
void gtk_object_remove_data (GtkObject *object,
const gchar *key);
/* Object data functions that operate on key ids.
* These functions are meant for *internal* use only.
*/
void gtk_object_set_data_by_id (GtkObject *object,
void gtk_object_set_data_by_id (GtkObject *object,
guint data_id,
gpointer data);
void gtk_object_set_data_by_id_full (GtkObject *object,
guint data_id,
gpointer data,
gpointer data);
void gtk_object_set_data_by_id_full (GtkObject *object,
guint data_id,
gpointer data,
GtkDestroyNotify destroy);
gpointer gtk_object_get_data_by_id (GtkObject *object,
guint data_id);
void gtk_object_remove_data_by_id (GtkObject *object,
gpointer gtk_object_get_data_by_id (GtkObject *object,
guint data_id);
guint gtk_object_data_try_key (const gchar *key);
guint gtk_object_data_force_id (const gchar *key);
void gtk_object_remove_data_by_id (GtkObject *object,
guint data_id);
guint gtk_object_data_try_key (const gchar *key);
guint gtk_object_data_force_id (const gchar *key);
/* Set the "user_data" object data field of "object". It should
* be noted that this is no different than calling 'gtk_object_set_data'
* with a key of "user_data". It is merely provided as a convenience.
*/
void gtk_object_set_user_data (GtkObject *object,
gpointer data);
gpointer data);
/* Get the "user_data" object data field of "object". It should
* be noted that this is no different than calling 'gtk_object_get_data'
@ -355,14 +356,14 @@ GtkObject* gtk_object_check_cast (GtkObject *obj,
GtkType cast_type);
GtkObjectClass* gtk_object_check_class_cast (GtkObjectClass *klass,
GtkType cast_type);
GtkType cast_type);
void gtk_trace_referencing (gpointer *object,
const gchar *func,
guint local_frame,
guint line,
guint local_frame,
guint line,
gboolean do_ref);
#if G_ENABLE_DEBUG && defined (__GNUC__)
# define gtk_object_ref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 1);f--;}G_STMT_END
# define gtk_object_unref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 0);f--;}G_STMT_END

View File

@ -392,7 +392,7 @@ gtk_signal_lookup (const gchar *name,
GtkSignalHash hash;
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (GTK_TYPE_IS_A (object_type, GTK_TYPE_OBJECT), 0);
g_return_val_if_fail (gtk_type_is_a (object_type, GTK_TYPE_OBJECT), 0);
hash.name_key_id = gtk_object_data_try_key (name);
if (hash.name_key_id)
@ -1204,8 +1204,13 @@ gtk_signal_handler_unref (GtkHandler *handler,
if (handler->prev)
handler->prev->next = handler->next;
else
else if (handler->next)
gtk_object_set_data_by_id (object, handler_key_id, handler->next);
else
{
GTK_OBJECT_UNSET_FLAGS (object, GTK_CONNECTED);
gtk_object_set_data_by_id (object, handler_key_id, NULL);
}
if (handler->next)
handler->next->prev = handler->prev;
@ -1225,7 +1230,10 @@ gtk_signal_handler_insert (GtkObject *object,
tmp = gtk_object_get_data_by_id (object, handler_key_id);
if (!tmp)
gtk_object_set_data_by_id (object, handler_key_id, handler);
{
GTK_OBJECT_SET_FLAGS (object, GTK_CONNECTED);
gtk_object_set_data_by_id (object, handler_key_id, handler);
}
else
while (tmp)
{
@ -1266,7 +1274,7 @@ gtk_signal_real_emit (GtkObject *object,
signal = LOOKUP_SIGNAL_ID (signal_id);
g_return_if_fail (signal != NULL);
g_return_if_fail (GTK_TYPE_IS_A (GTK_OBJECT_TYPE (object), signal->object_type));
g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type));
if ((signal->run_type & GTK_RUN_NO_RECURSE) &&
gtk_emission_check (current_emissions, object, signal_id))
@ -1292,25 +1300,35 @@ gtk_signal_real_emit (GtkObject *object,
NULL, params);
}
info.object = object;
info.marshaller = signal->marshaller;
info.params = params;
info.param_types = signal->params;
info.return_val = signal->return_val;
info.nparams = signal->nparams;
info.run_type = signal->run_type;
info.signal_id = signal_id;
handlers = gtk_signal_get_handlers (object, signal_id);
switch (gtk_handlers_run (handlers, &info, FALSE))
if (GTK_OBJECT_CONNECTED (object))
{
case EMISSION_CONTINUE:
break;
case EMISSION_RESTART:
goto emission_restart;
case EMISSION_DONE:
goto emission_done;
handlers = gtk_signal_get_handlers (object, signal_id);
if (handlers)
{
info.object = object;
info.marshaller = signal->marshaller;
info.params = params;
info.param_types = signal->params;
info.return_val = signal->return_val;
info.nparams = signal->nparams;
info.run_type = signal->run_type;
info.signal_id = signal_id;
switch (gtk_handlers_run (handlers, &info, FALSE))
{
case EMISSION_CONTINUE:
break;
case EMISSION_RESTART:
goto emission_restart;
case EMISSION_DONE:
goto emission_done;
}
}
else
info.object = NULL;
}
else
info.object = NULL;
if (GTK_RUN_TYPE (signal->run_type) != GTK_RUN_FIRST && signal->function_offset != 0)
{
@ -1321,15 +1339,32 @@ gtk_signal_real_emit (GtkObject *object,
NULL, params);
}
handlers = gtk_signal_get_handlers (object, signal_id);
switch (gtk_handlers_run (handlers, &info, TRUE))
if (GTK_OBJECT_CONNECTED (object))
{
case EMISSION_CONTINUE:
break;
case EMISSION_RESTART:
goto emission_restart;
case EMISSION_DONE:
goto emission_done;
handlers = gtk_signal_get_handlers (object, signal_id);
if (handlers)
{
if (!info.object)
{
info.object = object;
info.marshaller = signal->marshaller;
info.params = params;
info.param_types = signal->params;
info.return_val = signal->return_val;
info.nparams = signal->nparams;
info.run_type = signal->run_type;
info.signal_id = signal_id;
}
switch (gtk_handlers_run (handlers, &info, TRUE))
{
case EMISSION_CONTINUE:
break;
case EMISSION_RESTART:
goto emission_restart;
case EMISSION_DONE:
goto emission_done;
}
}
}
emission_done:
@ -1370,8 +1405,11 @@ gtk_signal_handler_pending (GtkObject *object,
g_return_val_if_fail (object != NULL, 0);
g_return_val_if_fail (signal_id >= 1, 0);
handlers = gtk_signal_get_handlers (object, signal_id);
if (GTK_OBJECT_CONNECTED (object))
handlers = gtk_signal_get_handlers (object, signal_id);
else
return 0;
handler_id = 0;
while (handlers && handlers->signal_id == signal_id)

View File

@ -364,25 +364,26 @@ gint
gtk_type_is_a (GtkType type,
GtkType is_a_type)
{
register GtkTypeNode *node;
/* we already check for type==is_a_type in the
* wrapper macro GTK_TYPE_IS_A()
*/
LOOKUP_TYPE_NODE (node, type);
if (node)
if (type == is_a_type)
return TRUE;
else
{
register GtkTypeNode *a_node;
register GtkTypeNode *node;
LOOKUP_TYPE_NODE (a_node, is_a_type);
if (a_node)
LOOKUP_TYPE_NODE (node, type);
if (node)
{
if (a_node->n_supers <= node->n_supers)
return node->supers[node->n_supers - a_node->n_supers] == is_a_type;
register GtkTypeNode *a_node;
LOOKUP_TYPE_NODE (a_node, is_a_type);
if (a_node)
{
if (a_node->n_supers <= node->n_supers)
return node->supers[node->n_supers - a_node->n_supers] == is_a_type;
}
}
}
return FALSE;
}
@ -462,7 +463,7 @@ gtk_type_class_init (GtkTypeNode *node)
memcpy (node->klass, parent->klass, parent->type_info.class_size);
}
if (GTK_TYPE_IS_A (node->type, GTK_TYPE_OBJECT))
if (gtk_type_is_a (node->type, GTK_TYPE_OBJECT))
{
GtkObjectClass *object_class;

View File

@ -74,10 +74,10 @@ extern GtkType gtk_type_builtins[];
#define GTK_TYPE_MAKE(parent_t, seqno) (((seqno) << 8) | GTK_FUNDAMENTAL_TYPE (parent_t))
#define GTK_FUNDAMENTAL_TYPE(type) ((GtkFundamentalType) ((type) & 0xFF))
#define GTK_TYPE_SEQNO(type) ((type) > 0xFF ? (type) >> 8 : (type))
#define GTK_TYPE_IS_A(type, is_a_type) ( \
((GtkType) (type)) == ((GtkType) (is_a_type)) || \
gtk_type_is_a (((GtkType) (type)), ((GtkType) (is_a_type))) \
)
/* deprecated
*/
#define GTK_TYPE_IS_A gtk_type_is_a
typedef struct _GtkArg GtkArg;
typedef struct _GtkObject GtkObject; /* forward declaration of object type */

View File

@ -999,7 +999,7 @@ gtk_widget_new (guint type,
va_list args1;
va_list args2;
g_return_val_if_fail (GTK_TYPE_IS_A (type, gtk_widget_get_type ()), NULL);
g_return_val_if_fail (gtk_type_is_a (type, gtk_widget_get_type ()), NULL);
obj = gtk_type_new (type);
@ -1029,7 +1029,7 @@ gtk_widget_newv (guint type,
guint nargs,
GtkArg *args)
{
g_return_val_if_fail (GTK_TYPE_IS_A (type, gtk_widget_get_type ()), NULL);
g_return_val_if_fail (gtk_type_is_a (type, gtk_widget_get_type ()), NULL);
return GTK_WIDGET (gtk_object_newv (type, nargs, args));
}
@ -2268,14 +2268,14 @@ gtk_widget_grab_focus (GtkWidget *widget)
parent = widget->parent;
child = widget;
while (parent && !GTK_TYPE_IS_A (GTK_WIDGET_TYPE (parent), window_type))
while (parent && !gtk_type_is_a (GTK_WIDGET_TYPE (parent), window_type))
{
gtk_container_set_focus_child (GTK_CONTAINER (parent), child);
child = parent;
parent = parent->parent;
}
if (parent && GTK_TYPE_IS_A (GTK_WIDGET_TYPE (parent), window_type))
if (parent && gtk_type_is_a (GTK_WIDGET_TYPE (parent), window_type))
{
gtk_container_set_focus_child (GTK_CONTAINER (parent), child);
gtk_window_set_focus (GTK_WINDOW (parent), widget);
@ -2303,10 +2303,10 @@ gtk_widget_grab_default (GtkWidget *widget)
window_type = gtk_window_get_type ();
window = widget->parent;
while (window && !GTK_TYPE_IS_A (GTK_WIDGET_TYPE (window), window_type))
while (window && !gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
window = window->parent;
if (window && GTK_TYPE_IS_A (GTK_WIDGET_TYPE (window), window_type))
if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
gtk_window_set_default (GTK_WINDOW (window), widget);
}
@ -2986,10 +2986,10 @@ gtk_widget_get_ancestor (GtkWidget *widget,
{
g_return_val_if_fail (widget != NULL, NULL);
while (widget && !GTK_TYPE_IS_A (GTK_WIDGET_TYPE (widget), widget_type))
while (widget && !gtk_type_is_a (GTK_WIDGET_TYPE (widget), widget_type))
widget = widget->parent;
if (!(widget && GTK_TYPE_IS_A (GTK_WIDGET_TYPE (widget), widget_type)))
if (!(widget && gtk_type_is_a (GTK_WIDGET_TYPE (widget), widget_type)))
return NULL;
return widget;