diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-08-05 19:31:52 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-08-05 19:31:52 -0400 |
commit | 642aee75d53ad3a08c8e9d648eb99bcce7bd55b9 (patch) | |
tree | a2d6f9f6a3ff26d6daa6be8416c03c540fcc7ed8 /gtk/gtkimcontextsimple.c | |
parent | c250dddb003414dfe827873497ae51267e995b0a (diff) | |
download | gtk+-642aee75d53ad3a08c8e9d648eb99bcce7bd55b9.tar.gz |
Enough with the beeping!
Don't beep when modifiers are released in entries.
This was an inadvertent change that snuck in with
the emoji support.
Also, don't beep while entering an emoji name.
There is entirely too much beeping here.
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r-- | gtk/gtkimcontextsimple.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index e5efdbbe4d..c83e0495dc 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -963,6 +963,7 @@ check_emoji (GtkIMContextSimple *context_simple, gint i; gchar buf[7]; char *lower; + gboolean has_completion; priv->tentative_match = 0; priv->tentative_match_len = 0; @@ -979,9 +980,6 @@ check_emoji (GtkIMContextSimple *context_simple, if (ch == 0) return FALSE; - if (priv->in_hex_sequence && !g_unichar_isxdigit (ch)) - return FALSE; - buf[g_unichar_to_utf8 (ch, buf)] = '\0'; g_string_append (str, buf); @@ -991,6 +989,7 @@ check_emoji (GtkIMContextSimple *context_simple, lower = g_utf8_strdown (str->str, str->len); + has_completion = FALSE; for (i = 0; emoji[i].name; i++) { if (strcmp (str->str, emoji[i].name) == 0 || @@ -1000,12 +999,19 @@ check_emoji (GtkIMContextSimple *context_simple, priv->tentative_match_len = n_compose; break; } + + if (!has_completion && + (g_str_has_prefix (emoji[i].name, str->str) || + g_str_has_prefix (emoji[i].name, lower))) + { + has_completion = TRUE; + } } g_string_free (str, TRUE); g_free (lower); - return priv->tentative_match != 0; + return priv->tentative_match != 0 || has_completion; } static void @@ -1177,7 +1183,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context, { priv->modifiers_dropped = TRUE; } - else + else if (priv->in_hex_sequence) { /* invalid hex sequence */ beep_window (event->window); |