diff options
author | Chenthill Palanisamy <pchen@src.gnome.org> | 2007-09-10 03:55:34 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2007-09-10 03:55:34 +0800 |
commit | a1ef02681576e73a172eae9a003115228dd02fb7 (patch) | |
tree | 60e4960647496734e7831513ce5f85571f516135 /calendar/gui/e-day-view.c | |
parent | 97bc97c1b865ee34f1f794fe3445475a7cb4f70f (diff) | |
download | gsoc2013-evolution-a1ef02681576e73a172eae9a003115228dd02fb7.tar.gz gsoc2013-evolution-a1ef02681576e73a172eae9a003115228dd02fb7.tar.zst gsoc2013-evolution-a1ef02681576e73a172eae9a003115228dd02fb7.zip |
Fixes #332026.
svn path=/trunk/; revision=34204
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 7aeed7e4eb..d081e620fb 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -333,7 +333,7 @@ static void e_day_view_ensure_events_sorted (EDayView *day_view); static void e_day_view_start_editing_event (EDayView *day_view, gint day, gint event_num, - gchar *initial_text); + GdkEventKey *key_event); static void e_day_view_stop_editing_event (EDayView *day_view); static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *event, @@ -6036,7 +6036,6 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) ECalModel *model; ECalComponent *comp; gint day, event_num; - gchar *initial_text; guint keyval; gboolean stop_emission; time_t dtstart, dtend; @@ -6177,15 +6176,13 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) /* We only want to start an edit with a return key or a simple character. */ - if (keyval == GDK_Return) { - initial_text = NULL; - } else if (((keyval >= 0x20) && (keyval <= 0xFF) - && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) - || (event->length == 0) - || (keyval == GDK_Tab)) { + if ((keyval != GDK_Return) && + (((keyval >= 0x20) && (keyval <= 0xFF) + && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) + || (event->length == 0) + || (keyval == GDK_Tab))) { return FALSE; - } else - initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string); + } /* Add a new event covering the selected range */ icalcomp = e_cal_model_create_component_with_defaults (model); @@ -6237,15 +6234,11 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) gtk_widget_queue_draw (day_view->main_canvas); if (e_day_view_find_event_from_uid (day_view, ecal, uid, NULL, &day, &event_num)) { - e_day_view_start_editing_event (day_view, day, event_num, - initial_text); + e_day_view_start_editing_event (day_view, day, event_num, event); } else { g_warning ("Couldn't find event to start editing.\n"); } - if (initial_text) - g_free (initial_text); - g_object_unref (comp); return TRUE; @@ -6927,7 +6920,7 @@ static void e_day_view_start_editing_event (EDayView *day_view, gint day, gint event_num, - gchar *initial_text) + GdkEventKey *key_event) { EDayViewEvent *event; ETextEventProcessor *event_processor = NULL; @@ -6964,10 +6957,20 @@ e_day_view_start_editing_event (EDayView *day_view, rid of the start and end times. */ e_canvas_item_grab_focus (event->canvas_item, TRUE); - if (initial_text) { - gnome_canvas_item_set (event->canvas_item, - "text", initial_text, - NULL); + if (key_event) { + if (gtk_im_context_filter_keypress (((EText *)(event->canvas_item))->im_context, key_event)) { + ((EText *)(event->canvas_item))->need_im_reset = TRUE; + } + else { + char *initial_text; + + initial_text = e_utf8_from_gtk_event_key (GTK_WIDGET (day_view), key_event->keyval, key_event->string); + gnome_canvas_item_set (event->canvas_item, + "text", initial_text, + NULL); + if (initial_text) + g_free (initial_text); + } } /* Try to move the cursor to the end of the text. */ |