Re: Propagation of key press events



There was an error in previous patch; corrected patch attached.

Padraig

> 
> Patch to shiw_help signal to allow propagation of Ctrl+F1 key to parent if 
> widget does not have tooltip.
> 
> OK to commit?
> 
> Padraig
>  
> > To: "Padraig O'Briain" <Padraig Obriain Sun COM>
> > Cc: gtk-devel-list gnome org
> > Subject: Re: Propagation of key press events
> > User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/21.1
> > MIME-Version: 1.0
> > 
> > 
> > "Padraig O'Briain" <Padraig Obriain Sun COM> writes:
> > 
> > > > To: "Padraig O'Briain" <Padraig Obriain Sun COM>
> > > > Cc: gtk-devel-list gnome org
> > > > Subject: Re: Propagation of key press events
> > > > User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/21.1
> > > > MIME-Version: 1.0
> > > > 
> > > > 
> > > > "Padraig O'Briain" <Padraig Obriain Sun COM> writes:
> > > > 
> > > > > I am trying to figure out how to get Shift+F10 to display an applet's 
> > > context 
> > > > > menu even if focus is in a widget within the applet rather the applet 
> > > itself.
> > > > > 
> > > > > This does not work as the signal handler for the popup_menu signal 
> returns 
> > > void. 
> > > > > Is it reasonable to ask that ihe signal handler return a gboolean so 
> that 
> > > the 
> > > > > keypress can be propagated up to the applet?
> > > > 
> > > > Yes, I think it would be fine to make this change.
> > > > 
> > > 
> > > I am working on the patch.
> > > 
> > > Could I make a similar change to show_help signal handler?
> > 
> > Yes, this should be fine too.
> >                                         Owen
Index: gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.294
diff -u -p -r1.294 gtkwidget.c
--- gtkwidget.c	2002/02/07 09:39:21	1.294
+++ gtkwidget.c	2002/02/07 15:01:28
@@ -179,7 +179,7 @@ static void	gtk_widget_direction_changed
 						  GtkTextDirection   previous_direction);
 
 static void	gtk_widget_real_grab_focus	 (GtkWidget         *focus_widget);
-static void     gtk_widget_real_show_help        (GtkWidget         *widget,
+static gboolean gtk_widget_real_show_help        (GtkWidget         *widget,
                                                   GtkWidgetHelpType  help_type);
 
 static void	gtk_widget_dispatch_child_properties_changed	(GtkWidget        *object,
@@ -1010,12 +1010,13 @@ gtk_widget_class_init (GtkWidgetClass *k
                   _gtk_marshal_BOOLEAN__VOID,
 		  G_TYPE_BOOLEAN, 0);
   widget_signals[SHOW_HELP] =
-    gtk_signal_new ("show_help",
-		    GTK_RUN_LAST | GTK_RUN_ACTION,
-		    GTK_CLASS_TYPE (object_class),
-		    GTK_SIGNAL_OFFSET (GtkWidgetClass, show_help),
-                    _gtk_marshal_NONE__ENUM,
-		    GTK_TYPE_NONE, 1, GTK_TYPE_WIDGET_HELP_TYPE);
+    g_signal_new ("show_help",
+		  G_TYPE_FROM_CLASS (object_class),
+		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+		  GTK_SIGNAL_OFFSET (GtkWidgetClass, show_help),
+		  _gtk_boolean_handled_accumulator, NULL,
+                  _gtk_marshal_BOOLEAN__ENUM,
+		  G_TYPE_BOOLEAN, 1, GTK_TYPE_WIDGET_HELP_TYPE);
   widget_signals[ACCEL_CLOSURES_CHANGED] =
     gtk_signal_new ("accel_closures_changed",
 		    0,
@@ -3394,12 +3395,14 @@ gtk_widget_real_grab_focus (GtkWidget *f
     }
 }
 
-static void
+static gboolean
 gtk_widget_real_show_help (GtkWidget        *widget,
                            GtkWidgetHelpType help_type)
 {
   if (help_type == GTK_WIDGET_HELP_TOOLTIP)
-    _gtk_tooltips_show_tip (widget);
+     return _gtk_tooltips_show_tip (widget);
+  else
+     return FALSE;
 }
 
 static gboolean
Index: gtkwidget.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.h,v
retrieving revision 1.130
diff -u -p -r1.130 gtkwidget.h
--- gtkwidget.h	2002/02/07 09:39:21	1.130
+++ gtkwidget.h	2002/02/07 15:01:31
@@ -394,7 +394,7 @@ struct _GtkWidgetClass
    * sense, should cycle through them showing each tip alongside
    * whatever piece of the widget it applies to.
    */
-  void (* show_help)               (GtkWidget          *widget,
+  gboolean (* show_help)           (GtkWidget          *widget,
                                     GtkWidgetHelpType   help_type);
   
   /* accessibility support 
Index: gtktooltips.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktooltips.c,v
retrieving revision 1.44
diff -u -p -r1.44 gtktooltips.c
--- gtktooltips.c	2002/02/02 04:34:09	1.44
+++ gtktooltips.c	2002/02/07 15:01:32
@@ -537,7 +537,7 @@ gtk_tooltips_widget_remove (GtkWidget *w
   gtk_tooltips_destroy_data (tooltipsdata);
 }
 
-void
+gboolean
 _gtk_tooltips_show_tip (GtkWidget *widget)
 {
   /* Showing the tip from the keyboard */
@@ -551,10 +551,11 @@ _gtk_tooltips_show_tip (GtkWidget *widge
   tooltipsdata = gtk_tooltips_data_get (widget);
 
   if (tooltipsdata == NULL)
-    return;
+    return FALSE;
 
   gtk_tooltips_set_active_widget (tooltipsdata->tooltips,
                                   widget);
 
   gtk_tooltips_timeout (tooltipsdata->tooltips);
+  return TRUE;
 }
Index: gtktooltips.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktooltips.h,v
retrieving revision 1.21
diff -u -p -r1.21 gtktooltips.h
--- gtktooltips.h	2001/09/19 21:29:57	1.21
+++ gtktooltips.h	2002/02/07 15:01:32
@@ -94,7 +94,7 @@ GtkTooltipsData* gtk_tooltips_data_get	 
 void             gtk_tooltips_force_window (GtkTooltips   *tooltips);
 
 
-void             _gtk_tooltips_show_tip    (GtkWidget    *widget);
+gboolean         _gtk_tooltips_show_tip    (GtkWidget    *widget);
 
 #ifdef __cplusplus
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]