emojichooser: Avoid extra work

When selecting an emoji in the recent section, there is no need
to add it to the recent section again. This avoids a sequence of
unfortunate events, where we reconstruct the entire recent section,
thereby removing the focus child, causing the focus to revert to
the entry, causing the entry to select the entire text. In the
case of Ctrl-clicking to select multiple Emoji, the effect is that
the section Emoji will replace the entire entry text, which is
suprising and unintended.

Fixes: #6336
This commit is contained in:
Matthias Clasen
2024-08-31 16:24:52 -04:00
parent c9bbf5820b
commit 5c6fedae17

View File

@@ -452,7 +452,8 @@ emoji_activated (GtkFlowBox *box,
item = (GVariant*) g_object_get_data (G_OBJECT (child), "emoji-data");
modifier = (gunichar) GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (child), "modifier"));
add_recent_item (chooser, item, modifier);
if ((GtkWidget *) box != chooser->recent.box)
add_recent_item (chooser, item, modifier);
g_signal_emit (data, signals[EMOJI_PICKED], 0, text);
g_free (text);