From fa3e56a6dd2925373fc052eed6a7f8c29c9985b4 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 8 May 2007 00:54:37 -0500 Subject: [PATCH] Switch tabs on Enter and Space when navigating using keyboard --- moo/mooutils/moonotebook.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/moo/mooutils/moonotebook.c b/moo/mooutils/moonotebook.c index 4cd3dc24..cdbfd820 100644 --- a/moo/mooutils/moonotebook.c +++ b/moo/mooutils/moonotebook.c @@ -3028,8 +3028,9 @@ moo_notebook_scroll_event (GtkWidget *widget, } -static gboolean moo_notebook_key_press (GtkWidget *widget, - GdkEventKey *event) +static gboolean +moo_notebook_key_press (GtkWidget *widget, + GdkEventKey *event) { MooNotebook *nb = MOO_NOTEBOOK (widget); @@ -3038,6 +3039,19 @@ static gboolean moo_notebook_key_press (GtkWidget *widget, tab_drag_end (nb, FALSE); return TRUE; } + else if (GTK_WIDGET_HAS_FOCUS (nb) && + nb->priv->focus == FOCUS_NONE && + nb->priv->focus_page && + nb->priv->focus_page != nb->priv->current_page) + { + switch (event->keyval) + { + case GDK_Return: + case GDK_space: + moo_notebook_set_current_page (nb, page_index (nb, nb->priv->focus_page)); + return TRUE; + } + } return FALSE; }