From f4fb51a79adcea42e1fa95564543558a7c3390c5 Mon Sep 17 00:00:00 2001 From: Michael Dominic Kostrzewa Date: Wed, 20 Sep 2006 09:41:53 +0000 Subject: [PATCH] 2006-09-19 Michael Dominic Kostrzewa * hildon-widgets/hildon-date-editor.c: (hildon_date_editor_keypress): On left or right key pressed, it first takes in consideration the current cursor position inside the entries. If it's in an edge, focus moves to the widget on the right or left. Fixes #NB40770. --- ChangeLog | 8 ++++++++ hildon-widgets/hildon-date-editor.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08532b9..b137926 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-09-19 Michael Dominic Kostrzewa + * hildon-widgets/hildon-date-editor.c: + (hildon_date_editor_keypress): On left or right key pressed, it + first takes in consideration the current cursor position inside + the entries. If it's in an edge, focus moves to the widget on the + right or left. Fixes #NB40770. + +2006-09-19 Michael Dominic Kostrzewa + * hildon-widgets-plugins/hildon-color-chooser-dialog-hsv.c: Agh... correcting silly mistake. diff --git a/hildon-widgets/hildon-date-editor.c b/hildon-widgets/hildon-date-editor.c index 89be988..4bbbb60 100644 --- a/hildon-widgets/hildon-date-editor.c +++ b/hildon-widgets/hildon-date-editor.c @@ -1069,15 +1069,19 @@ static gboolean hildon_date_editor_keypress(GtkWidget * widget, ed = HILDON_DATE_EDITOR(data); priv = HILDON_DATE_EDITOR_GET_PRIVATE(ed); pos = gtk_editable_get_position(GTK_EDITABLE(widget)); - + switch (event->keyval) { case GDK_Left: - (void) gtk_widget_child_focus(GTK_WIDGET(data), GTK_DIR_LEFT); - return TRUE; + if (pos == 0) { + (void) gtk_widget_child_focus(GTK_WIDGET(data), GTK_DIR_LEFT); + return TRUE; + } break; case GDK_Right: - (void) gtk_widget_child_focus(GTK_WIDGET(data), GTK_DIR_RIGHT); - return TRUE; + if (pos >= g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(widget)), -1)) { + (void) gtk_widget_child_focus(GTK_WIDGET(data), GTK_DIR_RIGHT); + return TRUE; + } break; case GDK_Return: case GDK_ISO_Enter: -- 1.7.9.5