aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog3
-rw-r--r--calendar/gncal-full-day.c27
-rw-r--r--calendar/gui/gncal-full-day.c27
3 files changed, 53 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c2c1472a0d..db529603fe 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,8 @@
1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
+ * gncal-full-day.c (gncal_full_day_key_press): Now any printable
+ keystroke (not just Return) will activate the selected range.
+
* gncal-full-day.c (paint_back): Made it use the new paint_row
function instead of painting everything directly. We calculate
areas in a smarter way so there is even less flicker than before,
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c
index 8db460e689..a9265ae7c6 100644
--- a/calendar/gncal-full-day.c
+++ b/calendar/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;
}
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;
}