reimplemented the signal storage system to use a linear array rather than

Wed May  6 02:16:34 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtksignal.c: reimplemented the signal storage system to use a
        linear array rather than a hash table.
        be carefull *not* to keep any GtkSignal pointers across invokations
        of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
        general code cleanups, made all allocations through memchunks.
        (gtk_signal_lookup): we now do the lookup of signals through a key_id
        for the signal names to avoid multiple hashing of the signal name on
        lookups for the several hirarchy levels of an object.

Tue May  5 15:33:27 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
        checking for signal initialization in gtksignal.c.

        * gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
        a long debugging period ;)

Mon May  4 00:30:11 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
        gtk_type_is_a().
        * gtk/gtktypeutils.c: reimplemented the type storage system to use a
        linear array rather than a hash table. it actually speeded up testgtk
        for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
        pointers across invokations of gtk_type_node_next_and_invalidate() and
        therefore gtk_type_unique()!

        * gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
        inheritance of a class pointer.
        (GTK_OBJECT): modifications for speedups.
        (GTK_IS_OBJECT): likewise.
        (GTK_OBJECT_CLASS): likewise.
        (suggested by owen).

        * gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.

        * gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.

        * gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
        since its derivation changed 4 month ago ;(. showed up with the unique
        type name checking code in gtk_type_unique().

        * random guint->GtkType and macro fixups.
This commit is contained in:
Tim Janik 1998-05-06 01:43:56 +00:00 committed by Tim Janik
parent c3e04d86ec
commit 518a8a9c4e
30 changed files with 1269 additions and 797 deletions

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1,3 +1,22 @@
Wed May 6 02:16:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: reimplemented the signal storage system to use a
linear array rather than a hash table.
be carefull *not* to keep any GtkSignal pointers across invokations
of gtk_signal_next_and_invalidate() and therefore gtk_signal_new[v]().
general code cleanups, made all allocations through memchunks.
(gtk_signal_lookup): we now do the lookup of signals through a key_id
for the signal names to avoid multiple hashing of the signal name on
lookups for the several hirarchy levels of an object.
Tue May 5 15:33:27 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmain.c (gtk_init): added gtk_signal_init() to avoid repeatedly
checking for signal initialization in gtksignal.c.
* gtk/gtktypeutils.c (TYPE_NODES_BLOCK_SIZE): reseted this to 200 after
a long debugging period ;)
1998-05-05 Stefan Jeske <stefan@gtk.org>
* gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes):
@ -8,6 +27,33 @@
* configure.in: Added $x_libs in the other_libraries field in the
check for XShapeCombineMask.
Mon May 4 00:30:11 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h (GTK_TYPE_IS_A): new macro to speedup
gtk_type_is_a().
* gtk/gtktypeutils.c: reimplemented the type storage system to use a
linear array rather than a hash table. it actually speeded up testgtk
for a *considerable* amount. be carefull *not* to keep any GtkTypeNode
pointers across invokations of gtk_type_node_next_and_invalidate() and
therefore gtk_type_unique()!
* gtk/gtkobject.h (GTK_IS_OBJECT_CLASS): new macro to test for the
inheritance of a class pointer.
(GTK_OBJECT): modifications for speedups.
(GTK_IS_OBJECT): likewise.
(GTK_OBJECT_CLASS): likewise.
(suggested by owen).
* gtk/gtkcontainer.h (GTK_IS_CONTAINER_CLASS): new macro.
* gtk/gtkwidget.h (GTK_IS_WIDGET_CLASS): new macro.
* gtk/gtk.defs (GtkTooltips): define GtkTooltips as object not as boxed,
since its derivation changed 4 month ago ;(. showed up with the unique
type name checking code in gtk_type_unique().
* random guint->GtkType and macro fixups.
Sat May 2 23:14:34 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcurve.c (gtk_curve_graph_events): Ignore
@ -138,7 +184,6 @@ Sat May 2 20:19:03 1998 Tim Janik <timj@gtk.org>
(gtk_adjustment_set_value): new function to emit the "value_changed"
signal.
>>>>>>> 1.372
Fri May 1 12:28:35 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.c: Further changes to the way the window

View File

@ -1094,7 +1094,7 @@
;; Tooltips
(define-boxed GtkTooltips
(define-object GtkTooltips
gtk_tooltips_ref
gtk_tooltips_unref)

View File

@ -37,10 +37,10 @@ static void gtk_aspect_frame_size_allocate (GtkWidget *widget,
#define MAX_RATIO 10000.0
#define MIN_RATIO 0.0001
guint
GtkType
gtk_aspect_frame_get_type (void)
{
static guint aspect_frame_type = 0;
static GtkType aspect_frame_type = 0;
if (!aspect_frame_type)
{

View File

@ -26,12 +26,16 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_ASPECT_FRAME(obj) ((GtkAspectFrame*) obj)
#define GTK_ASPECT_FRAME_CLASS(obj) ((GtkAspectFrameClass*) GTK_OBJECT_CLASS (obj))
#define GTK_IS_ASPECT_FRAME(obj) (gtk_type_is_a (GTK_WIDGET_TYPE (obj), gtk_aspect_frame_get_type ()))
#define GTK_TYPE_ASPECT_FRAME (gtk_aspect_frame_get_type ())
#define GTK_ASPECT_FRAME(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ASPECT_FRAME, GtkAspectFrame))
#define GTK_ASPECT_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASPECT_FRAME, GtkAspectFrameClass))
#define GTK_IS_ASPECT_FRAME(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ASPECT_FRAME))
#define GTK_IS_ASPECT_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASPECT_FRAME))
typedef struct _GtkAspectFrame GtkAspectFrame;
@ -55,7 +59,7 @@ struct _GtkAspectFrameClass
};
guint gtk_aspect_frame_get_type (void);
GtkType gtk_aspect_frame_get_type (void);
GtkWidget* gtk_aspect_frame_new (const gchar *label,
gfloat xalign,
gfloat yalign,

View File

@ -93,10 +93,10 @@ static GtkContainerClass *parent_class;
static guint button_signals[LAST_SIGNAL] = { 0 };
guint
GtkType
gtk_button_get_type (void)
{
static guint button_type = 0;
static GtkType button_type = 0;
if (!button_type)
{

View File

@ -26,12 +26,14 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_BUTTON(obj) (GTK_CHECK_CAST ((obj), gtk_button_get_type (), GtkButton))
#define GTK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_button_get_type (), GtkButtonClass))
#define GTK_IS_BUTTON(obj) (GTK_CHECK_TYPE ((obj), gtk_button_get_type ()))
#define GTK_TYPE_BUTTON (gtk_button_get_type ())
#define GTK_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BUTTON, GtkButton))
#define GTK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON, GtkButtonClass))
#define GTK_IS_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BUTTON))
#define GTK_IS_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON))
typedef struct _GtkButton GtkButton;
@ -59,7 +61,7 @@ struct _GtkButtonClass
};
guint gtk_button_get_type (void);
GtkType gtk_button_get_type (void);
GtkWidget* gtk_button_new (void);
GtkWidget* gtk_button_new_with_label (const gchar *label);
void gtk_button_pressed (GtkButton *button);

View File

@ -47,10 +47,10 @@ static GtkMenuItemClass *parent_class = NULL;
static guint check_menu_item_signals[LAST_SIGNAL] = { 0 };
guint
GtkType
gtk_check_menu_item_get_type (void)
{
static guint check_menu_item_type = 0;
static GtkType check_menu_item_type = 0;
if (!check_menu_item_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
@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_CHECK_MENU_ITEM(obj) ((GtkCheckMenuItem*) obj)
#define GTK_CHECK_MENU_ITEM_CLASS(obj) ((GtkCheckMenuItemClass*) GTK_OBJECT_CLASS (obj))
#define GTK_IS_CHECK_MENU_ITEM(obj) (gtk_type_is_a (GTK_WIDGET_TYPE (obj), gtk_check_menu_item_get_type ()))
#define GTK_TYPE_CHECK_MENU_ITEM (gtk_check_menu_item_get_type ())
#define GTK_CHECK_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItem))
#define GTK_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass))
#define GTK_IS_CHECK_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CHECK_MENU_ITEM))
#define GTK_IS_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM))
typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
@ -40,7 +43,7 @@ typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass;
struct _GtkCheckMenuItem
{
GtkMenuItem menu_item;
guint active : 1;
guint always_show_toggle : 1;
};
@ -48,21 +51,21 @@ struct _GtkCheckMenuItem
struct _GtkCheckMenuItemClass
{
GtkMenuItemClass parent_class;
void (* toggled) (GtkCheckMenuItem *check_menu_item);
void (* toggled) (GtkCheckMenuItem *check_menu_item);
void (* draw_indicator) (GtkCheckMenuItem *check_menu_item,
GdkRectangle *area);
GdkRectangle *area);
};
guint gtk_check_menu_item_get_type (void);
GtkWidget* gtk_check_menu_item_new (void);
GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
void gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item,
gint state);
GtkType gtk_check_menu_item_get_type (void);
GtkWidget* gtk_check_menu_item_new (void);
GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
void gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item,
gint state);
void gtk_check_menu_item_set_show_toggle(GtkCheckMenuItem *menu_item,
gboolean always);
void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
gboolean always);
void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
#ifdef __cplusplus

View File

@ -32,11 +32,12 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), gtk_container_get_type (), GtkContainer))
#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_container_get_type (), GtkContainerClass))
#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), gtk_container_get_type ()))
#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
#define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
typedef struct _GtkContainer GtkContainer;
typedef struct _GtkContainerClass GtkContainerClass;

View File

@ -32,10 +32,10 @@ static void gtk_data_class_init (GtkDataClass *klass);
static guint data_signals[LAST_SIGNAL] = { 0 };
guint
GtkType
gtk_data_get_type (void)
{
static guint data_type = 0;
static GtkType data_type = 0;
if (!data_type)
{

View File

@ -26,12 +26,16 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_DATA(obj) GTK_CHECK_CAST (obj, gtk_data_get_type (), GtkData)
#define GTK_DATA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_data_get_type (), GtkDataClass)
#define GTK_IS_DATA(obj) GTK_CHECK_TYPE (obj, gtk_data_get_type ())
#define GTK_TYPE_DATA (gtk_data_get_type ())
#define GTK_DATA(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_DATA, GtkData))
#define GTK_DATA_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_DATA, GtkDataClass))
#define GTK_IS_DATA(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_DATA))
#define GTK_IS_DATA_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATA))
typedef struct _GtkData GtkData;
@ -50,7 +54,7 @@ struct _GtkDataClass
};
guint gtk_data_get_type (void);
GtkType gtk_data_get_type (void);
#ifdef __cplusplus

View File

@ -327,7 +327,7 @@ gtk_init (int *argc,
* C locale, or were using X's mb functions. (-DX_LOCALE && locale != C)
*/
current_locale = g_strdup(setlocale (LC_CTYPE, NULL));
current_locale = g_strdup (setlocale (LC_CTYPE, NULL));
#ifdef X_LOCALE
if ((strcmp (current_locale, "C")) && (strcmp (current_locale, "POSIX")))
@ -342,7 +342,7 @@ gtk_init (int *argc,
g_free (current_locale);
GTK_NOTE(MISC, g_print("%s multi-byte string functions.\n",
GTK_NOTE (MISC, g_print("%s multi-byte string functions.\n",
gtk_use_mb ? "Using" : "Not using"));
/* Initialize the default visual and colormap to be
@ -351,9 +351,11 @@ gtk_init (int *argc,
*/
gtk_visual = gdk_visual_get_system ();
gtk_colormap = gdk_colormap_get_system ();
gtk_type_init ();
gtk_signal_init ();
gtk_rc_init ();
gtk_type_init ();
/* Register an exit function to make sure we are able to cleanup.
*/

View File

@ -640,7 +640,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;
@ -704,7 +704,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;
@ -844,7 +844,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;
@ -1270,7 +1270,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),
@ -1306,7 +1306,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

@ -27,6 +27,7 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
@ -51,18 +52,43 @@ extern "C" {
#endif /* GTK_NO_CHECK_CASTS */
/* Determines whether 'obj' is a type of 'otype'.
/* Determines whether `obj' and `klass' are 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)) \
)
#define GTK_CHECK_CLASS_TYPE(klass,otype) ( \
GTK_TYPE_IS_A (((GtkObjectClass*) (klass))->type, (otype)) \
)
/* Macro for casting a pointer to a GtkObject pointer.
/* Macro for casting a pointer to a GtkObject or GtkObjectClass pointer.
* The second portion of the ?: statments are just in place to offer
* descriptive warning message.
*/
#define GTK_OBJECT(obj) GTK_CHECK_CAST ((obj), gtk_object_get_type (), GtkObject)
#define GTK_OBJECT(object) ( \
GTK_IS_OBJECT (object) ? \
(GtkObject*) (object) : \
(GtkObject*) gtk_object_check_cast ((GtkObject*) (object), GTK_TYPE_OBJECT) \
)
#define GTK_OBJECT_CLASS(klass) ( \
GTK_IS_OBJECT_CLASS (klass) ? \
(GtkObjectClass*) (klass) : \
(GtkObjectClass*) gtk_object_check_class_cast ((GtkObjectClass*) (klass), GTK_TYPE_OBJECT) \
)
/* Macro for testing whether `object' and `klass' are of type GTK_TYPE_OBJECT.
*/
#define GTK_IS_OBJECT(object) ( \
(object) != NULL && \
GTK_IS_OBJECT_CLASS (((GtkObject*) (object))->klass) \
)
#define GTK_IS_OBJECT_CLASS(klass) ( \
(klass) != NULL && \
GTK_FUNDAMENTAL_TYPE (((GtkObjectClass*) (klass))->type) == GTK_TYPE_OBJECT \
)
/* 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_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)
@ -81,17 +107,6 @@ enum
GTK_OBJECT_FLAG_LAST = GTK_RESERVED_2
};
/* GtkArg flag bits for gtk_object_add_arg_type
*/
enum
{
GTK_ARG_READABLE = 1 << 0,
GTK_ARG_WRITABLE = 1 << 1,
GTK_ARG_CONSTRUCT = 1 << 2
};
#define GTK_ARG_READWRITE (GTK_ARG_READABLE | GTK_ARG_WRITABLE)
/* Macros for extracting the object_flags from GtkObject.
*/
#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags)
@ -103,9 +118,17 @@ enum
#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.
/* GtkArg flag bits for gtk_object_add_arg_type
*/
#define GTK_IS_OBJECT(obj) (GTK_CHECK_TYPE ((obj), gtk_object_get_type ()))
enum
{
GTK_ARG_READABLE = 1 << 0,
GTK_ARG_WRITABLE = 1 << 1,
GTK_ARG_CONSTRUCT = 1 << 2,
/* aliases
*/
GTK_ARG_READWRITE = GTK_ARG_READABLE | GTK_ARG_WRITABLE
};
typedef struct _GtkObjectClass GtkObjectClass;
@ -193,7 +216,7 @@ typedef void (*GtkSignalMarshaller) (GtkObject *object,
/* Get the type identifier for GtkObject's.
*/
guint gtk_object_get_type (void);
GtkType gtk_object_get_type (void);
/* Append "signals" to those already defined in "class".
*/

File diff suppressed because it is too large Load Diff

View File

@ -32,9 +32,9 @@ extern "C" {
#ifdef offsetof
#define GTK_SIGNAL_OFFSET(t, f) ((int) offsetof (t, f))
#define GTK_SIGNAL_OFFSET(t, f) ((gint) offsetof (t, f))
#else /* offsetof */
#define GTK_SIGNAL_OFFSET(t, f) ((int) ((char*) &((t*) 0)->f))
#define GTK_SIGNAL_OFFSET(t, f) ((gint) ((gchar*) &((t*) 0)->f))
#endif /* offsetof */
@ -53,13 +53,14 @@ struct _GtkSignalQuery
GtkType object_type;
guint signal_id;
const gchar *signal_name;
gboolean is_user_signal;
guint is_user_signal : 1;
GtkSignalRunType run_type;
GtkType return_val;
guint nparams;
const GtkType *params;
};
void gtk_signal_init (void);
guint gtk_signal_new (const gchar *name,
GtkSignalRunType run_type,
GtkType object_type,

View File

@ -56,4 +56,3 @@
{ "GdkWindow", GTK_TYPE_BOXED },
{ "GdkEvent", GTK_TYPE_BOXED },
{ "GdkColor", GTK_TYPE_BOXED },
{ "GtkTooltips", GTK_TYPE_BOXED },

View File

@ -56,5 +56,4 @@
#define GTK_TYPE_GDK_WINDOW (gtk_type_builtins[53])
#define GTK_TYPE_GDK_EVENT (gtk_type_builtins[54])
#define GTK_TYPE_GDK_COLOR (gtk_type_builtins[55])
#define GTK_TYPE_TOOLTIPS (gtk_type_builtins[56])
#define GTK_TYPE_NUM_BUILTINS 57
#define GTK_TYPE_NUM_BUILTINS 56

View File

@ -21,51 +21,102 @@
#include "gtktypeutils.h"
#define TYPE_NODES_BLOCK_SIZE (200)
typedef struct _GtkTypeNode GtkTypeNode;
struct _GtkTypeNode
{
GtkType type;
gint init_class;
gpointer klass;
GtkTypeInfo type_info;
GtkTypeNode *parent;
GList *children;
guint n_supers;
GtkType *supers;
GtkType parent_type;
gpointer klass;
GList *children_types;
};
static void gtk_type_insert (guint parent_type,
GtkType type,
GtkTypeInfo *type_info);
static void gtk_type_class_init (GtkTypeNode *node);
static void gtk_type_object_init (GtkTypeNode *node,
gpointer object);
static guint gtk_type_hash (GtkType *key);
static gint gtk_type_compare (GtkType *a,
GtkType *b);
static guint gtk_type_name_hash (const char *key);
static gint gtk_type_name_compare (const char *a,
const char *b);
static void gtk_type_init_builtin_types (void);
#define LOOKUP_TYPE_NODE(node_var, type) { \
if (type > 0) \
{ \
register GtkType sqn = GTK_TYPE_SEQNO (type); \
if (sqn < n_type_nodes) \
node_var = type_nodes + sqn; \
else \
node_var = NULL; \
} \
else \
node_var = NULL; \
}
static void gtk_type_class_init (GtkTypeNode *node);
static guint gtk_type_name_hash (const char *key);
static gint gtk_type_name_compare (const char *a,
const char *b);
static void gtk_type_init_builtin_types (void);
static GtkTypeNode *type_nodes = NULL;
static guint n_type_nodes = 0;
static GHashTable *type_name_2_type_ht = NULL;
static int initialize = TRUE;
static GHashTable *type_hash_table = NULL;
static GHashTable *name_hash_table = NULL;
static GtkTypeNode*
gtk_type_node_next_and_invalidate (void)
{
static guint n_free_type_nodes = 0;
register GtkTypeNode *node;
register GtkType new_type;
/* don't keep *any* GtkTypeNode pointers across invokation of this function!!!
*/
if (n_free_type_nodes == 0)
{
register guint i;
register guint size;
/* nearest pow
*/
size = n_type_nodes + TYPE_NODES_BLOCK_SIZE;
size *= sizeof (GtkTypeNode);
i = 1;
while (i < size)
i <<= 1;
size = i;
type_nodes = g_realloc (type_nodes, size);
n_free_type_nodes = size / sizeof (GtkTypeNode) - n_type_nodes;
memset (type_nodes + n_type_nodes, 0, n_free_type_nodes * sizeof (GtkTypeNode));
}
new_type = n_type_nodes++;
n_free_type_nodes--;
LOOKUP_TYPE_NODE (node, new_type);
if (node)
node->type = new_type;
return node;
}
void
gtk_type_init (void)
{
if (initialize)
if (n_type_nodes == 0)
{
GtkTypeNode *zero;
g_assert (sizeof (GtkType) >= 4);
initialize = FALSE;
type_hash_table = g_hash_table_new ((GHashFunc) gtk_type_hash,
(GCompareFunc) gtk_type_compare);
name_hash_table = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
(GCompareFunc) gtk_type_name_compare);
zero = gtk_type_node_next_and_invalidate ();
g_assert (zero == NULL);
type_name_2_type_ht = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
(GCompareFunc) gtk_type_name_compare);
gtk_type_init_builtin_types ();
}
}
@ -74,22 +125,64 @@ GtkType
gtk_type_unique (GtkType parent_type,
GtkTypeInfo *type_info)
{
static guint next_seqno = 0;
GtkType new_type;
GtkTypeNode *new_node;
GtkTypeNode *parent;
guint i;
g_return_val_if_fail (type_info != NULL, 0);
if (g_hash_table_lookup (type_name_2_type_ht, type_info->type_name))
{
g_warning ("gtk_type_unique(): type `%s' already exists.", type_info->type_name);
return 0;
}
if (parent_type)
{
GtkTypeNode *tmp_node;
if (initialize)
gtk_type_init ();
LOOKUP_TYPE_NODE (tmp_node, parent_type);
if (!tmp_node)
{
g_warning ("gtk_type_unique(): unknown parent type `%u'.", parent_type);
return 0;
}
}
next_seqno++;
if (parent_type == GTK_TYPE_INVALID)
new_type = next_seqno;
/* relookup pointer afterwards.
*/
new_node = gtk_type_node_next_and_invalidate ();
if (parent_type)
{
new_node->type = GTK_TYPE_MAKE (parent_type, new_node->type);
LOOKUP_TYPE_NODE (parent, parent_type);
}
else
new_type = GTK_TYPE_MAKE (GTK_FUNDAMENTAL_TYPE (parent_type), next_seqno);
gtk_type_insert (parent_type, new_type, type_info);
{
g_assert (new_node->type <= 0xff);
parent = NULL;
}
return new_type;
new_node->type_info = *type_info;
new_node->type_info.type_name = g_strdup (type_info->type_name);
new_node->n_supers = parent ? parent->n_supers + 1 : 0;
new_node->supers = g_new0 (GtkType, new_node->n_supers + 1);
new_node->parent_type = parent_type;
new_node->klass = NULL;
new_node->children_types = NULL;
if (parent)
parent->children_types = g_list_append (parent->children_types, (gpointer) new_node->type);
parent = new_node;
for (i = 0; i < new_node->n_supers + 1; i++)
{
new_node->supers[i] = parent->type;
LOOKUP_TYPE_NODE (parent, parent->parent_type);
}
g_hash_table_insert (type_name_2_type_ht, new_node->type_info.type_name, (gpointer) new_node->type);
return new_node->type;
}
gchar*
@ -97,10 +190,7 @@ gtk_type_name (GtkType type)
{
GtkTypeNode *node;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
if (node)
return node->type_info.type_name;
@ -111,15 +201,14 @@ gtk_type_name (GtkType type)
GtkType
gtk_type_from_name (const gchar *name)
{
GtkTypeNode *node;
if (type_name_2_type_ht)
{
GtkType type;
type = (GtkType) g_hash_table_lookup (type_name_2_type_ht, (gpointer) name);
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (name_hash_table, (gpointer) name);
if (node)
return node->type;
return type;
}
return 0;
}
@ -129,29 +218,46 @@ gtk_type_parent (GtkType type)
{
GtkTypeNode *node;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
if (node && node->parent)
return node->parent->type;
LOOKUP_TYPE_NODE (node, type);
if (node)
return node->parent_type;
return 0;
}
gpointer
gtk_type_parent_class (GtkType type)
{
GtkTypeNode *node;
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
if (node)
{
LOOKUP_TYPE_NODE (node, node->parent_type);
if (node)
{
if (!node->klass)
gtk_type_class_init (node);
return node->klass;
}
}
return NULL;
}
gpointer
gtk_type_class (GtkType type)
{
GtkTypeNode *node;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
if (node->init_class)
if (!node->klass)
gtk_type_class_init (node);
return node->klass;
@ -161,17 +267,27 @@ gpointer
gtk_type_new (GtkType type)
{
GtkTypeNode *node;
gpointer object;
GtkObject *object;
gpointer klass;
guint i;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
g_return_val_if_fail (node != NULL, NULL);
object = g_new0 (guchar, node->type_info.object_size);
((GtkObject*) object)->klass = gtk_type_class (type);
gtk_type_object_init (node, object);
klass = gtk_type_class (type);
object = g_malloc0 (node->type_info.object_size);
object->klass = klass;
for (i = node->n_supers; i > 0; i--)
{
GtkTypeNode *pnode;
LOOKUP_TYPE_NODE (pnode, node->supers[i]);
if (pnode->type_info.object_init_func)
(* pnode->type_info.object_init_func) (object);
}
if (node->type_info.object_init_func)
(* node->type_info.object_init_func) (object);
return object;
}
@ -182,10 +298,7 @@ gtk_type_describe_heritage (GtkType type)
GtkTypeNode *node;
gint first;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
first = TRUE;
while (node)
@ -201,7 +314,7 @@ gtk_type_describe_heritage (GtkType type)
else
g_print ("<unnamed type>\n");
node = node->parent;
LOOKUP_TYPE_NODE (node, node->parent_type);
}
}
@ -209,62 +322,61 @@ void
gtk_type_describe_tree (GtkType type,
gint show_size)
{
static gint indent = 0;
GtkTypeNode *node;
GtkTypeNode *child;
GList *children;
gint old_indent;
gint i;
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
for (i = 0; i < indent; i++)
g_print (" ");
if (node->type_info.type_name)
g_print ("%s", node->type_info.type_name);
else
g_print ("<unnamed type>");
if (show_size)
g_print (" ( %d bytes )\n", node->type_info.object_size);
else
g_print ("\n");
old_indent = indent;
indent += 4;
children = node->children;
while (children)
LOOKUP_TYPE_NODE (node, type);
if (node)
{
child = children->data;
children = children->next;
gtk_type_describe_tree (child->type, show_size);
static gint indent = 0;
GList *list;
guint old_indent;
guint i;
for (i = 0; i < indent; i++)
g_print (" ");
if (node->type_info.type_name)
g_print ("%s", node->type_info.type_name);
else
g_print ("(no-name)");
if (show_size)
g_print (" ( %d bytes )\n", node->type_info.object_size);
else
g_print ("\n");
old_indent = indent;
indent += 4;
for (list = node->children_types; list; list = list->next)
gtk_type_describe_tree ((GtkType) list->data, show_size);
indent = old_indent;
}
indent = old_indent;
}
gint
gtk_type_is_a (GtkType type,
GtkType is_a_type)
{
GtkTypeNode *node;
register GtkTypeNode *node;
if (initialize)
gtk_type_init ();
/* we already check for type==is_a_type in the
* wrapper macro GTK_TYPE_IS_A()
*/
node = g_hash_table_lookup (type_hash_table, &type);
while (node)
LOOKUP_TYPE_NODE (node, type);
if (node)
{
if (node->type == is_a_type)
return TRUE;
node = node->parent;
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;
@ -281,10 +393,7 @@ gtk_type_get_arg (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (arg != NULL);
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
if (node && node->type_info.arg_get_func)
(* node->type_info.arg_get_func) (object, arg, arg_id);
@ -303,10 +412,7 @@ gtk_type_set_arg (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (arg != NULL);
if (initialize)
gtk_type_init ();
node = g_hash_table_lookup (type_hash_table, &type);
LOOKUP_TYPE_NODE (node, type);
if (node && node->type_info.arg_set_func)
(* node->type_info.arg_set_func) (object, arg, arg_id);
@ -333,85 +439,46 @@ gtk_arg_copy (GtkArg *src_arg,
return dest_arg;
}
static void
gtk_type_insert (GtkType parent_type,
GtkType type,
GtkTypeInfo *type_info)
{
GtkTypeNode *node;
GtkTypeNode *parent;
parent = g_hash_table_lookup (type_hash_table, &parent_type);
node = g_new (GtkTypeNode, 1);
node->type = type;
node->init_class = TRUE;
node->klass = NULL;
node->type_info = *type_info;
node->parent = parent;
node->children = NULL;
if (node->parent)
node->parent->children = g_list_append (node->parent->children, node);
g_hash_table_insert (type_hash_table, &node->type, node);
g_hash_table_insert (name_hash_table, node->type_info.type_name, node);
}
static void
gtk_type_class_init (GtkTypeNode *node)
{
GtkObjectClass *object_class;
if (node->init_class)
if (!node->klass && node->type_info.class_size)
{
node->init_class = FALSE;
node->klass = g_new0 (guchar, node->type_info.class_size);
if (node->parent)
if (node->parent_type)
{
if (node->parent->init_class)
gtk_type_class_init (node->parent);
GtkTypeNode *parent;
memcpy (node->klass, node->parent->klass, node->parent->type_info.class_size);
LOOKUP_TYPE_NODE (parent, node->parent_type);
if (!parent->klass)
gtk_type_class_init (parent);
if (parent->klass)
memcpy (node->klass, parent->klass, parent->type_info.class_size);
}
object_class = node->klass;
object_class->type = node->type;
object_class->signals = NULL;
object_class->nsignals = 0;
object_class->n_args = 0;
if (GTK_TYPE_IS_A (node->type, GTK_TYPE_OBJECT))
{
GtkObjectClass *object_class;
/* FIXME: this initialization needs to be done through
* a function pointer someday.
*/
g_assert (node->type_info.class_size >= sizeof (GtkObjectClass));
object_class = node->klass;
object_class->type = node->type;
object_class->signals = NULL;
object_class->nsignals = 0;
object_class->n_args = 0;
}
if (node->type_info.class_init_func)
(* node->type_info.class_init_func) (node->klass);
}
}
static void
gtk_type_object_init (GtkTypeNode *node,
gpointer object)
{
if (node->parent)
gtk_type_object_init (node->parent, object);
if (node->type_info.object_init_func)
(* node->type_info.object_init_func) (object);
}
static guint
gtk_type_hash (GtkType *key)
{
return GTK_TYPE_SEQNO (*key);
}
static gint
gtk_type_compare (GtkType *a,
GtkType *b)
{
g_return_val_if_fail(a != NULL && b != NULL, 0);
return (*a == *b);
}
static guint
gtk_type_name_hash (const char *key)
{
@ -477,12 +544,12 @@ gtk_type_init_builtin_types (void)
{ GTK_TYPE_FOREIGN, "foreign" },
{ GTK_TYPE_CALLBACK, "callback" },
{ GTK_TYPE_ARGS, "args" },
{ GTK_TYPE_POINTER, "pointer" },
{ GTK_TYPE_SIGNAL, "signal" },
{ GTK_TYPE_C_CALLBACK, "c_callback" }
};
static struct {
char *name;
GtkType parent;
@ -490,19 +557,19 @@ gtk_type_init_builtin_types (void)
#include "gtktypebuiltins.c"
{ NULL }
};
int i;
for (i = 0; i < sizeof (fundamental_info)/sizeof(fundamental_info[0]); i++)
for (i = 0; i < sizeof (fundamental_info) / sizeof (fundamental_info[0]); i++)
{
GtkType id;
id = gtk_type_register_builtin (fundamental_info[i].name,
GTK_TYPE_INVALID);
g_assert (id == fundamental_info[i].enum_id);
}
gtk_object_init_type ();
for (i = 0; builtin_info[i].name; i++)
{
gtk_type_builtins[i] =

View File

@ -25,11 +25,12 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
/* Fundamental Types */
/* Fundamental Types
*/
typedef enum
{
GTK_TYPE_INVALID,
@ -49,29 +50,34 @@ typedef enum
GTK_TYPE_FOREIGN,
GTK_TYPE_CALLBACK,
GTK_TYPE_ARGS,
GTK_TYPE_POINTER,
/* it'd be great if the next two could be removed eventually */
/* It'd be great if the next two could be removed eventually
*/
GTK_TYPE_SIGNAL,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_OBJECT
} GtkFundamentalType;
typedef guint GtkType;
/* Builtin Types */
/* Builtin Types
*/
extern GtkType gtk_type_builtins[];
#include <gtk/gtktypebuiltins.h>
/* General Types */
#define GTK_TYPE_MAKE(ft, seqno) (((seqno)<<8)|ft)
#define GTK_FUNDAMENTAL_TYPE(t) ((GtkFundamentalType)((t)&0xFF))
#define GTK_TYPE_SEQNO(t) ((t)>0xFF? (t)>>8:(t))
/* Macros
*/
#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))) \
)
typedef struct _GtkArg GtkArg;
typedef struct _GtkObject GtkObject; /* forward declaration of object type */
@ -183,6 +189,7 @@ gchar* gtk_type_name (guint type);
GtkType gtk_type_from_name (const gchar *name);
GtkType gtk_type_parent (GtkType type);
gpointer gtk_type_class (GtkType type);
gpointer gtk_type_parent_class (GtkType type);
gpointer gtk_type_new (GtkType type);
void gtk_type_describe_heritage (GtkType type);
void gtk_type_describe_tree (GtkType 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;

View File

@ -28,9 +28,10 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
/* The flags that are used by GtkWidget on top of the
* flags field of GtkObject.
*/
@ -54,13 +55,14 @@ enum
};
/* Macro for casting a pointer to a GtkWidget pointer.
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
* Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
*/
#define GTK_WIDGET(wid) GTK_CHECK_CAST ((wid), gtk_widget_get_type (), GtkWidget)
/* Macro for casting the klass field of a widget to a GtkWidgetClass pointer.
*/
#define GTK_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST ((klass), gtk_widget_get_type (), GtkWidgetClass)
#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
#define GTK_WIDGET(widget) (GTK_CHECK_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
#define GTK_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
#define GTK_IS_WIDGET(widget) (GTK_CHECK_TYPE ((widget), GTK_TYPE_WIDGET))
#define GTK_IS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
/* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
*/
@ -94,11 +96,6 @@ enum
#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
/* Macros for testing whether "wid" is of type GtkWidget.
*/
#define GTK_IS_WIDGET(wid) GTK_CHECK_TYPE ((wid), GTK_TYPE_WIDGET)
#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
typedef struct _GtkRequisition GtkRequisition;

View File

@ -115,10 +115,10 @@ static GtkBinClass *parent_class = NULL;
static guint window_signals[LAST_SIGNAL] = { 0 };
guint
GtkType
gtk_window_get_type (void)
{
static guint window_type = 0;
static GtkType window_type = 0;
if (!window_type)
{

View File

@ -26,10 +26,17 @@
#include <gtk/gtkenums.h>
#include <gtk/gtkwidget.h>
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_WINDOW(obj) GTK_CHECK_CAST (obj, gtk_window_get_type (), GtkWindow)
#define GTK_WINDOW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_window_get_type (), GtkWindowClass)
#define GTK_IS_WINDOW(obj) GTK_CHECK_TYPE (obj, gtk_window_get_type ())
#define GTK_TYPE_WINDOW (gtk_window_get_type ())
#define GTK_WINDOW(obj) (GTK_CHECK_CAST (obj, GTK_TYPE_WINDOW, GtkWindow))
#define GTK_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, GTK_TYPE_WINDOW, GtkWindowClass))
#define GTK_IS_WINDOW(obj) (GTK_CHECK_TYPE (obj, GTK_TYPE_WINDOW))
#define GTK_IS_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE (klass, GTK_TYPE_WINDOW))
typedef struct _GtkWindow GtkWindow;
@ -72,12 +79,7 @@ struct _GtkWindowClass
};
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
guint gtk_window_get_type (void);
GtkType gtk_window_get_type (void);
GtkWidget* gtk_window_new (GtkWindowType type);
void gtk_window_set_title (GtkWindow *window,
const gchar *title);