Re: Propagation of key press events



"Padraig O'Briain" <Padraig Obriain Sun COM> writes:

> Patch to achieve this change is attached.
> 
> Permission to commit?

This looks fine, with one comment; you should use 
_gtk_boolean_handled_accumulator for the signal accumulator for
the signal to get the normal TRUE-stops-emit behavior.

Regards,
                                        Owen

> > 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.
> > 
> >                                         Owen
> Index: gtkwidget.h
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.h,v
> retrieving revision 1.129
> diff -u -p -r1.129 gtkwidget.h
> --- gtkwidget.h	2002/01/30 03:32:13	1.129
> +++ gtkwidget.h	2002/02/06 17:49:16
> @@ -387,7 +387,7 @@ struct _GtkWidgetClass
>  				    guint               time);
>  
>    /* Signals used only for keybindings */
> -  void (* popup_menu)              (GtkWidget          *widget);
> +  gboolean (* popup_menu)          (GtkWidget          *widget);
>  
>    /* If a widget has multiple tooltips/whatsthis, it should show the
>     * one for the current focus location, or if that doesn't make
> Index: gtkwidget.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
> retrieving revision 1.293
> diff -u -p -r1.293 gtkwidget.c
> --- gtkwidget.c	2002/01/30 03:32:13	1.293
> +++ gtkwidget.c	2002/02/06 17:49:17
> @@ -1006,8 +1006,8 @@ gtk_widget_class_init (GtkWidgetClass *k
>  		    GTK_RUN_LAST | GTK_RUN_ACTION,
>  		    GTK_CLASS_TYPE (object_class),
>  		    GTK_SIGNAL_OFFSET (GtkWidgetClass, popup_menu),
> -                    _gtk_marshal_NONE__NONE,
> -		    GTK_TYPE_NONE, 0);
> +                    _gtk_marshal_BOOLEAN__VOID,
> +		    G_TYPE_BOOLEAN, 0);
>    widget_signals[SHOW_HELP] =
>      gtk_signal_new ("show_help",
>  		    GTK_RUN_LAST | GTK_RUN_ACTION,
> Index: gtkcolorsel.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkcolorsel.c,v
> retrieving revision 1.87
> diff -u -p -r1.87 gtkcolorsel.c
> --- gtkcolorsel.c	2002/01/17 23:43:23	1.87
> +++ gtkcolorsel.c	2002/02/06 17:49:17
> @@ -1017,13 +1017,14 @@ palette_activate (GtkWidget   *widget,
>    return FALSE;
>  }
>  
> -static void
> +static gboolean
>  palette_popup (GtkWidget *widget,
>                 gpointer   data)
>  {
>    GtkColorSelection *colorsel = GTK_COLOR_SELECTION (data);
>  
>    do_popup (colorsel, widget, GDK_CURRENT_TIME);
> +  return TRUE;
>  }
>                 
>  
> Index: gtkentry.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
> retrieving revision 1.177
> diff -u -p -r1.177 gtkentry.c
> --- gtkentry.c	2002/02/03 01:25:32	1.177
> +++ gtkentry.c	2002/02/06 17:49:18
> @@ -230,7 +230,7 @@ static void gtk_entry_paste_clipboard   
>  static void gtk_entry_toggle_overwrite   (GtkEntry        *entry);
>  static void gtk_entry_select_all         (GtkEntry        *entry);
>  static void gtk_entry_real_activate      (GtkEntry        *entry);
> -static void gtk_entry_popup_menu         (GtkWidget      *widget);
> +static gboolean gtk_entry_popup_menu     (GtkWidget      *widget);
>  
>  static void gtk_entry_keymap_direction_changed (GdkKeymap *keymap,
>  						GtkEntry  *entry);
> @@ -3946,10 +3946,11 @@ gtk_entry_do_popup (GtkEntry       *entr
>  				  info);
>  }
>  
> -static void
> +static gboolean
>  gtk_entry_popup_menu (GtkWidget *widget)
>  {
>    gtk_entry_do_popup (GTK_ENTRY (widget), NULL);
> +  return TRUE;
>  }
>  
>  static void
> Index: gtktextview.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
> retrieving revision 1.166
> diff -u -p -r1.166 gtktextview.c
> --- gtktextview.c	2002/02/03 01:25:32	1.166
> +++ gtktextview.c	2002/02/06 17:49:19
> @@ -222,7 +222,7 @@ static void     gtk_text_view_drag_data_
>  static void gtk_text_view_set_scroll_adjustments (GtkTextView   *text_view,
>                                                    GtkAdjustment *hadj,
>                                                    GtkAdjustment *vadj);
> -static void gtk_text_view_popup_menu             (GtkWidget     *widget);
> +static gboolean gtk_text_view_popup_menu         (GtkWidget     *widget);
>  
>  static void gtk_text_view_move_cursor       (GtkTextView           *text_view,
>                                               GtkMovementStep        step,
> @@ -6396,10 +6396,11 @@ gtk_text_view_do_popup (GtkTextView    *
>  				  info);
>  }
>  
> -static void
> +static gboolean
>  gtk_text_view_popup_menu (GtkWidget *widget)
>  {
>    gtk_text_view_do_popup (GTK_TEXT_VIEW (widget), NULL);  
> +  return TRUE;
>  }
>  
>  /* Child GdkWindows */



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