viewSelector: Don't reset the search entry if it has preedit text
If users click outside the search entry while it's empty we reset and thus give up key focus. This means that when using an input method with candidate popups, interacting with the popup with a mouse click cancels the current input method context if there's no other text in the entry besides the preedit string. To avoid this we can check if the entry has preedit in addition to checking if it has normal text. https://bugzilla.gnome.org/show_bug.cgi?id=745167
This commit is contained in:
@ -67,6 +67,7 @@ struct _StIMTextPrivate
|
||||
GdkWindow *window;
|
||||
|
||||
guint need_im_reset : 1;
|
||||
guint has_preedit : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (StIMText, st_im_text, CLUTTER_TYPE_TEXT)
|
||||
@ -136,6 +137,8 @@ st_im_text_preedit_changed_cb (GtkIMContext *context,
|
||||
preedit_attrs,
|
||||
cursor_pos);
|
||||
|
||||
imtext->priv->has_preedit = preedit_str && *preedit_str;
|
||||
|
||||
g_free (preedit_str);
|
||||
pango_attr_list_unref (preedit_attrs);
|
||||
}
|
||||
@ -622,3 +625,17 @@ st_im_text_get_input_hints (StIMText *imtext)
|
||||
|
||||
return hints;
|
||||
}
|
||||
|
||||
/**
|
||||
* st_im_text_has_preedit:
|
||||
* @imtext: a #StIMText
|
||||
*
|
||||
* Returns: wether @imtext currently has preedit text
|
||||
*/
|
||||
gboolean
|
||||
st_im_text_has_preedit (StIMText *imtext)
|
||||
{
|
||||
g_return_val_if_fail (ST_IS_IM_TEXT (imtext), FALSE);
|
||||
|
||||
return imtext->priv->has_preedit;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ GtkInputPurpose st_im_text_get_input_purpose (StIMText *imtext);
|
||||
void st_im_text_set_input_hints (StIMText *imtext,
|
||||
GtkInputHints hints);
|
||||
GtkInputHints st_im_text_get_input_hints (StIMText *imtext);
|
||||
gboolean st_im_text_has_preedit (StIMText *imtext);
|
||||
|
||||
void st_im_text_set_event_window (GdkWindow *window);
|
||||
|
||||
|
Reference in New Issue
Block a user