From 2e8e686caec9b31b5b1aa72b8a642c4b883f0f14 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 1 Jul 1998 19:36:53 +0000 Subject: [PATCH] temporary implementation of action signal "debug_msg" Wed Jul 1 20:58:46 1998 Tim Janik * gtk/gtkwidget.h: * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one error that prevented signal to entry addition for signals with parameters. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtkaccelgroup.c | 16 ++++++++-------- gtk/gtkbindings.c | 6 +++--- gtk/gtkbindings.h | 6 ++++-- gtk/gtkitemfactory.c | 6 ++++-- gtk/gtkwidget.c | 27 ++++++++++++++++++++++++--- gtk/gtkwidget.h | 4 ++++ 13 files changed, 110 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 618f4fe52f..3256608648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 618f4fe52f..3256608648 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Wed Jul 1 20:58:46 1998 Tim Janik + + * gtk/gtkwidget.h: + * gtk/gtkwidget.c: temporary implementation of action signal "debug_msg" + + * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixed an off-by-one + error that prevented signal to entry addition for signals with + parameters. + Wed Jul 1 10:05:36 PDT 1998 Manish Singh * ltconfig: fix for properly detecting shared lib support on diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c index c8c3e908f4..9a65f07318 100644 --- a/gtk/gtkaccelgroup.c +++ b/gtk/gtkaccelgroup.c @@ -965,9 +965,9 @@ gchar* gtk_accelerator_name (guint accelerator_key, GdkModifierType accelerator_mods) { + static const gchar text_release[] = ""; static const gchar text_shift[] = ""; static const gchar text_control[] = ""; - static const gchar text_release[] = ""; static const gchar text_mod1[] = ""; static const gchar text_mod2[] = ""; static const gchar text_mod3[] = ""; @@ -984,12 +984,12 @@ gtk_accelerator_name (guint accelerator_key, keyval_name = ""; l = 0; + if (accelerator_mods & GDK_RELEASE_MASK) + l += sizeof (text_release) - 1; if (accelerator_mods & GDK_SHIFT_MASK) l += sizeof (text_shift) - 1; if (accelerator_mods & GDK_CONTROL_MASK) l += sizeof (text_control) - 1; - if (accelerator_mods & GDK_RELEASE_MASK) - l += sizeof (text_release) - 1; if (accelerator_mods & GDK_MOD1_MASK) l += sizeof (text_mod1) - 1; if (accelerator_mods & GDK_MOD2_MASK) @@ -1006,6 +1006,11 @@ gtk_accelerator_name (guint accelerator_key, l = 0; accelerator[l] = 0; + if (accelerator_mods & GDK_RELEASE_MASK) + { + strcpy (accelerator + l, text_release); + l += sizeof (text_release) - 1; + } if (accelerator_mods & GDK_SHIFT_MASK) { strcpy (accelerator + l, text_shift); @@ -1016,11 +1021,6 @@ gtk_accelerator_name (guint accelerator_key, strcpy (accelerator + l, text_control); l += sizeof (text_control) - 1; } - if (accelerator_mods & GDK_RELEASE_MASK) - { - strcpy (accelerator + l, text_release); - l += sizeof (text_release) - 1; - } if (accelerator_mods & GDK_MOD1_MASK) { strcpy (accelerator + l, text_mod1); diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c index 8c17c9f5df..49a0dbacb7 100644 --- a/gtk/gtkbindings.c +++ b/gtk/gtkbindings.c @@ -647,19 +647,19 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set, if (!arg->d.string_data) { g_warning ("gtk_binding_entry_add_signal(): value of `string' arg[%u] is `NULL'", i); - i = n_args + 2; + i += n_args + 1; } break; default: g_warning ("gtk_binding_entry_add_signal(): unsupported type `%s' for arg[%u]", gtk_type_name (arg->arg_type), i); - i = n_args + 2; + i += n_args + 1; break; } } va_end (args); - if (i == n_args + 1 || i == 0) + if (i == n_args || i == 0) { slist = g_slist_reverse (slist); gtk_binding_entry_add_signall (binding_set, keyval, modifiers, signal_name, slist); diff --git a/gtk/gtkbindings.h b/gtk/gtkbindings.h index d9ed4033d8..5252299a85 100644 --- a/gtk/gtkbindings.h +++ b/gtk/gtkbindings.h @@ -61,15 +61,17 @@ gboolean gtk_pattern_match_simple (const gchar *pattern, const gchar *string); -/* Binding sets +/* type arguments for internal use only */ - #define GTK_BINDING_ARG_INT (GTK_TYPE_INT) #define GTK_BINDING_ARG_LONG (GTK_TYPE_LONG) #define GTK_BINDING_ARG_FLOAT (GTK_TYPE_FLOAT) #define GTK_BINDING_ARG_DOUBLE (GTK_TYPE_DOUBLE) #define GTK_BINDING_ARG_STRING (GTK_TYPE_STRING) +/* Binding sets + */ + typedef struct _GtkBindingSet GtkBindingSet; typedef struct _GtkBindingEntry GtkBindingEntry; typedef struct _GtkBindingSignal GtkBindingSignal; diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c index 76b9454d20..43d9888345 100644 --- a/gtk/gtkitemfactory.c +++ b/gtk/gtkitemfactory.c @@ -579,10 +579,12 @@ gtk_item_factory_construct (GtkItemFactory *ifactory, NULL); gtk_object_ref (GTK_OBJECT (ifactory)); gtk_object_sink (GTK_OBJECT (ifactory)); - gtk_signal_connect_object_while_alive (GTK_OBJECT (ifactory->widget), + /* + gtk_signal_connect_object_while_alive (GTK_OBJECT (ifactory->widget), "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_SIGNAL_FUNC (gtk_object_destroy), GTK_OBJECT (ifactory)); + */ gtk_item_factory_add_item (ifactory, "", NULL, NULL, 0, NULL, 0, diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 18404fb319..680dabac18 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -85,6 +85,7 @@ enum { CLIENT_EVENT, NO_EXPOSE_EVENT, VISIBILITY_NOTIFY_EVENT, + DEBUG_MSG, LAST_SIGNAL }; @@ -286,6 +287,13 @@ gtk_widget_get_type (void) * * results: *****************************************/ +#include "stdio.h" +static void +gtk_widget_debug_msg (GtkWidget *widget, + const gchar *string) +{ + fprintf (stderr, "Gtk-DEBUG: %s\n", string); +} static void gtk_widget_class_init (GtkWidgetClass *klass) @@ -687,6 +695,14 @@ gtk_widget_class_init (GtkWidgetClass *klass) gtk_widget_marshal_signal_4, GTK_TYPE_BOOL, 1, GTK_TYPE_GDK_EVENT); + widget_signals[DEBUG_MSG] = + gtk_signal_new ("debug_msg", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkWidgetClass, debug_msg), + gtk_widget_marshal_signal_1, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); gtk_object_class_add_signals (object_class, widget_signals, LAST_SIGNAL); @@ -742,8 +758,10 @@ gtk_widget_class_init (GtkWidgetClass *klass) klass->drop_enter_event = NULL; klass->drop_leave_event = NULL; klass->drop_data_available_event = NULL; - klass->other_event = NULL; klass->no_expose_event = NULL; + klass->other_event = NULL; + + klass->debug_msg = gtk_widget_debug_msg; /* bindings test */ @@ -751,8 +769,11 @@ gtk_widget_class_init (GtkWidgetClass *klass) GtkBindingSet *binding_set; binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK|GDK_RELEASE_MASK, "hide", 0); - gtk_binding_entry_add_signal (binding_set, '9', GDK_CONTROL_MASK|GDK_RELEASE_MASK, "show", 0); + gtk_binding_entry_add_signal (binding_set, + '9', GDK_CONTROL_MASK | GDK_RELEASE_MASK, + "debug_msg", + 1, + GTK_TYPE_STRING, "GtkWidgetClass test"); } } diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 9f75a4b1cd..420b3f38ee 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -337,6 +337,10 @@ struct _GtkWidgetClass /* selection */ void (* selection_received) (GtkWidget *widget, GtkSelectionData *selection_data); + + /* action signals */ + void (* debug_msg) (GtkWidget *widget, + const gchar *string); }; struct _GtkWidgetAuxInfo