From d57e1662cf2a2beb21d9413d6a4a2cef25d7c05c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 21 Apr 1998 02:17:33 +0000 Subject: Now any printable keystroke (not just Return) will activate the selected 1998-04-20 Federico Mena Quintero * gncal-full-day.c (gncal_full_day_key_press): Now any printable keystroke (not just Return) will activate the selected range. svn path=/trunk/; revision=172 --- calendar/gui/gncal-full-day.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c index 8db460e689..a9265ae7c6 100644 --- a/calendar/gui/gncal-full-day.c +++ b/calendar/gui/gncal-full-day.c @@ -1031,7 +1031,7 @@ paint_row (GncalFullDay *fullday, int row, struct paint_info *p) text_gc = p->widget->style->fg_gc[GTK_STATE_SELECTED]; } else if ((row < begin_row) || (row >= end_row)) { left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL]; - right_gc = left_gc; + right_gc = p->widget->style->bg_gc[GTK_STATE_ACTIVE]; text_gc = p->widget->style->fg_gc[GTK_STATE_NORMAL]; } else { left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL]; @@ -1810,6 +1810,8 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) { GncalFullDay *fullday; struct drag_info *di; + GList *children; + Child *child; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE); @@ -1823,10 +1825,31 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) return FALSE; if (event->keyval == GDK_Return) { - gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals [RANGE_ACTIVATED]); + gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]); return TRUE; } + if (event->length > 0) { + /* This means some printable key was pressed */ + + gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]); + + /* This is sort of a hack. We find the focused child, if it exists, and + * we re-send the keystroke to it. + */ + + for (children = fullday->children; children; children = children->next) { + child = children->data; + + if (GTK_WIDGET_HAS_FOCUS (child->widget)) { + event->window = GTK_TEXT (child->widget)->text_area; + gtk_widget_event (widget, (GdkEvent *) event); + return TRUE; + } + } + + } + return FALSE; } -- cgit v1.2.3