diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 18 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 18 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.c | 706 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.h | 57 | ||||
-rw-r--r-- | gtk-config.in | 2 | ||||
-rw-r--r-- | gtk/Makefile.am | 1 | ||||
-rw-r--r-- | gtk/gdk-pixbuf-loader.c | 706 | ||||
-rw-r--r-- | gtk/gdk-pixbuf-loader.h | 57 | ||||
-rw-r--r-- | gtk/gtkfeatures.h.in | 123 | ||||
-rw-r--r-- | gtk/gtktypeutils.c | 22 | ||||
-rw-r--r-- | gtk/gtktypeutils.h | 20 | ||||
-rw-r--r-- | gtk/testgtk.c | 10 | ||||
-rw-r--r-- | tests/testgtk.c | 10 |
19 files changed, 935 insertions, 908 deletions
@@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 192b196dea..3d4babb6a1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,21 @@ +Fri Jun 23 17:54:23 2000 Tim Janik <timj@gtk.org> + + * configure.in: make the current version number 1.3.1 (binary age 0, + interface age 0). + + * gtkfeatures.h, gtkfeatures.h.in: dejavue, get rid of these *again*, + gtkcompat.h is all we want. + + * gtk/gtktypeutils.[hc]: define most of the primitive types in terms of + GLib primitive types. fixed g_type_register_fundamental() argument + ordering. + + * gtk-config.in (lib_gtk): add -lgdk_pixbuf so third party code + compiles. + + * gdk-pixbuf-loader.[hc]: get rid of unistd.h include. + object code cleanup, comment trigraph fixes, etc... + 2000-06-23 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_set_buffer): Use anonymous mark diff --git a/configure.in b/configure.in index 401a115f85..a66940bb53 100644 --- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl # GTK_MAJOR_VERSION=1 GTK_MINOR_VERSION=3 -GTK_MICRO_VERSION=0 +GTK_MICRO_VERSION=1 GTK_INTERFACE_AGE=0 GTK_BINARY_AGE=0 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION @@ -1001,7 +1001,6 @@ gdk/win32/Makefile gdk/nanox/Makefile gdk/linux-fb/Makefile gtk/Makefile -gtk/gtkfeatures.h gtk/gtkcompat.h modules/Makefile modules/linux-fb/Makefile diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 9c59a423f5..9607b2f4cb 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* GdkPixbuf library - Main header file * * Copyright (C) 1999 The Free Software Foundation @@ -31,64 +29,60 @@ #include "gtksignal.h" - - enum { - AREA_UPDATED, - AREA_PREPARED, - FRAME_DONE, - ANIMATION_DONE, - CLOSED, - LAST_SIGNAL + AREA_UPDATED, + AREA_PREPARED, + FRAME_DONE, + ANIMATION_DONE, + CLOSED, + LAST_SIGNAL }; -static GtkObjectClass *parent_class; static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass); static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader); static void gdk_pixbuf_loader_destroy (GtkObject *loader); static void gdk_pixbuf_loader_finalize (GObject *loader); -static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 }; +static gpointer parent_class = NULL; +static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 }; - /* Internal data */ #define LOADER_HEADER_SIZE 128 -typedef struct { - GdkPixbuf *pixbuf; - GdkPixbufAnimation *animation; - gboolean closed; - guchar header_buf[LOADER_HEADER_SIZE]; - gint header_buf_offset; - GdkPixbufModule *image_module; - gpointer context; +typedef struct +{ + GdkPixbuf *pixbuf; + GdkPixbufAnimation *animation; + gboolean closed; + guchar header_buf[LOADER_HEADER_SIZE]; + gint header_buf_offset; + GdkPixbufModule *image_module; + gpointer context; } GdkPixbufLoaderPrivate; - /* our marshaller */ -typedef void (* GtkSignal_NONE__INT_INT_INT_INT) (GtkObject *object, - gint arg1, gint arg2, gint arg3, gint arg4, - gpointer user_data); +typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject *object, + gint arg1, gint arg2, gint arg3, gint arg4, + gpointer user_data); static void gtk_marshal_NONE__INT_INT_INT_INT (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { - GtkSignal_NONE__INT_INT_INT_INT rfunc; - - rfunc = (GtkSignal_NONE__INT_INT_INT_INT) func; - (*rfunc) (object, - GTK_VALUE_INT (args[0]), - GTK_VALUE_INT (args[1]), - GTK_VALUE_INT (args[2]), - GTK_VALUE_INT (args[3]), - func_data); + GtkSignal_NONE__INT_INT_INT_INT rfunc; + + rfunc = (GtkSignal_NONE__INT_INT_INT_INT) func; + (*rfunc) (object, + GTK_VALUE_INT (args[0]), + GTK_VALUE_INT (args[1]), + GTK_VALUE_INT (args[2]), + GTK_VALUE_INT (args[3]), + func_data); } - /** * gdk_pixbuf_loader_get_type: @@ -102,236 +96,245 @@ gtk_marshal_NONE__INT_INT_INT_INT (GtkObject *object, GtkSignalFunc func, gpoint GtkType gdk_pixbuf_loader_get_type (void) { - static GtkType loader_type = 0; - - if (!loader_type) { - static const GtkTypeInfo loader_info = { - "GdkPixbufLoader", - sizeof (GdkPixbufLoader), - sizeof (GdkPixbufLoaderClass), - (GtkClassInitFunc) gdk_pixbuf_loader_class_init, - (GtkObjectInitFunc) gdk_pixbuf_loader_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); - } - - return loader_type; + static GtkType loader_type = 0; + + if (!loader_type) + { + static const GtkTypeInfo loader_info = { + "GdkPixbufLoader", + sizeof (GdkPixbufLoader), + sizeof (GdkPixbufLoaderClass), + (GtkClassInitFunc) gdk_pixbuf_loader_class_init, + (GtkObjectInitFunc) gdk_pixbuf_loader_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); + } + + return loader_type; } static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) { - GObjectClass *gobject_class; - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - gobject_class = (GObjectClass *) class; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - pixbuf_loader_signals[AREA_PREPARED] = - gtk_signal_new ("area_prepared", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - pixbuf_loader_signals[AREA_UPDATED] = - gtk_signal_new ("area_updated", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), - gtk_marshal_NONE__INT_INT_INT_INT, - GTK_TYPE_NONE, 4, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT); - - pixbuf_loader_signals[FRAME_DONE] = - gtk_signal_new ("frame_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - pixbuf_loader_signals[ANIMATION_DONE] = - gtk_signal_new ("animation_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - pixbuf_loader_signals[CLOSED] = - gtk_signal_new ("closed", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL); - - object_class->destroy = gdk_pixbuf_loader_destroy; - gobject_class->finalize = gdk_pixbuf_loader_finalize; + GObjectClass *gobject_class; + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) class; + gobject_class = (GObjectClass *) class; + + parent_class = gtk_type_class (GTK_TYPE_OBJECT); + + pixbuf_loader_signals[AREA_PREPARED] = + gtk_signal_new ("area_prepared", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + pixbuf_loader_signals[AREA_UPDATED] = + gtk_signal_new ("area_updated", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), + gtk_marshal_NONE__INT_INT_INT_INT, + GTK_TYPE_NONE, 4, + GTK_TYPE_INT, + GTK_TYPE_INT, + GTK_TYPE_INT, + GTK_TYPE_INT); + + pixbuf_loader_signals[FRAME_DONE] = + gtk_signal_new ("frame_done", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + + pixbuf_loader_signals[ANIMATION_DONE] = + gtk_signal_new ("animation_done", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + pixbuf_loader_signals[CLOSED] = + gtk_signal_new ("closed", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL); + + object_class->destroy = gdk_pixbuf_loader_destroy; + gobject_class->finalize = gdk_pixbuf_loader_finalize; } static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - priv = g_new0 (GdkPixbufLoaderPrivate, 1); - loader->private = priv; + GdkPixbufLoaderPrivate *priv; + + priv = g_new0 (GdkPixbufLoaderPrivate, 1); + loader->private = priv; } static void gdk_pixbuf_loader_destroy (GtkObject *object) { - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - g_return_if_fail (object != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - - if (!priv->closed) - gdk_pixbuf_loader_close (loader); - - if (priv->animation) - gdk_pixbuf_animation_unref (priv->animation); - if (priv->pixbuf) - gdk_pixbuf_unref (priv->pixbuf); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + GdkPixbufLoader *loader; + GdkPixbufLoaderPrivate *priv = NULL; + + g_return_if_fail (object != NULL); + g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); + + loader = GDK_PIXBUF_LOADER (object); + priv = loader->private; + + if (!priv->closed) + gdk_pixbuf_loader_close (loader); + + if (priv->animation) + gdk_pixbuf_animation_unref (priv->animation); + if (priv->pixbuf) + gdk_pixbuf_unref (priv->pixbuf); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void gdk_pixbuf_loader_finalize (GObject *object) { - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + GdkPixbufLoader *loader; + GdkPixbufLoaderPrivate *priv = NULL; + + loader = GDK_PIXBUF_LOADER (object); + priv = loader->private; + + g_free (priv); + + if (G_OBJECT_CLASS (parent_class)->finalize) + G_OBJECT_CLASS (parent_class)->finalize (object); } static void -gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader) +gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - gdk_pixbuf_ref (pixbuf); - g_assert (priv->pixbuf == NULL); - - priv->pixbuf = pixbuf; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + gdk_pixbuf_ref (pixbuf); + + g_assert (priv->pixbuf == NULL); + + priv->pixbuf = pixbuf; + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); } static void -gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, guint x, guint y, guint width, guint height, gpointer loader) +gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, + guint x, + guint y, + guint width, + guint height, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[AREA_UPDATED], - x, y, - /* sanity check in here. Defend against an errant loader */ - MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), - MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + + gtk_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[AREA_UPDATED], + x, y, + /* sanity check in here. Defend against an errant loader */ + MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), + MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); } static void -gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) +gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - - priv->pixbuf = NULL; - - if (priv->animation == NULL) { - priv->animation = GDK_PIXBUF_ANIMATION (g_type_create_instance (GDK_TYPE_PIXBUF_ANIMATION)); - - priv->animation->n_frames = 0; - priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - } else { - int w, h; - - /* update bbox size */ - w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - - if (w > priv->animation->width) { - priv->animation->width = w; - } - if (h > priv->animation->height) { - priv->animation->height = h; - } - } - - priv->animation->frames = g_list_append (priv->animation->frames, frame); - priv->animation->n_frames ++; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[FRAME_DONE], - frame); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + + priv->pixbuf = NULL; + + if (priv->animation == NULL) + { + priv->animation = GDK_PIXBUF_ANIMATION (g_type_create_instance (GDK_TYPE_PIXBUF_ANIMATION)); + + priv->animation->n_frames = 0; + priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + } + else + { + int w, h; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + + if (w > priv->animation->width) { + priv->animation->width = w; + } + if (h > priv->animation->height) { + priv->animation->height = h; + } + } + + priv->animation->frames = g_list_append (priv->animation->frames, frame); + priv->animation->n_frames++; + gtk_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[FRAME_DONE], + frame); } static void -gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader) +gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - GdkPixbufFrame *frame; - GList *current = NULL; - gint h, w; - - priv = GDK_PIXBUF_LOADER (loader)->private; - priv->pixbuf = NULL; - - current = gdk_pixbuf_animation_get_frames (priv->animation); - - while (current) { - frame = (GdkPixbufFrame *) current->data; - - /* update bbox size */ - w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - - if (w > priv->animation->width) { - priv->animation->width = w; - } - if (h > priv->animation->height) { - priv->animation->height = h; - } - current = current->next; - } - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[ANIMATION_DONE]); + GdkPixbufLoaderPrivate *priv = NULL; + GdkPixbufFrame *frame; + GList *current = NULL; + gint h, w; + + priv = GDK_PIXBUF_LOADER (loader)->private; + priv->pixbuf = NULL; + + current = gdk_pixbuf_animation_get_frames (priv->animation); + + while (current) + { + frame = (GdkPixbufFrame *) current->data; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + + if (w > priv->animation->width) + priv->animation->width = w; + if (h > priv->animation->height) + priv->animation->height = h; + current = current->next; + } + + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE]); } - - /** * gdk_pixbuf_loader_new: * @@ -342,66 +345,72 @@ gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader) GdkPixbufLoader * gdk_pixbuf_loader_new (void) { - return gtk_type_new (gdk_pixbuf_loader_get_type ()); + return g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL); } -static int -gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader) +static gint +gdk_pixbuf_loader_load_module (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv = loader->private; - - priv->image_module = gdk_pixbuf_get_module (priv->header_buf, priv->header_buf_offset); - - if (priv->image_module == NULL) - return 0; - - if (priv->image_module->module == NULL) - gdk_pixbuf_load_module (priv->image_module); - - if (priv->image_module->module == NULL) - return 0; - - if ((priv->image_module->begin_load == NULL) || - (priv->image_module->stop_load == NULL) || - (priv->image_module->load_increment == NULL)) { - g_warning ("module %s does not support incremental loading.\n", - priv->image_module->module_name); - return 0; - } - - priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, - gdk_pixbuf_loader_update, - gdk_pixbuf_loader_frame_done, - gdk_pixbuf_loader_animation_done, - loader); - - if (priv->context == NULL) { - g_warning("Failed to begin progressive load"); - return 0; - } - - if( (* priv->image_module->load_increment) (priv->context, priv->header_buf, priv->header_buf_offset) ) - return priv->header_buf_offset; - - return 0; + GdkPixbufLoaderPrivate *priv = loader->private; + + priv->image_module = gdk_pixbuf_get_module (priv->header_buf, priv->header_buf_offset); + + if (priv->image_module == NULL) + return 0; + + if (priv->image_module->module == NULL) + gdk_pixbuf_load_module (priv->image_module); + + if (priv->image_module->module == NULL) + return 0; + + if ((priv->image_module->begin_load == NULL) || + (priv->image_module->stop_load == NULL) || + (priv->image_module->load_increment == NULL)) + { + g_warning (G_STRLOC ": module %s does not support incremental loading.\n", + priv->image_module->module_name); + return 0; + } + + priv->context = priv->image_module->begin_load (gdk_pixbuf_loader_prepare, + gdk_pixbuf_loader_update, + gdk_pixbuf_loader_frame_done, + gdk_pixbuf_loader_animation_done, + loader); + + if (priv->context == NULL) + { + g_warning (G_STRLOC ": Failed to begin progressive load"); + return 0; + } + + if (priv->image_module->load_increment (priv->context, priv->header_buf, priv->header_buf_offset)) + return priv->header_buf_offset; + + return 0; } static int -gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, const guchar *buf, size_t count) +gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count) { - int nbytes; - GdkPixbufLoaderPrivate *priv = loader->private; - - nbytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count); - memcpy (priv->header_buf + priv->header_buf_offset, buf, nbytes); - - priv->header_buf_offset += nbytes; - - if(priv->header_buf_offset >= LOADER_HEADER_SIZE) { - if (gdk_pixbuf_loader_load_module(loader) == 0) - return 0; - } - return nbytes; + gint n_bytes; + GdkPixbufLoaderPrivate *priv = loader->private; + + n_bytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count); + memcpy (priv->header_buf + priv->header_buf_offset, buf, n_bytes); + + priv->header_buf_offset += n_bytes; + + if (priv->header_buf_offset >= LOADER_HEADER_SIZE) + { + if (gdk_pixbuf_loader_load_module (loader) == 0) + return 0; + } + + return n_bytes; } /** @@ -419,36 +428,39 @@ gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, const guchar *buf, * cannot parse the buffer. **/ gboolean -gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, size_t count) +gdk_pixbuf_loader_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, FALSE); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE); - - g_return_val_if_fail (buf != NULL, FALSE); - g_return_val_if_fail (count >= 0, FALSE); - - priv = loader->private; - - /* we expect it's not to be closed */ - g_return_val_if_fail (priv->closed == FALSE, FALSE); - - if (priv->image_module == NULL) { - int eaten; - - eaten = gdk_pixbuf_loader_eat_header_write(loader, buf, count); - if (eaten <= 0) - return FALSE; - - count -= eaten; - buf += eaten; - } - - if (count > 0 && priv->image_module->load_increment) - return (* priv->image_module->load_increment) (priv->context, buf, count); - - return TRUE; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, FALSE); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE); + + g_return_val_if_fail (buf != NULL, FALSE); + g_return_val_if_fail (count >= 0, FALSE); + + priv = loader->private; + + /* we expect it's not to be closed */ + g_return_val_if_fail (priv->closed == FALSE, FALSE); + + if (priv->image_module == NULL) + { + gint eaten; + + eaten = gdk_pixbuf_loader_eat_header_write(loader, buf, count); + if (eaten <= 0) + return FALSE; + + count -= eaten; + buf += eaten; + } + + if (count > 0 && priv->image_module->load_increment) + return priv->image_module->load_increment (priv->context, buf, count); + + return TRUE; } /** @@ -469,14 +481,14 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, size_t coun GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, NULL); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); - - priv = loader->private; - - return priv->pixbuf; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, NULL); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); + + priv = loader->private; + + return priv->pixbuf; } /** @@ -490,18 +502,18 @@ gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader) * * Return value: The GdkPixbufAnimation that the loader is loading, or NULL if not enough data has been read to determine the information. - **/ +**/ GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, NULL); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); - - priv = loader->private; - - return priv->animation; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, NULL); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); + + priv = loader->private; + + return priv->animation; } /** @@ -514,26 +526,24 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) void gdk_pixbuf_loader_close (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_if_fail (loader != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader)); - - priv = loader->private; - - /* we expect it's not closed */ - g_return_if_fail (priv->closed == FALSE); - - /* We have less the 128 bytes in the image. Flush it, and keep going. */ - if (priv->image_module == NULL) - gdk_pixbuf_loader_load_module (loader); - - if (priv->image_module && priv->image_module->stop_load) - (* priv->image_module->stop_load) (priv->context); - - priv->closed = TRUE; - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[CLOSED]); + GdkPixbufLoaderPrivate *priv; + + g_return_if_fail (loader != NULL); + g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader)); + + priv = loader->private; + + /* we expect it's not closed */ + g_return_if_fail (priv->closed == FALSE); + + /* We have less the 128 bytes in the image. Flush it, and keep going. */ + if (priv->image_module == NULL) + gdk_pixbuf_loader_load_module (loader); + + if (priv->image_module && priv->image_module->stop_load) + priv->image_module->stop_load (priv->context); + + priv->closed = TRUE; + + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[CLOSED]); } - diff --git a/gdk-pixbuf/gdk-pixbuf-loader.h b/gdk-pixbuf/gdk-pixbuf-loader.h index 9f9a79dc25..1b06ff74fb 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.h +++ b/gdk-pixbuf/gdk-pixbuf-loader.h @@ -26,7 +26,6 @@ #ifndef GDK_PIXBUF_LOADER_H #define GDK_PIXBUF_LOADER_H -#include <unistd.h> #include <gtk/gtkobject.h> #include <gdk-pixbuf/gdk-pixbuf.h> @@ -34,52 +33,52 @@ extern "C" { #endif - + #define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ()) #define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) #define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) #define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) #define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) typedef struct _GdkPixbufLoader GdkPixbufLoader; struct _GdkPixbufLoader { - GtkObject object; - - /* < Private > */ - gpointer private; + GtkObject object; + + /*< private >*/ + gpointer private; }; typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; -struct _GdkPixbufLoaderClass { - GtkObjectClass parent_class; - - void (* area_prepared) (GdkPixbufLoader *loader); - - void (* area_updated) (GdkPixbufLoader *loader, - guint x, guint y, guint width, guint height); - - void (* frame_done) (GdkPixbufLoader *loader, GdkPixbufFrame *frame); - - void (* animation_done) (GdkPixbufLoader *loader); - - void (* closed) (GdkPixbufLoader *loader); +struct _GdkPixbufLoaderClass +{ + GtkObjectClass parent_class; + + void (*area_prepared) (GdkPixbufLoader *loader); + void (*area_updated) (GdkPixbufLoader *loader, + guint x, + guint y, + guint width, + guint height); + void (*frame_done) (GdkPixbufLoader *loader, + GdkPixbufFrame *frame); + void (*animation_done) (GdkPixbufLoader *loader); + void (*closed) (GdkPixbufLoader *loader); }; - -GtkType gdk_pixbuf_loader_get_type (void); -GdkPixbufLoader *gdk_pixbuf_loader_new (void); -gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, - const guchar *buf, - size_t count); -GdkPixbuf *gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader); -GdkPixbufAnimation *gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader); -void gdk_pixbuf_loader_close (GdkPixbufLoader *loader); +GtkType gdk_pixbuf_loader_get_type (void); +GdkPixbufLoader * gdk_pixbuf_loader_new (void); +gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count); +GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader); +GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader); +void gdk_pixbuf_loader_close (GdkPixbufLoader *loader); - #ifdef __cplusplus } diff --git a/gtk-config.in b/gtk-config.in index ad8cc1434d..b186ea1e90 100644 --- a/gtk-config.in +++ b/gtk-config.in @@ -120,6 +120,6 @@ if test "$echo_libs" = "yes"; then fi done - echo $libdirs @more_ldflags@ -lgtk-$target -lgdk-$target $my_glib_libs @INTLLIBS@ @PANGO_LIBS@ @more_libs@ @GDK_WLIBS@ @MATH_LIB@ + echo $libdirs @more_ldflags@ -lgtk-$target -lgdk_pixbuf -lgdk-$target $my_glib_libs @INTLLIBS@ @PANGO_LIBS@ @more_libs@ @GDK_WLIBS@ @MATH_LIB@ fi diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 0719357c10..e1375c837d 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -80,7 +80,6 @@ gtk_public_h_sources = @STRIP_BEGIN@ \ gtkentry.h \ gtkenums.h \ gtkeventbox.h \ - gtkfeatures.h \ gtkfilesel.h \ gtkfixed.h \ gtkfontsel.h \ diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 9c59a423f5..9607b2f4cb 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -1,5 +1,3 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* GdkPixbuf library - Main header file * * Copyright (C) 1999 The Free Software Foundation @@ -31,64 +29,60 @@ #include "gtksignal.h" - - enum { - AREA_UPDATED, - AREA_PREPARED, - FRAME_DONE, - ANIMATION_DONE, - CLOSED, - LAST_SIGNAL + AREA_UPDATED, + AREA_PREPARED, + FRAME_DONE, + ANIMATION_DONE, + CLOSED, + LAST_SIGNAL }; -static GtkObjectClass *parent_class; static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *klass); static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader); static void gdk_pixbuf_loader_destroy (GtkObject *loader); static void gdk_pixbuf_loader_finalize (GObject *loader); -static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 }; +static gpointer parent_class = NULL; +static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 }; - /* Internal data */ #define LOADER_HEADER_SIZE 128 -typedef struct { - GdkPixbuf *pixbuf; - GdkPixbufAnimation *animation; - gboolean closed; - guchar header_buf[LOADER_HEADER_SIZE]; - gint header_buf_offset; - GdkPixbufModule *image_module; - gpointer context; +typedef struct +{ + GdkPixbuf *pixbuf; + GdkPixbufAnimation *animation; + gboolean closed; + guchar header_buf[LOADER_HEADER_SIZE]; + gint header_buf_offset; + GdkPixbufModule *image_module; + gpointer context; } GdkPixbufLoaderPrivate; - /* our marshaller */ -typedef void (* GtkSignal_NONE__INT_INT_INT_INT) (GtkObject *object, - gint arg1, gint arg2, gint arg3, gint arg4, - gpointer user_data); +typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject *object, + gint arg1, gint arg2, gint arg3, gint arg4, + gpointer user_data); static void gtk_marshal_NONE__INT_INT_INT_INT (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg * args) { - GtkSignal_NONE__INT_INT_INT_INT rfunc; - - rfunc = (GtkSignal_NONE__INT_INT_INT_INT) func; - (*rfunc) (object, - GTK_VALUE_INT (args[0]), - GTK_VALUE_INT (args[1]), - GTK_VALUE_INT (args[2]), - GTK_VALUE_INT (args[3]), - func_data); + GtkSignal_NONE__INT_INT_INT_INT rfunc; + + rfunc = (GtkSignal_NONE__INT_INT_INT_INT) func; + (*rfunc) (object, + GTK_VALUE_INT (args[0]), + GTK_VALUE_INT (args[1]), + GTK_VALUE_INT (args[2]), + GTK_VALUE_INT (args[3]), + func_data); } - /** * gdk_pixbuf_loader_get_type: @@ -102,236 +96,245 @@ gtk_marshal_NONE__INT_INT_INT_INT (GtkObject *object, GtkSignalFunc func, gpoint GtkType gdk_pixbuf_loader_get_type (void) { - static GtkType loader_type = 0; - - if (!loader_type) { - static const GtkTypeInfo loader_info = { - "GdkPixbufLoader", - sizeof (GdkPixbufLoader), - sizeof (GdkPixbufLoaderClass), - (GtkClassInitFunc) gdk_pixbuf_loader_class_init, - (GtkObjectInitFunc) gdk_pixbuf_loader_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); - } - - return loader_type; + static GtkType loader_type = 0; + + if (!loader_type) + { + static const GtkTypeInfo loader_info = { + "GdkPixbufLoader", + sizeof (GdkPixbufLoader), + sizeof (GdkPixbufLoaderClass), + (GtkClassInitFunc) gdk_pixbuf_loader_class_init, + (GtkObjectInitFunc) gdk_pixbuf_loader_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + loader_type = gtk_type_unique (GTK_TYPE_OBJECT, &loader_info); + } + + return loader_type; } static void gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) { - GObjectClass *gobject_class; - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - gobject_class = (GObjectClass *) class; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - pixbuf_loader_signals[AREA_PREPARED] = - gtk_signal_new ("area_prepared", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - pixbuf_loader_signals[AREA_UPDATED] = - gtk_signal_new ("area_updated", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), - gtk_marshal_NONE__INT_INT_INT_INT, - GTK_TYPE_NONE, 4, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT, - GTK_TYPE_INT); - - pixbuf_loader_signals[FRAME_DONE] = - gtk_signal_new ("frame_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - pixbuf_loader_signals[ANIMATION_DONE] = - gtk_signal_new ("animation_done", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - pixbuf_loader_signals[CLOSED] = - gtk_signal_new ("closed", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL); - - object_class->destroy = gdk_pixbuf_loader_destroy; - gobject_class->finalize = gdk_pixbuf_loader_finalize; + GObjectClass *gobject_class; + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) class; + gobject_class = (GObjectClass *) class; + + parent_class = gtk_type_class (GTK_TYPE_OBJECT); + + pixbuf_loader_signals[AREA_PREPARED] = + gtk_signal_new ("area_prepared", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + pixbuf_loader_signals[AREA_UPDATED] = + gtk_signal_new ("area_updated", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated), + gtk_marshal_NONE__INT_INT_INT_INT, + GTK_TYPE_NONE, 4, + GTK_TYPE_INT, + GTK_TYPE_INT, + GTK_TYPE_INT, + GTK_TYPE_INT); + + pixbuf_loader_signals[FRAME_DONE] = + gtk_signal_new ("frame_done", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + + pixbuf_loader_signals[ANIMATION_DONE] = + gtk_signal_new ("animation_done", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + pixbuf_loader_signals[CLOSED] = + gtk_signal_new ("closed", + GTK_RUN_LAST, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL); + + object_class->destroy = gdk_pixbuf_loader_destroy; + gobject_class->finalize = gdk_pixbuf_loader_finalize; } static void gdk_pixbuf_loader_init (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - priv = g_new0 (GdkPixbufLoaderPrivate, 1); - loader->private = priv; + GdkPixbufLoaderPrivate *priv; + + priv = g_new0 (GdkPixbufLoaderPrivate, 1); + loader->private = priv; } static void gdk_pixbuf_loader_destroy (GtkObject *object) { - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - g_return_if_fail (object != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - - if (!priv->closed) - gdk_pixbuf_loader_close (loader); - - if (priv->animation) - gdk_pixbuf_animation_unref (priv->animation); - if (priv->pixbuf) - gdk_pixbuf_unref (priv->pixbuf); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + GdkPixbufLoader *loader; + GdkPixbufLoaderPrivate *priv = NULL; + + g_return_if_fail (object != NULL); + g_return_if_fail (GDK_IS_PIXBUF_LOADER (object)); + + loader = GDK_PIXBUF_LOADER (object); + priv = loader->private; + + if (!priv->closed) + gdk_pixbuf_loader_close (loader); + + if (priv->animation) + gdk_pixbuf_animation_unref (priv->animation); + if (priv->pixbuf) + gdk_pixbuf_unref (priv->pixbuf); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void gdk_pixbuf_loader_finalize (GObject *object) { - GdkPixbufLoader *loader; - GdkPixbufLoaderPrivate *priv = NULL; - - loader = GDK_PIXBUF_LOADER (object); - priv = loader->private; - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + GdkPixbufLoader *loader; + GdkPixbufLoaderPrivate *priv = NULL; + + loader = GDK_PIXBUF_LOADER (object); + priv = loader->private; + + g_free (priv); + + if (G_OBJECT_CLASS (parent_class)->finalize) + G_OBJECT_CLASS (parent_class)->finalize (object); } static void -gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader) +gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - gdk_pixbuf_ref (pixbuf); - g_assert (priv->pixbuf == NULL); - - priv->pixbuf = pixbuf; - gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + gdk_pixbuf_ref (pixbuf); + + g_assert (priv->pixbuf == NULL); + + priv->pixbuf = pixbuf; + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]); } static void -gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, guint x, guint y, guint width, guint height, gpointer loader) +gdk_pixbuf_loader_update (GdkPixbuf *pixbuf, + guint x, + guint y, + guint width, + guint height, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[AREA_UPDATED], - x, y, - /* sanity check in here. Defend against an errant loader */ - MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), - MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + + gtk_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[AREA_UPDATED], + x, y, + /* sanity check in here. Defend against an errant loader */ + MIN (width, gdk_pixbuf_get_width (priv->pixbuf)), + MIN (height, gdk_pixbuf_get_height (priv->pixbuf))); } static void -gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) +gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - - priv = GDK_PIXBUF_LOADER (loader)->private; - - priv->pixbuf = NULL; - - if (priv->animation == NULL) { - priv->animation = GDK_PIXBUF_ANIMATION (g_type_create_instance (GDK_TYPE_PIXBUF_ANIMATION)); - - priv->animation->n_frames = 0; - priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - } else { - int w, h; - - /* update bbox size */ - w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - - if (w > priv->animation->width) { - priv->animation->width = w; - } - if (h > priv->animation->height) { - priv->animation->height = h; - } - } - - priv->animation->frames = g_list_append (priv->animation->frames, frame); - priv->animation->n_frames ++; - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[FRAME_DONE], - frame); + GdkPixbufLoaderPrivate *priv = NULL; + + priv = GDK_PIXBUF_LOADER (loader)->private; + + priv->pixbuf = NULL; + + if (priv->animation == NULL) + { + priv->animation = GDK_PIXBUF_ANIMATION (g_type_create_instance (GDK_TYPE_PIXBUF_ANIMATION)); + + priv->animation->n_frames = 0; + priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + } + else + { + int w, h; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + + if (w > priv->animation->width) { + priv->animation->width = w; + } + if (h > priv->animation->height) { + priv->animation->height = h; + } + } + + priv->animation->frames = g_list_append (priv->animation->frames, frame); + priv->animation->n_frames++; + gtk_signal_emit (GTK_OBJECT (loader), + pixbuf_loader_signals[FRAME_DONE], + frame); } static void -gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader) +gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, + gpointer loader) { - GdkPixbufLoaderPrivate *priv = NULL; - GdkPixbufFrame *frame; - GList *current = NULL; - gint h, w; - - priv = GDK_PIXBUF_LOADER (loader)->private; - priv->pixbuf = NULL; - - current = gdk_pixbuf_animation_get_frames (priv->animation); - - while (current) { - frame = (GdkPixbufFrame *) current->data; - - /* update bbox size */ - w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; - h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; - - if (w > priv->animation->width) { - priv->animation->width = w; - } - if (h > priv->animation->height) { - priv->animation->height = h; - } - current = current->next; - } - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[ANIMATION_DONE]); + GdkPixbufLoaderPrivate *priv = NULL; + GdkPixbufFrame *frame; + GList *current = NULL; + gint h, w; + + priv = GDK_PIXBUF_LOADER (loader)->private; + priv->pixbuf = NULL; + + current = gdk_pixbuf_animation_get_frames (priv->animation); + + while (current) + { + frame = (GdkPixbufFrame *) current->data; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + + if (w > priv->animation->width) + priv->animation->width = w; + if (h > priv->animation->height) + priv->animation->height = h; + current = current->next; + } + + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE]); } - - /** * gdk_pixbuf_loader_new: * @@ -342,66 +345,72 @@ gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader) GdkPixbufLoader * gdk_pixbuf_loader_new (void) { - return gtk_type_new (gdk_pixbuf_loader_get_type ()); + return g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL); } -static int -gdk_pixbuf_loader_load_module(GdkPixbufLoader *loader) +static gint +gdk_pixbuf_loader_load_module (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv = loader->private; - - priv->image_module = gdk_pixbuf_get_module (priv->header_buf, priv->header_buf_offset); - - if (priv->image_module == NULL) - return 0; - - if (priv->image_module->module == NULL) - gdk_pixbuf_load_module (priv->image_module); - - if (priv->image_module->module == NULL) - return 0; - - if ((priv->image_module->begin_load == NULL) || - (priv->image_module->stop_load == NULL) || - (priv->image_module->load_increment == NULL)) { - g_warning ("module %s does not support incremental loading.\n", - priv->image_module->module_name); - return 0; - } - - priv->context = (*priv->image_module->begin_load) (gdk_pixbuf_loader_prepare, - gdk_pixbuf_loader_update, - gdk_pixbuf_loader_frame_done, - gdk_pixbuf_loader_animation_done, - loader); - - if (priv->context == NULL) { - g_warning("Failed to begin progressive load"); - return 0; - } - - if( (* priv->image_module->load_increment) (priv->context, priv->header_buf, priv->header_buf_offset) ) - return priv->header_buf_offset; - - return 0; + GdkPixbufLoaderPrivate *priv = loader->private; + + priv->image_module = gdk_pixbuf_get_module (priv->header_buf, priv->header_buf_offset); + + if (priv->image_module == NULL) + return 0; + + if (priv->image_module->module == NULL) + gdk_pixbuf_load_module (priv->image_module); + + if (priv->image_module->module == NULL) + return 0; + + if ((priv->image_module->begin_load == NULL) || + (priv->image_module->stop_load == NULL) || + (priv->image_module->load_increment == NULL)) + { + g_warning (G_STRLOC ": module %s does not support incremental loading.\n", + priv->image_module->module_name); + return 0; + } + + priv->context = priv->image_module->begin_load (gdk_pixbuf_loader_prepare, + gdk_pixbuf_loader_update, + gdk_pixbuf_loader_frame_done, + gdk_pixbuf_loader_animation_done, + loader); + + if (priv->context == NULL) + { + g_warning (G_STRLOC ": Failed to begin progressive load"); + return 0; + } + + if (priv->image_module->load_increment (priv->context, priv->header_buf, priv->header_buf_offset)) + return priv->header_buf_offset; + + return 0; } static int -gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, const guchar *buf, size_t count) +gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count) { - int nbytes; - GdkPixbufLoaderPrivate *priv = loader->private; - - nbytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count); - memcpy (priv->header_buf + priv->header_buf_offset, buf, nbytes); - - priv->header_buf_offset += nbytes; - - if(priv->header_buf_offset >= LOADER_HEADER_SIZE) { - if (gdk_pixbuf_loader_load_module(loader) == 0) - return 0; - } - return nbytes; + gint n_bytes; + GdkPixbufLoaderPrivate *priv = loader->private; + + n_bytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count); + memcpy (priv->header_buf + priv->header_buf_offset, buf, n_bytes); + + priv->header_buf_offset += n_bytes; + + if (priv->header_buf_offset >= LOADER_HEADER_SIZE) + { + if (gdk_pixbuf_loader_load_module (loader) == 0) + return 0; + } + + return n_bytes; } /** @@ -419,36 +428,39 @@ gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, const guchar *buf, * cannot parse the buffer. **/ gboolean -gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, size_t count) +gdk_pixbuf_loader_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, FALSE); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE); - - g_return_val_if_fail (buf != NULL, FALSE); - g_return_val_if_fail (count >= 0, FALSE); - - priv = loader->private; - - /* we expect it's not to be closed */ - g_return_val_if_fail (priv->closed == FALSE, FALSE); - - if (priv->image_module == NULL) { - int eaten; - - eaten = gdk_pixbuf_loader_eat_header_write(loader, buf, count); - if (eaten <= 0) - return FALSE; - - count -= eaten; - buf += eaten; - } - - if (count > 0 && priv->image_module->load_increment) - return (* priv->image_module->load_increment) (priv->context, buf, count); - - return TRUE; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, FALSE); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE); + + g_return_val_if_fail (buf != NULL, FALSE); + g_return_val_if_fail (count >= 0, FALSE); + + priv = loader->private; + + /* we expect it's not to be closed */ + g_return_val_if_fail (priv->closed == FALSE, FALSE); + + if (priv->image_module == NULL) + { + gint eaten; + + eaten = gdk_pixbuf_loader_eat_header_write(loader, buf, count); + if (eaten <= 0) + return FALSE; + + count -= eaten; + buf += eaten; + } + + if (count > 0 && priv->image_module->load_increment) + return priv->image_module->load_increment (priv->context, buf, count); + + return TRUE; } /** @@ -469,14 +481,14 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, const guchar *buf, size_t coun GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, NULL); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); - - priv = loader->private; - - return priv->pixbuf; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, NULL); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); + + priv = loader->private; + + return priv->pixbuf; } /** @@ -490,18 +502,18 @@ gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader) * * Return value: The GdkPixbufAnimation that the loader is loading, or NULL if not enough data has been read to determine the information. - **/ +**/ GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_val_if_fail (loader != NULL, NULL); - g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); - - priv = loader->private; - - return priv->animation; + GdkPixbufLoaderPrivate *priv; + + g_return_val_if_fail (loader != NULL, NULL); + g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL); + + priv = loader->private; + + return priv->animation; } /** @@ -514,26 +526,24 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) void gdk_pixbuf_loader_close (GdkPixbufLoader *loader) { - GdkPixbufLoaderPrivate *priv; - - g_return_if_fail (loader != NULL); - g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader)); - - priv = loader->private; - - /* we expect it's not closed */ - g_return_if_fail (priv->closed == FALSE); - - /* We have less the 128 bytes in the image. Flush it, and keep going. */ - if (priv->image_module == NULL) - gdk_pixbuf_loader_load_module (loader); - - if (priv->image_module && priv->image_module->stop_load) - (* priv->image_module->stop_load) (priv->context); - - priv->closed = TRUE; - - gtk_signal_emit (GTK_OBJECT (loader), - pixbuf_loader_signals[CLOSED]); + GdkPixbufLoaderPrivate *priv; + + g_return_if_fail (loader != NULL); + g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader)); + + priv = loader->private; + + /* we expect it's not closed */ + g_return_if_fail (priv->closed == FALSE); + + /* We have less the 128 bytes in the image. Flush it, and keep going. */ + if (priv->image_module == NULL) + gdk_pixbuf_loader_load_module (loader); + + if (priv->image_module && priv->image_module->stop_load) + priv->image_module->stop_load (priv->context); + + priv->closed = TRUE; + + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[CLOSED]); } - diff --git a/gtk/gdk-pixbuf-loader.h b/gtk/gdk-pixbuf-loader.h index 9f9a79dc25..1b06ff74fb 100644 --- a/gtk/gdk-pixbuf-loader.h +++ b/gtk/gdk-pixbuf-loader.h @@ -26,7 +26,6 @@ #ifndef GDK_PIXBUF_LOADER_H #define GDK_PIXBUF_LOADER_H -#include <unistd.h> #include <gtk/gtkobject.h> #include <gdk-pixbuf/gdk-pixbuf.h> @@ -34,52 +33,52 @@ extern "C" { #endif - + #define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ()) #define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader)) #define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) #define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER)) #define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER)) +#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass)) typedef struct _GdkPixbufLoader GdkPixbufLoader; struct _GdkPixbufLoader { - GtkObject object; - - /* < Private > */ - gpointer private; + GtkObject object; + + /*< private >*/ + gpointer private; }; typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass; -struct _GdkPixbufLoaderClass { - GtkObjectClass parent_class; - - void (* area_prepared) (GdkPixbufLoader *loader); - - void (* area_updated) (GdkPixbufLoader *loader, - guint x, guint y, guint width, guint height); - - void (* frame_done) (GdkPixbufLoader *loader, GdkPixbufFrame *frame); - - void (* animation_done) (GdkPixbufLoader *loader); - - void (* closed) (GdkPixbufLoader *loader); +struct _GdkPixbufLoaderClass +{ + GtkObjectClass parent_class; + + void (*area_prepared) (GdkPixbufLoader *loader); + void (*area_updated) (GdkPixbufLoader *loader, + guint x, + guint y, + guint width, + guint height); + void (*frame_done) (GdkPixbufLoader *loader, + GdkPixbufFrame *frame); + void (*animation_done) (GdkPixbufLoader *loader); + void (*closed) (GdkPixbufLoader *loader); }; - -GtkType gdk_pixbuf_loader_get_type (void); -GdkPixbufLoader *gdk_pixbuf_loader_new (void); -gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, - const guchar *buf, - size_t count); -GdkPixbuf *gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader); -GdkPixbufAnimation *gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader); -void gdk_pixbuf_loader_close (GdkPixbufLoader *loader); +GtkType gdk_pixbuf_loader_get_type (void); +GdkPixbufLoader * gdk_pixbuf_loader_new (void); +gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader, + const guchar *buf, + gsize count); +GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader); +GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader); +void gdk_pixbuf_loader_close (GdkPixbufLoader *loader); - #ifdef __cplusplus } diff --git a/gtk/gtkfeatures.h.in b/gtk/gtkfeatures.h.in deleted file mode 100644 index 9fee280166..0000000000 --- a/gtk/gtkfeatures.h.in +++ /dev/null @@ -1,123 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __GTK_FEATURES_H__ -#define __GTK_FEATURES_H__ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/* compile time version - */ -#define GTK_MAJOR_VERSION (@GTK_MAJOR_VERSION@) -#define GTK_MINOR_VERSION (@GTK_MINOR_VERSION@) -#define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@) -#define GTK_BINARY_AGE (@GTK_BINARY_AGE@) -#define GTK_INTERFACE_AGE (@GTK_INTERFACE_AGE@) -#define GTK_CHECK_VERSION(major,minor,micro) \ - (GTK_MAJOR_VERSION > (major) || \ - (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION > (minor)) || \ - (GTK_MAJOR_VERSION == (major) && GTK_MINOR_VERSION == (minor) && \ - GTK_MICRO_VERSION >= (micro))) - - -/* new gtk_container_set_focus_[hv]adjustment() - */ -#define GTK_HAVE_CONTAINER_FOCUS_ADJUSTMENTS 1-0-1 - -/* newly exported gtk_signal_init() - * new gtk_signal_n_emissions*() - * "signal-name" is now an alias for "signal_name" - * new gtk_signal_emitv*() - */ -#define GTK_HAVE_SIGNAL_INIT 1-0-2 - -/* Gtk+ 1.1.0 version tag. - * - new gtk_rc_set_image_loader () to install custom image loaders for rc - * files. - * - GtkAccel groups replaced GtkAcceleratorTables - * - Gdk supports full crossing event now. - * - Buttons featur relief styles now. - * - gdk_rgb_*() functions are in place. - * - stringified enum values can be queried for enum types now. - * - new key binding system is in place (GtkBindingSet). - * - simple algorithm for pattern matching is exported now (GtkPatternSpec). - */ -#define GTK_HAVE_FEATURES_1_1_0 1-1-0 - -/* Gtk+ 1.1.2 version tag - * - ctree function name changes - */ -#define GTK_HAVE_FEATURES_1_1_2 1-1-2 - -/* Gtk+ 1.1.4 version tag - * - clist v/hscrollbar -> v/hadjustment changes - */ -#define GTK_HAVE_FEATURES_1_1_4 1-1-4 - -/* Gtk+ 1.1.5 version tag - */ -#define GTK_HAVE_FEATURES_1_1_5 1-1-5 - -/* Gtk+ 1.1.6 version tag - */ -#define GTK_HAVE_FEATURES_1_1_6 1-1-6 - -/* Gtk+ 1.1.7 version tag - */ -#define GTK_HAVE_FEATURES_1_1_7 1-1-7 - -/* Gtk+ 1.1.8 version tag - */ -#define GTK_HAVE_FEATURES_1_1_8 1-1-8 - -/* Gtk+ 1.1.9 version tag - */ -#define GTK_HAVE_FEATURES_1_1_9 1-1-9 - -/* Gtk+ 1.1.10 version tag - */ -#define GTK_HAVE_FEATURES_1_1_10 1-1-10 - -/* Gtk+ 1.1.11 version tag - */ -#define GTK_HAVE_FEATURES_1_1_11 1-1-11 - -/* Gtk+ 1.1.12 version tag - */ -#define GTK_HAVE_FEATURES_1_1_12 1-1-12 - -/* Gtk+ 1.1.13 version tag - * gtk_toggle_button_set_state name changes - */ -#define GTK_HAVE_FEATURES_1_1_13 1-1-13 - -/* Gtk+ 1.1.14 version tag - * working gtk layout, etc - */ -#define GTK_HAVE_FEATURES_1_1_14 1-1-14 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GTK_FEATURES_H__ */ diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c index b4cb223a34..d971387c71 100644 --- a/gtk/gtktypeutils.c +++ b/gtk/gtktypeutils.c @@ -120,15 +120,6 @@ gtk_type_init (void) GtkType type_id; gchar *name; } fundamental_info[] = { - { GTK_TYPE_CHAR, "gchar" }, - { GTK_TYPE_UCHAR, "guchar" }, - { GTK_TYPE_BOOL, "gboolean" }, - { GTK_TYPE_INT, "gint" }, - { GTK_TYPE_UINT, "guint" }, - { GTK_TYPE_LONG, "glong" }, - { GTK_TYPE_ULONG, "gulong" }, - { GTK_TYPE_FLOAT, "gfloat" }, - { GTK_TYPE_DOUBLE, "gdouble" }, { GTK_TYPE_POINTER, "gpointer" }, { GTK_TYPE_SIGNAL, "GtkSignal" }, }; @@ -162,22 +153,19 @@ gtk_type_init (void) { type_id = g_type_register_fundamental (fundamental_info[i].type_id, fundamental_info[i].name, - &finfo, - &tinfo); + &tinfo, + &finfo); g_assert (type_id == fundamental_info[i].type_id); } - /* GTK_TYPE_STRING & GTK_TYPE_IDENTIFIER + /* GTK_TYPE_IDENTIFIER */ - finfo.type_flags = G_TYPE_FLAG_DERIVABLE; - type_id = g_type_register_fundamental (GTK_TYPE_STRING, "GtkString", &finfo, &tinfo); - g_assert (type_id == GTK_TYPE_STRING); - GTK_TYPE_IDENTIFIER = g_type_register_static (GTK_TYPE_STRING, "GtkIdentifier", &tinfo); + GTK_TYPE_IDENTIFIER = g_type_register_static (G_TYPE_STRING, "GtkIdentifier", &tinfo); /* GTK_TYPE_BOXED */ finfo.type_flags = G_TYPE_FLAG_DERIVABLE; - type_id = g_type_register_fundamental (GTK_TYPE_BOXED, "GtkBoxed", &finfo, &tinfo); + type_id = g_type_register_fundamental (GTK_TYPE_BOXED, "GtkBoxed", &tinfo, &finfo); g_assert (type_id == GTK_TYPE_BOXED); /* enums and flags diff --git a/gtk/gtktypeutils.h b/gtk/gtktypeutils.h index 79f805e6e1..bb84258deb 100644 --- a/gtk/gtktypeutils.h +++ b/gtk/gtktypeutils.h @@ -48,16 +48,16 @@ typedef enum /*< skip >*/ GTK_TYPE_FLAGS = G_TYPE_FLAGS, /* GtkArg types */ - GTK_TYPE_CHAR = G_TYPE_GTK_CHAR, - GTK_TYPE_UCHAR = G_TYPE_GTK_UCHAR, - GTK_TYPE_BOOL = G_TYPE_GTK_BOOL, - GTK_TYPE_INT = G_TYPE_GTK_INT, - GTK_TYPE_UINT = G_TYPE_GTK_UINT, - GTK_TYPE_LONG = G_TYPE_GTK_LONG, - GTK_TYPE_ULONG = G_TYPE_GTK_ULONG, - GTK_TYPE_FLOAT = G_TYPE_GTK_FLOAT, - GTK_TYPE_DOUBLE = G_TYPE_GTK_DOUBLE, - GTK_TYPE_STRING = G_TYPE_GTK_STRING, + GTK_TYPE_CHAR = G_TYPE_CHAR, + GTK_TYPE_UCHAR = G_TYPE_UCHAR, + GTK_TYPE_BOOL = G_TYPE_BOOLEAN, + GTK_TYPE_INT = G_TYPE_INT, + GTK_TYPE_UINT = G_TYPE_UINT, + GTK_TYPE_LONG = G_TYPE_LONG, + GTK_TYPE_ULONG = G_TYPE_ULONG, + GTK_TYPE_FLOAT = G_TYPE_FLOAT, + GTK_TYPE_DOUBLE = G_TYPE_DOUBLE, + GTK_TYPE_STRING = G_TYPE_STRING, GTK_TYPE_BOXED = G_TYPE_GTK_BOXED, GTK_TYPE_POINTER = G_TYPE_GTK_POINTER, GTK_TYPE_SIGNAL = G_TYPE_GTK_SIGNAL diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 5088f705d3..4c8fd24e5a 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -8678,6 +8678,16 @@ main (int argc, char *argv[]) create_main_window (); gtk_main (); + + if (0) + { + sleep (1); + while (g_main_pending ()) + g_main_iteration (FALSE); + sleep (1); + while (g_main_pending ()) + g_main_iteration (FALSE); + } return 0; } diff --git a/tests/testgtk.c b/tests/testgtk.c index 5088f705d3..4c8fd24e5a 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -8678,6 +8678,16 @@ main (int argc, char *argv[]) create_main_window (); gtk_main (); + + if (0) + { + sleep (1); + while (g_main_pending ()) + g_main_iteration (FALSE); + sleep (1); + while (g_main_pending ()) + g_main_iteration (FALSE); + } return 0; } |