From dc257f40039197c8f1dbdf86608c13ec12f5b1de Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Wed, 14 Aug 2002 08:14:07 +0000 Subject: [PATCH] Move focus to children, if they exist, after GtkTextView is focused. * gtk/gtktextview.c (gtk_text_view_focus): Move focus to children, if they exist, after GtkTextView is focused. (#63844) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktextview.c | 22 ++++++++++++++++++++-- 7 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e62ab39562..946048a003 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e62ab39562..946048a003 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e62ab39562..946048a003 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e62ab39562..946048a003 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e62ab39562..946048a003 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e62ab39562..946048a003 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2002-08-14 Padraig O'Briain + + * gtk/gtktextview.c (gtk_text_view_focus): Move focus to + children, if they exist, after GtkTextView is focused. (#63844) + 2002-08-06 jacob berkman * configure.in: link gdk-pixbuf-xlib against x libs (bug #83442) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 985cdecbf5..fbdb1679e8 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -4183,11 +4183,29 @@ gtk_text_view_focus (GtkWidget *widget, { GtkTextView *text_view; GtkContainer *container; + gboolean result; text_view = GTK_TEXT_VIEW (widget); container = GTK_CONTAINER (widget); - - return GTK_WIDGET_CLASS (parent_class)->focus (widget, direction); + + if (!gtk_widget_is_focus (widget) && + container->focus_child == NULL) + { + gtk_widget_grab_focus (widget); + return TRUE; + } + else + { + /* + * Unset CAN_FOCUS flag so that gtk_container_focus() allows + * children to get the focus + */ + GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS); + result = GTK_WIDGET_CLASS (parent_class)->focus (widget, direction); + GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS); + + return result; + } } /*