[evolution-patches] gal patch - for 44222



Hi All,
	Attached pl. find a patch for "44222 task summary entry widget not 
i18ned". Not only the now the these widgets can accept i18ned input, but 
copy/paste also works fine. Pl. review it and lemme know.
	
	This one is created against evolution-1-4-branch of gal.
	
Thanks & Regards,
Suresh
? .ChangeLog.swp
? 44222.patch
? autom4te.cache
? cscope.out
? files
? docs/gal-api.html
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.800.2.5
diff -u -r1.800.2.5 ChangeLog
--- ChangeLog	12 Sep 2003 15:59:16 -0000	1.800.2.5
+++ ChangeLog	25 Sep 2003 21:28:06 -0000
@@ -1,3 +1,82 @@
+2003-09-25  Suresh Chandrasekharan  <suresh chandrasekharan sun com>
+	
+	* Fix for "44222 task summary entry widget not i18ned". The following
+	files are changed.
+
+	* gal/gal/e-table/e-cell-text.c: Lots of changes for i18n 
+	selection/input support. Added these functions for input method support.
+
+	(e_cell_text_preedit_changed_cb)
+	(e_cell_text_commit_cb)
+	(e_cell_text_retrieve_surrounding_cb)
+	(e_cell_text_delete_surrounding_cb)
+
+	The following functions are modified.
+
+	(ect_stop_editing): disconnect signal handlers when editing stops
+
+	(build_layout): Checks whether preedit text existing and inserts
+	preedit text to the cell text.
+
+	(generate_layout): If the selected row/col matches the one for
+	which the layout is created, make use of the existing layout
+	without creating a new one.
+
+	(ect_draw): Changes for including the preedit only to the currently
+	selected row/col. Also display the cursor at the end of preedit text.
+
+	(ect_event): Connects the IM callbacks to the key press event. 
+	Disconnect when not in editing mode. Also a special flag to see
+	when Enter key pressed in preedit mode, the text is committed only
+	not a new row is created. This woks in conjunction with the changes
+	made in the eti_event in e-table-item.c file and e-cell.h.
+
+	(ect_height): Changes due to parameters changing for generate_layout
+	
+	(ect_enter_edit): Initialization of im_context for a cell text and
+	assoociated flags.
+
+	(ect_max_width):  Changes due to parameters changing for 
+	generate_layout.
+
+	(ect_max_width_by_row):  Changes due to parameters changing for 
+	generate_layout.
+	
+	(ect_show_tooltip): Changes due to parameters changing for 
+	generate_layout.
+
+	(e_cell_text_construct): check whether paramters are NULL.
+
+	(get_position_from_xy): Changes due to parameters changing for 
+	generate_layout.
+
+	(_insert): Set the selection_start as the minimum of strlen(edit->text)
+	and selection_start. Used to correct the preedit_string length
+	which may have added to the selection_start.
+
+	(e_cell_text_view_command): When inserting, if in the preedit mode
+	do not delete the selection.
+
+	(_selection_get): Set utf8 data instead of string data.
+
+	(_selection_received): Take in UTF8_ATOM inaddition to 
+	GDK_SELECTION_TYPE_STRING.
+
+	(e_cell_text_view_get_selection): Make utf8 data when acting as a
+	selection source.
+
+	* gal/e-table/e-cell-text.h : Included <gtk/gtkmenu.h>
+
+	* gal/e-table/e-cell.h: Added enum E_CELL_PREEDIT to ECellFlags
+
+	* gal/e-table/e-table-item.c: (eti_event) Changes for not committing 
+	the edited text as a seperate row in preedit mode.
+
+	* gal/e-table/e-table.c: (table_canvas_focus_event_cb) To have 
+	proper im_context focus for the ecanvas holding the e-table.
+
+	* gal/widgets/e-canvas.h: Additional variable for focus tracking.
+
 2003-09-12  Mike Kestner  <mkestner ximian com>
 
 	* configure.in : releasing 1.99.10
Index: gal/e-table/e-cell-text.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-text.c,v
retrieving revision 1.130
diff -u -r1.130 e-cell-text.c
--- gal/e-table/e-cell-text.c	23 Jun 2003 20:30:22 -0000	1.130
+++ gal/e-table/e-cell-text.c	25 Sep 2003 21:28:06 -0000
@@ -96,6 +96,8 @@
 
 #define PARENT_TYPE e_cell_get_type ()
 
+#define UTF8_ATOM  gdk_atom_intern ("UTF8_STRING", FALSE)
+
 #define TEXT_PAD 4
 
 typedef struct {
@@ -177,6 +179,11 @@
 
 	guint pointer_in : 1;
 	guint default_cursor_shown : 1;
+	GtkIMContext *im_context;
+	gboolean need_im_reset;
+	gboolean im_context_signals_registered;
+
+	guint16 preedit_length;       /* length of preedit string, in bytes */
 
 	ECellActions actions;
 };
@@ -193,6 +200,12 @@
 
 static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap);
 static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec);
+static void e_cell_text_preedit_changed_cb (GtkIMContext *context, ECellTextView *text_view);
+static void e_cell_text_commit_cb (GtkIMContext *context, const gchar  *str, ECellTextView *text_view);
+static gboolean e_cell_text_retrieve_surrounding_cb (GtkIMContext *context, ECellTextView *text_view);
+static gboolean e_cell_text_delete_surrounding_cb   (GtkIMContext *context, gint          offset, gint          n_chars, ECellTextView        *text_view);
+static void _insert (ECellTextView *text_view, char *string, int value);
+static void _delete_selection (ECellTextView *text_view);
 
 static ECellClass *parent_class;
 
@@ -290,6 +303,11 @@
 		g_timer_destroy (edit->timer);
 		edit->timer = NULL;
 	}
+	
+	g_signal_handlers_disconnect_matched (
+		edit->im_context,
+		G_SIGNAL_MATCH_DATA, 0, 0,
+		NULL, NULL, text_view);
 
 	if (edit->layout)
 		g_object_unref (edit->layout);
@@ -425,14 +443,65 @@
 }
 
 static PangoLayout *
-build_layout (ECellTextView *text_view, int row, const char *text, gint width)
+build_layout (ECellTextView *text_view, int row, const char *text, gint width, gboolean include_preedit, gboolean create_new_layout)
 {
+	gboolean bold, strikeout, underline;
 	ECellView *ecell_view = (ECellView *) text_view;
 	ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
-	PangoLayout *layout;
-	gboolean bold, strikeout, underline;
+	CellEdit *edit = text_view->edit;
+	PangoLayout *layout ; 
+	gchar *preedit_string = NULL;
+	gint preedit_length = 0;
+	PangoAttrList *preedit_attrs = NULL;
+	PangoAttrList *attrs = pango_attr_list_new ();
+	
+	if (create_new_layout)
+		layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), NULL);
+	else
+		layout = edit->layout;
+
+	if (edit && include_preedit) {
+		gtk_im_context_get_preedit_string (edit->im_context,
+						&preedit_string,&preedit_attrs,
+						NULL);
+		preedit_length = edit->preedit_length = strlen (preedit_string);;
+	}
+
+	if (preedit_length) {
+		GString *tmp_string = g_string_new (NULL);
+		gint len = strlen (text);
+		gint mlen = MIN(edit->selection_end,len);
+		
+		/* mlen is the length in bytes, not chars
+		 * check whether we are not inserting into
+		 * the middle of a utf8 character
+		 */
+
+		if (mlen < len) {
+			if (!g_utf8_validate (text+mlen, -1, NULL)) {
+				gchar *tc;
+				tc = g_utf8_find_next_char (text+mlen,NULL);
+				if (tc) {
+					mlen = (gint) (tc - text);
+				}
+			}
+		}
+
+		g_string_prepend_len (tmp_string, text,len); 
+		g_string_insert (tmp_string, mlen, preedit_string);
+		pango_layout_set_text (layout, tmp_string->str, strlen(tmp_string->str));
+		pango_attr_list_splice (attrs, preedit_attrs, mlen, preedit_length);
 
-	layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text);
+		g_string_free (tmp_string, TRUE);
+
+	} else {
+		pango_layout_set_text (layout, text?text:"", text?strlen (text):0);
+	}
+
+	if (preedit_string)
+		g_free (preedit_string);
+	if (preedit_attrs)
+		pango_attr_list_unref (preedit_attrs);
 
 	bold = ect->bold_column >= 0 &&
 		row >= 0 &&
@@ -445,9 +514,7 @@
 		e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
 
 	if (bold || strikeout || underline) {
-		PangoAttrList *attrs;
 		int length = strlen (text);
-		attrs = pango_attr_list_new ();
 		if (bold) {
 			PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
 			attr->start_index = 0;
@@ -511,7 +578,7 @@
 }
 
 static PangoLayout *
-generate_layout (ECellTextView *text_view, int model_col, int view_col, int row, int width)
+generate_layout (ECellTextView *text_view, int model_col, int view_col, int row, int width, gboolean include_preedit)
 {
 	ECellView *ecell_view = (ECellView *) text_view;
 	ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
@@ -520,15 +587,17 @@
 
 	if (edit && edit->layout && edit->model_col == model_col && edit->row == row) {
 		g_object_ref (edit->layout);
+		if (include_preedit)
+			edit->layout = build_layout  (text_view, row, edit->text ? edit->text : "?",  width, include_preedit, FALSE);
 		return edit->layout;
 	}
 
 	if (row >= 0) {
 		char *temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
-		layout = build_layout (text_view, row, temp ? temp : "?", width);
+		layout = build_layout (text_view, row, temp ? temp : "?", width, include_preedit, TRUE);
 		e_cell_text_free_text(ect, temp);
 	} else
-		layout = build_layout (text_view, row, "Mumbo Jumbo", width);
+		layout = build_layout (text_view, row, "Mumbo Jumbo", width, include_preedit, TRUE);
 
 	return layout;
 }
@@ -597,7 +666,7 @@
 	ECellTextView *text_view = (ECellTextView *) ecell_view;
 	ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
 	CellEdit *edit = text_view->edit;
-	gboolean selected;
+	gboolean selected, include_preedit = FALSE;
 	GdkColor *foreground, *cursor_color;
 	GtkWidget *canvas = GTK_WIDGET (text_view->canvas);
 	GdkRectangle clip_rect;
@@ -646,7 +715,11 @@
 	gdk_gc_set_clip_rectangle (text_view->gc, &clip_rect);
 	/*	clip_rect = &rect;*/
 
-	layout = generate_layout (text_view, model_col, view_col, row, x2 - x1);
+	if (edit && edit->view_col == view_col && edit->row == row) {
+		include_preedit = TRUE;
+	}
+
+	layout = generate_layout (text_view, model_col, view_col, row, x2 - x1, include_preedit);
 
 	gdk_draw_layout (drawable, text_view->gc,
 			 x_origin, y_origin,
@@ -713,7 +786,8 @@
 		} else {
 			if (edit->show_cursor) {
 				PangoRectangle strong_pos, weak_pos;
-				pango_layout_get_cursor_pos (layout, edit->selection_start, &strong_pos, &weak_pos);
+				pango_layout_get_cursor_pos (layout, edit->selection_start + edit->preedit_length, &strong_pos, &weak_pos);
+				
 				draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, strong_pos);
 				if (strong_pos.x != weak_pos.x ||
 				    strong_pos.y != weak_pos.y ||
@@ -749,6 +823,7 @@
 /*
  * Selects the entire string
  */
+
 static void
 ect_edit_select_all (ECellTextView *text_view)
 {
@@ -774,8 +849,10 @@
 ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
 {
 	ECellTextView *text_view = (ECellTextView *) ecell_view;
+	ECellText *ect = (ECellText *) ((ECellView *)text_view)->ecell;
 	ETextEventProcessorEvent e_tep_event;
-	gboolean edit_display = FALSE;
+	gboolean edit_display = FALSE; 
+	gint preedit_len;
 	CellEdit *edit = text_view->edit;
 	GtkWidget *canvas = GTK_WIDGET (text_view->canvas);
 	gint return_val = 0;
@@ -793,7 +870,70 @@
 	case GDK_FOCUS_CHANGE:
 		break;
 	case GDK_KEY_PRESS: /* Fall Through */
+		if (edit_display) {
+			if (edit->im_context && 
+				!edit->im_context_signals_registered) {
+
+				g_signal_connect (edit->im_context, 
+						"preedit_changed",
+						G_CALLBACK (\
+						e_cell_text_preedit_changed_cb),
+						text_view);
+
+				g_signal_connect (edit->im_context, 
+						"commit",
+						G_CALLBACK (\
+						e_cell_text_commit_cb), 
+						text_view);
+
+				g_signal_connect (edit->im_context, 
+						"retrieve_surrounding",
+						G_CALLBACK (\
+						e_cell_text_retrieve_surrounding_cb), 
+						text_view);
+
+				g_signal_connect (edit->im_context, 
+						"delete_surrounding",
+						G_CALLBACK (\
+						e_cell_text_delete_surrounding_cb), 
+						text_view);
+
+				edit->im_context_signals_registered = TRUE;
+			}
+
+			edit->show_cursor = FALSE;
+
+		} else {
+			if (edit->im_context) {
+				g_signal_handlers_disconnect_matched (
+						edit->im_context, 
+						G_SIGNAL_MATCH_DATA, 0, 0, 
+						NULL, NULL, edit);
+				edit->im_context_signals_registered = FALSE;
+			}
+
+			ect_stop_editing (text_view, TRUE);
+			if (edit->timeout_id) {
+				g_source_remove(edit->timeout_id);
+				edit->timeout_id = 0;
+			}
+		}
+		return_val = TRUE;
+		/* Fallthrough */
 	case GDK_KEY_RELEASE:
+		preedit_len = edit->preedit_length;
+		if (edit_display && edit->im_context &&
+				gtk_im_context_filter_keypress (\
+					edit->im_context,
+					(GdkEventKey*)event)) {
+
+			edit->need_im_reset = TRUE;
+			if (preedit_len && flags & E_CELL_PREEDIT)
+				return FALSE;
+			else
+		 		return TRUE;
+		}
+				
 		if (event->key.keyval == GDK_Escape){
 			ect_cancel_edit (text_view);
 			return_val = TRUE;
@@ -829,12 +969,10 @@
 					e_tep_event.key.length = 0;
 				}
 #endif
-
 				_get_tep (edit);
-				edit->actions = 0;
 				return_val = e_text_event_processor_handle_event (edit->tep, &e_tep_event);
-				*actions = edit->actions;
-				if (e_tep_event.key.string) g_free (e_tep_event.key.string);
+				if (e_tep_event.key.string) 
+					g_free (e_tep_event.key.string);
 				break;
 			}
 		}
@@ -944,15 +1082,7 @@
 		break;
 	}
 
-	if (return_val)
-		return return_val;
-#if 0
-	if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
-		return GNOME_CANVAS_ITEM_CLASS(parent_class)->event (item, event);
-#endif
-	else
-		return 0;
-	
+	return return_val;
 }
 
 /*
@@ -965,7 +1095,7 @@
 	gint height;
 	PangoLayout *layout;
 
-	layout = generate_layout (text_view, model_col, view_col, row, 0);
+	layout = generate_layout (text_view, model_col, view_col, row, 0, TRUE);
 	pango_layout_get_pixel_size (layout, NULL, &height);
 	g_object_unref (layout);
 	return height + 2;
@@ -985,6 +1115,9 @@
 	edit = g_new0 (CellEdit, 1);
 	text_view->edit = edit;
 
+	edit->im_context =  E_CANVAS (text_view->canvas)->im_context;
+	edit->need_im_reset = FALSE;
+	edit->im_context_signals_registered = FALSE;
 	edit->view_col = -1;
 	edit->model_col = -1;
 	edit->row = -1;
@@ -997,7 +1130,7 @@
 		((ETableItem *)ecell_view->e_table_item_view)->header,
 		view_col)->width - 8;
 
-	edit->layout = generate_layout (text_view, model_col, view_col, row, edit->cell_width);
+	edit->layout = generate_layout (text_view, model_col, view_col, row, edit->cell_width, FALSE);
 	
 	edit->xofs_edit = 0.0;
 	edit->yofs_edit = 0.0;
@@ -1045,7 +1178,6 @@
 		}
 	}
 #endif
-
 	ect_queue_redraw (text_view, view_col, row);
 	
 	return NULL;
@@ -1187,7 +1319,7 @@
 	number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
 
 	for (row = 0; row < number_of_rows; row++) {
-		PangoLayout *layout = generate_layout (text_view, model_col, view_col, row, 0);
+		PangoLayout *layout = generate_layout (text_view, model_col, view_col, row, 0, TRUE);
 		int width;
 
 		pango_layout_get_pixel_size (layout, &width, NULL);
@@ -1213,7 +1345,7 @@
 	if (row >= e_table_model_row_count (ecell_view->e_table_model))
 		return 0;
 
-	layout = generate_layout (text_view, model_col, view_col, row, 0);
+	layout = generate_layout (text_view, model_col, view_col, row, 0, TRUE);
 	pango_layout_get_pixel_size (layout, &width, NULL);
 	g_object_unref (layout);
 	
@@ -1287,7 +1419,7 @@
 
 	tooltip->timer = 0;
 
-	layout = generate_layout (text_view, model_col, view_col, row, col_width);
+	layout = generate_layout (text_view, model_col, view_col, row, col_width, TRUE);
 
 	pango_layout_get_pixel_size (layout, &width, &height);
 	if (width < col_width - 8) {
@@ -1566,6 +1698,77 @@
 	}
 }
 
+
+/* IM Context Callbacks */
+
+static void
+e_cell_text_preedit_changed_cb (GtkIMContext *context,
+		  ECellTextView    *tv)
+{
+	gchar *preedit_string;
+	gint cursor_pos;
+	CellEdit *edit=tv->edit;
+	gtk_im_context_get_preedit_string (edit->im_context, &preedit_string, 
+					NULL, &cursor_pos);
+	                                                  
+	edit->preedit_length = strlen (preedit_string);
+	cursor_pos =  CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1)); 
+	g_free (preedit_string);
+	ect_queue_redraw (tv, edit->view_col, edit->row);
+}
+
+static void
+e_cell_text_commit_cb (GtkIMContext *context,
+		  const gchar  *str,
+		  ECellTextView    *tv)
+{
+	CellEdit *edit = tv->edit;
+	ECellText *ect = (ECellText *) ((ECellView *)tv)->ecell;
+	ETextEventProcessorCommand command;
+	                                                  
+	if (g_utf8_validate (str, strlen (str), NULL)) {
+		command.action = E_TEP_INSERT;
+		command.position = E_TEP_SELECTION;
+		command.string = (gchar *)str;
+		command.value = strlen(str);
+		e_cell_text_view_command (edit->tep, &command, edit);
+	}
+
+}
+
+static gboolean
+e_cell_text_retrieve_surrounding_cb (GtkIMContext *context,
+				ECellTextView        *tv)
+{
+	int cur_pos = 0;
+	CellEdit *edit = tv->edit;
+
+	cur_pos = g_utf8_pointer_to_offset (edit->text, edit->text + edit->selection_start);
+
+	gtk_im_context_set_surrounding (context,
+					edit->text,
+					strlen (edit->text),
+					cur_pos
+					);
+	
+	return TRUE;
+}
+
+static gboolean
+e_cell_text_delete_surrounding_cb   (GtkIMContext *context,
+				gint          offset,
+				gint          n_chars,
+				ECellTextView        *tv)
+{
+	CellEdit *edit = tv->edit;
+
+	gtk_editable_delete_text (GTK_EDITABLE (edit),
+				  edit->selection_end + offset,
+				  edit->selection_end + offset + n_chars);
+
+	return TRUE;
+}
+
 static void
 e_cell_text_init (ECellText *ect)
 {
@@ -1595,7 +1798,10 @@
 ECell *
 e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification justify)
 {
-	cell->font_name = g_strdup (fontname);
+	if(!cell)
+		return E_CELL(NULL);
+	if(fontname)
+		cell->font_name = g_strdup (fontname);
 	cell->justify = justify;
 	return E_CELL(cell);
 }
@@ -1645,7 +1851,7 @@
 	int index;
 	int trailing;
 	const char *text;
-	PangoLayout *layout = generate_layout (edit->text_view, edit->model_col, edit->view_col, edit->row, edit->cell_width);
+	PangoLayout *layout = generate_layout (edit->text_view, edit->model_col, edit->view_col, edit->row, edit->cell_width, FALSE);
 	ECellTextView *text_view = edit->text_view;
 	ECellText *ect = (ECellText *) ((ECellView *)text_view)->ecell;
 
@@ -1932,6 +2138,8 @@
 
 	if (value <= 0) return;
 
+	edit->selection_start = MIN (strlen(edit->text), edit->selection_start);
+
 	temp = g_new (gchar, strlen (edit->text) + value + 1);
 
 	strncpy (temp, edit->text, edit->selection_start);
@@ -2052,7 +2260,7 @@
 		break;
 
 	case E_TEP_INSERT:
-		if (edit->selection_end != edit->selection_start) {
+		if (!edit->preedit_length && edit->selection_end != edit->selection_start) {
 			_delete_selection (text_view);
 		}
 		_insert (text_view, command->string, command->value);
@@ -2118,7 +2326,7 @@
 	if (change) {
 		if (edit->layout)
 			g_object_unref (edit->layout);
-		edit->layout = build_layout (text_view, edit->row, edit->text, edit->cell_width);
+		edit->layout = build_layout (text_view, edit->row, edit->text, edit->cell_width, TRUE, TRUE);
 	}
 
 	if (!edit->button_down) {
@@ -2173,12 +2381,14 @@
 {
 	switch (info) {
 	case E_SELECTION_PRIMARY:
-		gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
-					8, edit->primary_selection, edit->primary_length);
+		gtk_selection_data_set (selection_data, UTF8_ATOM,
+					8, edit->primary_selection, 
+					edit->primary_length);
 		break;
 	case E_SELECTION_CLIPBOARD:
-		gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
-					8, edit->clipboard_selection, edit->clipboard_length);
+		gtk_selection_data_set (selection_data, UTF8_ATOM,
+					8, edit->clipboard_selection, 
+					edit->clipboard_length);
 		break;
 	}
 }
@@ -2191,7 +2401,9 @@
 		     guint time,
 		     CellEdit *edit)
 {
-	if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) {
+	if (selection_data->length < 0 || 
+			!(selection_data->type == UTF8_ATOM ||
+			selection_data->type == GDK_SELECTION_TYPE_STRING)) {
 		return;
 	} else {
 		ETextEventProcessorCommand command;
@@ -2212,11 +2424,11 @@
 		
 		gtk_selection_add_target (invisible,
 					  GDK_SELECTION_PRIMARY,
-					  GDK_SELECTION_TYPE_STRING,
+					  UTF8_ATOM,
 					  E_SELECTION_PRIMARY);
 		gtk_selection_add_target (invisible,
 					  clipboard_atom,
-					  GDK_SELECTION_TYPE_STRING,
+					  UTF8_ATOM,
 					  E_SELECTION_CLIPBOARD);
 		
 		g_signal_connect (invisible, "selection_get",
@@ -2273,7 +2485,7 @@
 	invisible = e_cell_text_view_get_invisible (edit);
 	gtk_selection_convert (invisible,
 			      selection,
-			      GDK_SELECTION_TYPE_STRING,
+			      UTF8_ATOM,
 			      time);
 #endif
 }
Index: gal/e-table/e-cell-text.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-text.h,v
retrieving revision 1.30
diff -u -r1.30 e-cell-text.h
--- gal/e-table/e-cell-text.h	18 Mar 2003 20:49:59 -0000	1.30
+++ gal/e-table/e-cell-text.h	25 Sep 2003 21:28:06 -0000
@@ -36,7 +36,7 @@
 
 #ifndef _E_CELL_TEXT_H_
 #define _E_CELL_TEXT_H_
-
+#include <gtk/gtkmenu.h>
 #include <libgnomecanvas/gnome-canvas.h>
 #include <gal/e-table/e-cell.h>
 
Index: gal/e-table/e-cell.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell.h,v
retrieving revision 1.36
diff -u -r1.36 e-cell.h
--- gal/e-table/e-cell.h	17 Nov 2002 00:02:53 -0000	1.36
+++ gal/e-table/e-cell.h	25 Sep 2003 21:28:06 -0000
@@ -59,7 +59,9 @@
 
 	E_CELL_EDITING        = 1 << 4,
 
-	E_CELL_CURSOR         = 1 << 5
+	E_CELL_CURSOR         = 1 << 5,
+
+	E_CELL_PREEDIT        = 1 << 6
 } ECellFlags;
 
 typedef enum {
Index: gal/e-table/e-table-item.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-item.c,v
retrieving revision 1.224
diff -u -r1.224 e-table-item.c
--- gal/e-table/e-table-item.c	13 Jun 2003 22:27:03 -0000	1.224
+++ gal/e-table/e-table-item.c	25 Sep 2003 21:28:06 -0000
@@ -2684,13 +2684,15 @@
 		case GDK_ISO_Enter:
 		case GDK_3270_Enter:
 			if (eti_editing (eti)){
-				e_table_item_leave_edit_(eti);
-#if 0
 				ecell_view = eti->cell_views [eti->editing_col];
 				return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time,
 							       view_to_model_col(eti, eti->editing_col),
-							       eti->editing_col, eti->editing_row, E_CELL_EDITING | E_CELL_CURSOR);
-#endif
+							       eti->editing_col, eti->editing_row, E_CELL_EDITING | E_CELL_CURSOR | E_CELL_PREEDIT);
+/*
+				e_table_item_leave_edit_(eti);
+*/
+				if(!return_val)
+					break;
 			}
 			g_signal_emit (eti, eti_signals [KEY_PRESS], 0,
 				       model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
Index: gal/e-table/e-table.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table.c,v
retrieving revision 1.225
diff -u -r1.225 e-table.c
--- gal/e-table/e-table.c	1 Jul 2003 13:16:43 -0000	1.225
+++ gal/e-table/e-table.c	25 Sep 2003 21:28:07 -0000
@@ -1099,14 +1099,22 @@
 table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
 {
 	GnomeCanvas *canvas;
+	ECanvas *ecanvas;
 	ETable *etable;
 
 	gtk_widget_queue_draw (widget);
+	canvas = GNOME_CANVAS (widget);
+	ecanvas = E_CANVAS (widget);
 
-	if (!event->in)
+	if (!event->in) {
+		gtk_im_context_focus_out(ecanvas->im_context);
+		ecanvas->focus_in = 0;
 		return TRUE;
+	} else {
+		ecanvas->focus_in = 1;
+		gtk_im_context_focus_in(ecanvas->im_context);
+	}
 
-	canvas = GNOME_CANVAS (widget);
 	etable = E_TABLE (data);
 
 	if (!canvas->focused_item && etable->group)
Index: gal/widgets/e-canvas.h
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/e-canvas.h,v
retrieving revision 1.17
diff -u -r1.17 e-canvas.h
--- gal/widgets/e-canvas.h	2 Apr 2003 05:46:33 -0000	1.17
+++ gal/widgets/e-canvas.h	25 Sep 2003 21:28:07 -0000
@@ -86,6 +86,7 @@
 
 	GtkWidget            *tooltip_window;
 	int                   visibility_notify_id;
+	int                   focus_in;
 	GtkWidget            *toplevel;
 
 	guint visibility_first : 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]