Matthew Barnes 5bd7f4
--- evolution-2.9.1/calendar/gui/e-day-view.c.first-ascii	2006-11-06 11:25:23.000000000 -0500
Matthew Barnes 5bd7f4
+++ evolution-2.9.1/calendar/gui/e-day-view.c	2006-11-06 11:34:32.000000000 -0500
Matthew Barnes 5bd7f4
@@ -333,7 +333,7 @@
Matthew Barnes 5bd7f4
 static void e_day_view_start_editing_event (EDayView *day_view,
Matthew Barnes 5bd7f4
 					    gint day,
Matthew Barnes 5bd7f4
 					    gint event_num,
Matthew Barnes 5bd7f4
-					    gchar *initial_text);
Matthew Barnes 5bd7f4
+					    GdkEventKey *key_event);
Matthew Barnes 5bd7f4
 static void e_day_view_stop_editing_event (EDayView *day_view);
Matthew Barnes 5bd7f4
 static gboolean e_day_view_text_keypress (GnomeCanvasItem *item,
Matthew Barnes 5bd7f4
 					  guint             keyval,
Matthew Barnes 5bd7f4
@@ -6012,7 +6012,6 @@
Matthew Barnes 5bd7f4
 	ECalModel *model;
Matthew Barnes 5bd7f4
 	ECalComponent *comp;
Matthew Barnes 5bd7f4
 	gint day, event_num;
Matthew Barnes 5bd7f4
-	gchar *initial_text;
Matthew Barnes 5bd7f4
 	guint keyval;
Matthew Barnes 5bd7f4
 	gboolean stop_emission;
Matthew Barnes 5bd7f4
 	time_t dtstart, dtend;
Matthew Barnes 5bd7f4
@@ -6153,15 +6152,12 @@
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
 	/* We only want to start an edit with a return key or a simple
Matthew Barnes 5bd7f4
 	   character. */
Matthew Barnes 5bd7f4
-	if (keyval == GDK_Return) {
Matthew Barnes 5bd7f4
-		initial_text = NULL;
Matthew Barnes 5bd7f4
-	} else if (((keyval >= 0x20) && (keyval <= 0xFF)
Matthew Barnes 5bd7f4
-		    && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
Matthew Barnes 5bd7f4
-		   || (event->length == 0)
Matthew Barnes 5bd7f4
-		   || (keyval == GDK_Tab)) {
Matthew Barnes 5bd7f4
+	if ((keyval != GDK_Return) &&
Matthew Barnes 5bd7f4
+	    (((keyval >= 0x20) && (keyval <= 0xFF)
Matthew Barnes 5bd7f4
+	      && (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
Matthew Barnes 5bd7f4
+	     || (event->length == 0)
Matthew Barnes 5bd7f4
+	     || (keyval == GDK_Tab)))
Matthew Barnes 5bd7f4
 		return FALSE;
Matthew Barnes 5bd7f4
-	} else
Matthew Barnes 5bd7f4
-		initial_text = e_utf8_from_gtk_event_key (widget, event->keyval, event->string);
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
 	/* Add a new event covering the selected range */	
Matthew Barnes 5bd7f4
 	icalcomp = e_cal_model_create_component_with_defaults (model);
Matthew Barnes 5bd7f4
@@ -6207,15 +6203,11 @@
Matthew Barnes 5bd7f4
 	gtk_widget_queue_draw (day_view->main_canvas);
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
 	if (e_day_view_find_event_from_uid (day_view, ecal, uid, NULL, &day, &event_num)) {
Matthew Barnes 5bd7f4
-		e_day_view_start_editing_event (day_view, day, event_num,
Matthew Barnes 5bd7f4
-						initial_text);
Matthew Barnes 5bd7f4
+		e_day_view_start_editing_event (day_view, day, event_num, event);
Matthew Barnes 5bd7f4
 	} else {
Matthew Barnes 5bd7f4
 		g_warning ("Couldn't find event to start editing.\n");
Matthew Barnes 5bd7f4
 	}
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
-	if (initial_text)
Matthew Barnes 5bd7f4
-		g_free (initial_text);
Matthew Barnes 5bd7f4
-
Matthew Barnes 5bd7f4
 	g_object_unref (comp);
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
 	return TRUE;
Matthew Barnes 5bd7f4
@@ -6897,7 +6889,7 @@
Matthew Barnes 5bd7f4
 e_day_view_start_editing_event (EDayView *day_view,
Matthew Barnes 5bd7f4
 				gint	  day,
Matthew Barnes 5bd7f4
 				gint	  event_num,
Matthew Barnes 5bd7f4
-				gchar    *initial_text)
Matthew Barnes 5bd7f4
+				GdkEventKey *key_event)
Matthew Barnes 5bd7f4
 {
Matthew Barnes 5bd7f4
 	EDayViewEvent *event;
Matthew Barnes 5bd7f4
 	ETextEventProcessor *event_processor = NULL;
Matthew Barnes 5bd7f4
@@ -6937,10 +6929,20 @@
Matthew Barnes 5bd7f4
 	   rid of the start and end times. */
Matthew Barnes 5bd7f4
 	e_canvas_item_grab_focus (event->canvas_item, TRUE);
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
-	if (initial_text) {
Matthew Barnes 5bd7f4
-		gnome_canvas_item_set (event->canvas_item,
Matthew Barnes 5bd7f4
-				       "text", initial_text,
Matthew Barnes 5bd7f4
-				       NULL);
Matthew Barnes 5bd7f4
+	if (key_event) {
Matthew Barnes 5bd7f4
+		if (gtk_im_context_filter_keypress (((EText *)(event->canvas_item))->im_context, key_event)) {
Matthew Barnes 5bd7f4
+			((EText *)(event->canvas_item))->need_im_reset = TRUE;
Matthew Barnes 5bd7f4
+		}
Matthew Barnes 5bd7f4
+		else {
Matthew Barnes 5bd7f4
+			char *initial_text;
Matthew Barnes 5bd7f4
+
Matthew Barnes 5bd7f4
+			initial_text = e_utf8_from_gtk_event_key (GTK_WIDGET (day_view), key_event->keyval, key_event->string);
Matthew Barnes 5bd7f4
+			gnome_canvas_item_set (event->canvas_item,
Matthew Barnes 5bd7f4
+			                       "text", initial_text,
Matthew Barnes 5bd7f4
+			                       NULL);
Matthew Barnes 5bd7f4
+			if (initial_text)
Matthew Barnes 5bd7f4
+				g_free (initial_text);
Matthew Barnes 5bd7f4
+		}
Matthew Barnes 5bd7f4
 	}
Matthew Barnes 5bd7f4
 
Matthew Barnes 5bd7f4
 	/* Try to move the cursor to the end of the text. */