gnumeric r16874 - in trunk: . src
- From: jody svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16874 - in trunk: . src
- Date: Sun, 12 Oct 2008 14:17:12 +0000 (UTC)
Author: jody
Date: Sun Oct 12 14:17:12 2008
New Revision: 16874
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16874&view=rev
Log:
2008-10-10 Jody Goldberg <jody gnome org>
* src/gnm-pane.c (cb_gnm_pane_preedit_changed) :
s/reseting_im/im_block_edit_start/ to clarify the intent, and to
reuse it for the initial focus problem.
(gnm_pane_key_press) : move the explainitory comment here, where we
toggle im_block_edit_start rather than below when it happens.
(gnm_pane_focus_in) : use it here too with the new im_first_focus.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/src/gnm-pane-impl.h
trunk/src/gnm-pane.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sun Oct 12 14:17:12 2008
@@ -38,6 +38,7 @@
* Fix OO.o style import. [#553506]
* Support XLSX themed colours. [#555687]
* Restore the undocumented magic for solid fills in XLSX conditions.
+ * Work around gtk behavior change in IMContext initialization.
J.H.M. Dassen (Ray):
* Understand and ignore byte-order markers for CSV/stf probing and
Modified: trunk/src/gnm-pane-impl.h
==============================================================================
--- trunk/src/gnm-pane-impl.h (original)
+++ trunk/src/gnm-pane-impl.h Sun Oct 12 14:17:12 2008
@@ -30,14 +30,13 @@
gboolean sliding_adjacent_h, sliding_adjacent_v;
/* IM */
- guint reseting_im :1; /* quick hack to keep gtk_im_context_reset from starting an edit */
- guint preedit_length;
+ guint im_block_edit_start :1; /* see gnm_pane_key_press for details */
+ guint im_first_focus :1; /* see gnm_pane_init for details */
+ guint preedit_length;
GtkIMContext *im_context;
PangoAttrList *preedit_attrs;
- gboolean insert_decimal;
-
-
+ gboolean insert_decimal;
int index;
struct {
Modified: trunk/src/gnm-pane.c
==============================================================================
--- trunk/src/gnm-pane.c (original)
+++ trunk/src/gnm-pane.c Sun Oct 12 14:17:12 2008
@@ -585,11 +585,15 @@
event->keyval == GDK_KP_Decimal ||
event->keyval == GDK_KP_Separator;
- if (gtk_im_context_filter_keypress (pane->im_context,event))
+ if (gtk_im_context_filter_keypress (pane->im_context, event))
return TRUE;
- pane->reseting_im = TRUE;
+
+ /* in gtk-2.8 something changed. gtk_im_context_reset started
+ * triggering a pre-edit-changed. We'd end up start and finishing an
+ * empty edit every time the cursor moved */
+ pane->im_block_edit_start = TRUE;
gtk_im_context_reset (pane->im_context);
- pane->reseting_im = FALSE;
+ pane->im_block_edit_start = FALSE;
if (gnm_pane_key_mode_sheet (pane, event, allow_rangesel))
return TRUE;
@@ -606,7 +610,7 @@
if (pane->simple.scg->grab_stack > 0)
return TRUE;
- if (gtk_im_context_filter_keypress (pane->im_context,event))
+ if (gtk_im_context_filter_keypress (pane->im_context, event))
return TRUE;
/*
* The status_region normally displays the current edit_pos
@@ -626,7 +630,17 @@
gnm_pane_focus_in (GtkWidget *widget, GdkEventFocus *event)
{
#ifndef GNM_USE_HILDON
+ /* The first call to focus-in was sometimes the first thing to init the
+ * imcontext. In which case the im_context_focus_in would fire a
+ * preedit-changed, and we would start editing. */
+ GnmPane *pane = GNM_PANE (widget);
+ if (pane->im_first_focus)
+ pane->im_block_edit_start = TRUE;
gtk_im_context_focus_in (GNM_PANE (widget)->im_context);
+ if (pane->im_first_focus) {
+ pane->im_first_focus = FALSE;
+ pane->im_block_edit_start = FALSE;
+ }
#endif
return (*GTK_WIDGET_CLASS (parent_klass)->focus_in_event) (widget, event);
}
@@ -731,10 +745,7 @@
pango_attr_list_unref (pane->preedit_attrs);
gtk_im_context_get_preedit_string (pane->im_context, &preedit_string, &pane->preedit_attrs, &cursor_pos);
- /* in gtk-2.8 something changed. gtk_im_context_reset started
- * triggering a pre-edit-changed. We'd end up start and finishing an
- * empty edit every time the cursor moved */
- if (!pane->reseting_im &&
+ if (!pane->im_block_edit_start &&
!wbcg_is_editing (wbcg) && !wbcg_edit_start (wbcg, TRUE, TRUE)) {
gtk_im_context_reset (pane->im_context);
pane->preedit_length = 0;
@@ -909,8 +920,9 @@
pane->im_context = gtk_im_multicontext_new ();
pane->preedit_length = 0;
- pane->preedit_attrs = NULL;
- pane->reseting_im = FALSE;
+ pane->preedit_attrs = NULL;
+ pane->im_block_edit_start = FALSE;
+ pane->im_first_focus = TRUE;
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_DEFAULT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]