summaryrefslogtreecommitdiff
path: root/gtk/gtkwidget.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2007-06-04 15:00:22 +0000
committerMichael Natterer <mitch@src.gnome.org>2007-06-04 15:00:22 +0000
commite631aef88191c44f199cb54ee6b75304b63193db (patch)
tree90b35c10c557ac55992c95dbdaffd3688c809d94 /gtk/gtkwidget.c
parent17df875136d184f15d4601fe38c82e98b830be45 (diff)
downloadgtk+-e631aef88191c44f199cb54ee6b75304b63193db.tar.gz
Move "move-focus" signals from several widgets to GtkWidget to enable more
2007-06-04 Michael Natterer <mitch@imendio.com> Move "move-focus" signals from several widgets to GtkWidget to enable more flexible costomization of keyboard navigation via bindings. Fixes bug #414947. * gtk/gtkwidget.c: add "move-focus" binding signal, default to calling the toplevel GtkWindow's "move-focus" vfunc. * gtk/gtktextview.[ch] * gtk/gtkwindow.[ch]: remove "move-focus" signals and add compat code that makes sure that both emitting the signal on the widget and overriding the virtual functions keeps working as before. * gtk/gtktoolbar.c: remove "move-focus" signal here too and use GtkWidget's signal. This change slightly changes keyboard navigation in toolbars. I'll fix the behavior if somebody can explain me if and how exactly the new behavior is broken. svn path=/trunk/; revision=18025
Diffstat (limited to 'gtk/gtkwidget.c')
-rw-r--r--gtk/gtkwidget.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 0ac93d79ce..59e91f81a4 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -77,6 +77,7 @@ enum {
MNEMONIC_ACTIVATE,
GRAB_FOCUS,
FOCUS,
+ MOVE_FOCUS,
EVENT,
EVENT_AFTER,
BUTTON_PRESS_EVENT,
@@ -214,6 +215,8 @@ static gboolean gtk_widget_real_focus_out_event (GtkWidget *widget,
GdkEventFocus *event);
static gboolean gtk_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction);
+static void gtk_widget_real_move_focus (GtkWidget *widget,
+ GtkDirectionType direction);
static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget,
GtkDirectionType direction);
static PangoContext* gtk_widget_peek_pango_context (GtkWidget *widget);
@@ -830,6 +833,16 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__ENUM,
G_TYPE_BOOLEAN, 1,
GTK_TYPE_DIRECTION_TYPE);
+ widget_signals[MOVE_FOCUS] =
+ _gtk_binding_signal_new (I_("move_focus"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_CALLBACK (gtk_widget_real_move_focus),
+ NULL, NULL,
+ _gtk_marshal_VOID__ENUM,
+ G_TYPE_NONE,
+ 1,
+ GTK_TYPE_DIRECTION_TYPE);
widget_signals[EVENT] =
g_signal_new (I_("event"),
G_TYPE_FROM_CLASS (gobject_class),
@@ -4618,6 +4631,20 @@ gtk_widget_real_focus (GtkWidget *widget,
return FALSE;
}
+static void
+gtk_widget_real_move_focus (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
+
+ if (GTK_IS_WINDOW (toplevel) &&
+ GTK_WINDOW_GET_CLASS (toplevel)->move_focus)
+ {
+ GTK_WINDOW_GET_CLASS (toplevel)->move_focus (GTK_WINDOW (toplevel),
+ direction);
+ }
+}
+
static gboolean
gtk_widget_real_keynav_failed (GtkWidget *widget,
GtkDirectionType direction)