mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-08 03:30:17 +00:00
text: Delete selection when preedit starts
This prevents confusing misrendering when the preedit text pushes the selection text out of the rendered selection. Fixes: #1123
This commit is contained in:
parent
feccdad9d2
commit
447203ce52
@ -418,6 +418,8 @@ static void direction_changed (GdkDevice *keyboard,
|
|||||||
static void gtk_text_commit_cb (GtkIMContext *context,
|
static void gtk_text_commit_cb (GtkIMContext *context,
|
||||||
const char *str,
|
const char *str,
|
||||||
GtkText *self);
|
GtkText *self);
|
||||||
|
static void gtk_text_preedit_start_cb (GtkIMContext *context,
|
||||||
|
GtkText *self);
|
||||||
static void gtk_text_preedit_changed_cb (GtkIMContext *context,
|
static void gtk_text_preedit_changed_cb (GtkIMContext *context,
|
||||||
GtkText *self);
|
GtkText *self);
|
||||||
static gboolean gtk_text_retrieve_surrounding_cb (GtkIMContext *context,
|
static gboolean gtk_text_retrieve_surrounding_cb (GtkIMContext *context,
|
||||||
@ -1843,6 +1845,8 @@ gtk_text_init (GtkText *self)
|
|||||||
*/
|
*/
|
||||||
priv->im_context = gtk_im_multicontext_new ();
|
priv->im_context = gtk_im_multicontext_new ();
|
||||||
|
|
||||||
|
g_signal_connect (priv->im_context, "preedit-start",
|
||||||
|
G_CALLBACK (gtk_text_preedit_start_cb), self);
|
||||||
g_signal_connect (priv->im_context, "commit",
|
g_signal_connect (priv->im_context, "commit",
|
||||||
G_CALLBACK (gtk_text_commit_cb), self);
|
G_CALLBACK (gtk_text_commit_cb), self);
|
||||||
g_signal_connect (priv->im_context, "preedit-changed",
|
g_signal_connect (priv->im_context, "preedit-changed",
|
||||||
@ -4150,6 +4154,13 @@ direction_changed (GdkDevice *device,
|
|||||||
/* IM Context Callbacks
|
/* IM Context Callbacks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_text_preedit_start_cb (GtkIMContext *context,
|
||||||
|
GtkText *self)
|
||||||
|
{
|
||||||
|
gtk_text_delete_selection (self);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_commit_cb (GtkIMContext *context,
|
gtk_text_commit_cb (GtkIMContext *context,
|
||||||
const char *str,
|
const char *str,
|
||||||
|
Loading…
Reference in New Issue
Block a user