diff --git a/ChangeLog b/ChangeLog index 46d3af25b3..302469e13c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 46d3af25b3..302469e13c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +Sat May 9 02:34:41 1998 Tim Janik + + * gtk/gtkfeatures.h.in: new file used as template for + * gtk/gtkfeatures.h: new file to define macros indicating newly + introduced features, such as GTK_HAVE_SIGNAL_INIT. + + * gtk/gtksignal.c: + (gtk_signal_emitv_by_name): + (gtk_signal_emitv): + new functions to emit signals with an already provided parameter set. + (provided by Kenneth Albanowski ). + (gtk_signal_real_emit): prototype changes, so this functions always + gets its parameters and signal structure as arguments. + (gtk_signal_emit): provide the signal structure and parameter list for + gtk_signal_real_emit. + (gtk_signal_emit_by_name): likewise. + Sat May 9 00:03:12 1998 Tim Janik * gtk/gtksignal.c (gtk_signal_handler_unref): reflect the presence of diff --git a/acconfig.h b/acconfig.h index 703d7a3af1..600655efb2 100644 --- a/acconfig.h +++ b/acconfig.h @@ -21,6 +21,10 @@ #undef HAVE_SHAPE_EXT #undef HAVE_SYS_SELECT_H +/* some systems do not allow to ipcrm pages prior to + * actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6, + * IRIX 5.2 and 6.2. + */ #undef IPC_RMID_DEFERRED_RELEASE #undef NO_FD_SET @@ -31,11 +35,6 @@ #undef XINPUT_GXI #undef XINPUT_XFREE -#undef GTK_MAJOR_VERSION -#undef GTK_MINOR_VERSION -#undef GTK_MICRO_VERSION -#undef GTK_VERSION - /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE diff --git a/configure.in b/configure.in index 30dabb4d5f..f12208d22e 100644 --- a/configure.in +++ b/configure.in @@ -18,6 +18,9 @@ GTK_MICRO_VERSION=0 GTK_INTERFACE_AGE=0 GTK_BINARY_AGE=0 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION +AC_SUBST(GTK_MAJOR_VERSION) +AC_SUBST(GTK_MINOR_VERSION) +AC_SUBST(GTK_MICRO_VERSION) AC_SUBST(GTK_VERSION) # libtool versioning @@ -106,11 +109,6 @@ if test "x$enable_xim" = "xyes"; then CFLAGS="$CFLAGS -DUSE_XIM" fi -AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION) -AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION) -AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION) -AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION") - # Find the X11 include and library directories AC_PATH_X AC_PATH_XTRA @@ -296,5 +294,11 @@ if test $gtk_ok = no; then AC_DEFINE(NO_FD_SET) fi -AC_OUTPUT([Makefile gtk-config docs/Makefile gdk/Makefile gtk/Makefile], - [chmod +x gtk-config]) +AC_OUTPUT([ +Makefile +gtk-config +docs/Makefile +gdk/Makefile +gtk/Makefile +gtk/gtkfeatures.h +], [chmod +x gtk-config]) diff --git a/gtk/Makefile.am b/gtk/Makefile.am index a992e4d797..49842504a1 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -124,6 +124,7 @@ gtkinclude_HEADERS = \ gtkentry.h \ gtkenums.h \ gtkeventbox.h \ + gtkfeatures.h \ gtkfilesel.h \ gtkfixed.h \ gtkframe.h \ @@ -207,6 +208,7 @@ EXTRA_DIST = \ testgtkrc \ testgtkrc2 \ gtk.defs \ + gtkfeatures.h.in \ runelisp \ gentypeinfo.el \ gtktypebuiltins.c \ diff --git a/gtk/gtk.h b/gtk/gtk.h index 5f31c9c5ef..b2952e0485 100644 --- a/gtk/gtk.h +++ b/gtk/gtk.h @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/gtk/gtkfeatures.h b/gtk/gtkfeatures.h new file mode 100644 index 0000000000..deddc93c2d --- /dev/null +++ b/gtk/gtkfeatures.h @@ -0,0 +1,58 @@ +/* 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" { +#pragma } +#endif /* __cplusplus */ + +/* compile time version + */ +#define GTK_MAJOR_VERSION (1) +#define GTK_MINOR_VERSION (1) +#define GTK_MICRO_VERSION (0) + +/* new functions gtk_container_set_focus_vadjustment() and + * gtk_container_set_focus_hadjustment(). + */ +#define GTK_HAVE_CONTAINER_FOCUS_ADJUSTMENTS 1-0-1 + +/* from now on we export the gtk_signal_init() function + */ +#define GTK_HAVE_SIGNAL_INIT 1-1-0 + +/* we have a new gtk_signal_emitv*() interface + */ +#define GTK_HAVE_SIGNAL_EMITV 1-1-0 + +/* "signal-name" is now an alias for "signal_name" + */ +#define GTK_HAVE_SIGNAL_LISP_SYNTAX 1-1-0 + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_FEATURES_H__ */ diff --git a/gtk/gtkfeatures.h.in b/gtk/gtkfeatures.h.in new file mode 100644 index 0000000000..684b6aa9de --- /dev/null +++ b/gtk/gtkfeatures.h.in @@ -0,0 +1,58 @@ +/* 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" { +#pragma } +#endif /* __cplusplus */ + +/* compile time version + */ +#define GTK_MAJOR_VERSION (@GTK_MAJOR_VERSION@) +#define GTK_MINOR_VERSION (@GTK_MAJOR_VERSION@) +#define GTK_MICRO_VERSION (@GTK_MICRO_VERSION@) + +/* new functions gtk_container_set_focus_vadjustment() and + * gtk_container_set_focus_hadjustment(). + */ +#define GTK_HAVE_CONTAINER_FOCUS_ADJUSTMENTS 1-0-1 + +/* from now on we export the gtk_signal_init() function + */ +#define GTK_HAVE_SIGNAL_INIT 1-1-0 + +/* we have a new gtk_signal_emitv*() interface + */ +#define GTK_HAVE_SIGNAL_EMITV 1-1-0 + +/* "signal-name" is now an alias for "signal_name" + */ +#define GTK_HAVE_SIGNAL_LISP_SYNTAX 1-1-0 + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_FEATURES_H__ */ diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 5be05a5ec7..d2462787d9 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -21,6 +21,7 @@ #include #include #include "gtkbutton.h" +#include "gtkfeatures.h" #include "gtkhscrollbar.h" #include "gtkhseparator.h" #include "gtkmain.h" diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c index 1df6092e44..2a84d138e7 100644 --- a/gtk/gtksignal.c +++ b/gtk/gtksignal.c @@ -24,7 +24,7 @@ #define HANDLER_BLOCK_SIZE (200) #define EMISSION_BLOCK_SIZE (100) #define DISCONNECT_INFO_BLOCK_SIZE (64) -#define GTK_MAX_SIGNAL_PARAMS (32) +#define MAX_SIGNAL_PARAMS (32) enum { @@ -127,8 +127,8 @@ static void gtk_signal_handler_unref (GtkHandler *handler, static void gtk_signal_handler_insert (GtkObject *object, GtkHandler *handler); static void gtk_signal_real_emit (GtkObject *object, - guint signal_type, - va_list args); + GtkSignal *signal, + GtkArg *params); static GtkHandler* gtk_signal_get_handlers (GtkObject *object, guint signal_type); static guint gtk_signal_connect_by_type (GtkObject *object, @@ -274,7 +274,7 @@ gtk_signal_newv (const gchar *r_name, g_return_val_if_fail (r_name != NULL, 0); g_return_val_if_fail (marshaller != NULL, 0); - g_return_val_if_fail (nparams <= GTK_MAX_SIGNAL_PARAMS, 0); + g_return_val_if_fail (nparams <= MAX_SIGNAL_PARAMS, 0); if (nparams) g_return_val_if_fail (params != NULL, 0); @@ -355,7 +355,7 @@ gtk_signal_new (const gchar *name, va_list args; guint signal_id; - g_return_val_if_fail (nparams <= GTK_MAX_SIGNAL_PARAMS, 0); + g_return_val_if_fail (nparams <= MAX_SIGNAL_PARAMS, 0); if (nparams > 0) { @@ -456,21 +456,80 @@ gtk_signal_name (guint signal_id) return NULL; } +void +gtk_signal_emitv (GtkObject *object, + guint signal_id, + GtkArg *params) +{ + GtkSignal *signal; + + g_return_if_fail (object != NULL); + g_return_if_fail (signal_id >= 1); + g_return_if_fail (params != NULL); + + signal = LOOKUP_SIGNAL_ID (signal_id); + g_return_if_fail (signal != NULL); + g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type)); + + gtk_signal_real_emit (object, signal, params); +} + void gtk_signal_emit (GtkObject *object, - guint signal_id, + guint signal_id, ...) { - va_list args; - + GtkSignal *signal; + va_list args; + GtkArg params[MAX_SIGNAL_PARAMS]; + g_return_if_fail (object != NULL); g_return_if_fail (signal_id >= 1); + signal = LOOKUP_SIGNAL_ID (signal_id); + g_return_if_fail (signal != NULL); + g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type)); + va_start (args, signal_id); - - gtk_signal_real_emit (object, signal_id, args); - + gtk_params_get (params, + signal->nparams, + signal->params, + signal->return_val, + args); va_end (args); + + gtk_signal_real_emit (object, signal, params); +} + +void +gtk_signal_emitv_by_name (GtkObject *object, + const gchar *name, + GtkArg *params) +{ + guint signal_id; + + g_return_if_fail (object != NULL); + g_return_if_fail (name != NULL); + g_return_if_fail (params != NULL); + + signal_id = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object)); + + if (signal_id >= 1) + { + GtkSignal *signal; + + signal = LOOKUP_SIGNAL_ID (signal_id); + g_return_if_fail (signal != NULL); + g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type)); + + gtk_signal_real_emit (object, signal, params); + } + else + { + g_warning ("gtk_signal_emitv_by_name(): could not find signal \"%s\" in the `%s' class ancestry", + name, + gtk_type_name (GTK_OBJECT_TYPE (object))); + } } void @@ -479,7 +538,6 @@ gtk_signal_emit_by_name (GtkObject *object, ...) { guint signal_id; - va_list args; g_return_if_fail (object != NULL); g_return_if_fail (name != NULL); @@ -488,11 +546,23 @@ gtk_signal_emit_by_name (GtkObject *object, if (signal_id >= 1) { + GtkSignal *signal; + GtkArg params[MAX_SIGNAL_PARAMS]; + va_list args; + + signal = LOOKUP_SIGNAL_ID (signal_id); + g_return_if_fail (signal != NULL); + g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type)); + va_start (args, name); - - gtk_signal_real_emit (object, signal_id, args); - + gtk_params_get (params, + signal->nparams, + signal->params, + signal->return_val, + args); va_end (args); + + gtk_signal_real_emit (object, signal, params); } else { @@ -1263,18 +1333,13 @@ gtk_signal_handler_insert (GtkObject *object, static void gtk_signal_real_emit (GtkObject *object, - guint signal_id, - va_list args) + GtkSignal *signal, + GtkArg *params) { - GtkSignal *signal; GtkHandler *handlers; GtkHandlerInfo info; guchar **signal_func_offset; - GtkArg params[GTK_MAX_SIGNAL_PARAMS]; - - signal = LOOKUP_SIGNAL_ID (signal_id); - g_return_if_fail (signal != NULL); - g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object), signal->object_type)); + register guint signal_id = signal->signal_id; if ((signal->run_type & GTK_RUN_NO_RECURSE) && gtk_emission_check (current_emissions, object, signal_id)) @@ -1283,12 +1348,9 @@ gtk_signal_real_emit (GtkObject *object, return; } - gtk_params_get (params, signal->nparams, signal->params, - signal->return_val, args); - - gtk_emission_add (¤t_emissions, object, signal_id); - gtk_object_ref (object); + + gtk_emission_add (¤t_emissions, object, signal_id); emission_restart: if (GTK_RUN_TYPE (signal->run_type) != GTK_RUN_LAST && signal->function_offset != 0) diff --git a/gtk/gtksignal.h b/gtk/gtksignal.h index 293c0d6dd2..0d66bb8f9b 100644 --- a/gtk/gtksignal.h +++ b/gtk/gtksignal.h @@ -86,6 +86,12 @@ void gtk_signal_emit (GtkObject *object, void gtk_signal_emit_by_name (GtkObject *object, const gchar *name, ...); +void gtk_signal_emitv (GtkObject *object, + guint signal_id, + GtkArg *params); +void gtk_signal_emitv_by_name (GtkObject *object, + const gchar *name, + GtkArg *params); guint gtk_signal_n_emissions (GtkObject *object, guint signal_id); guint gtk_signal_n_emissions_by_name (GtkObject *object,