[gtk/gtk-3-24: 3/13] emojichooser: Allow inserting multiple Emoji
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 3/13] emojichooser: Allow inserting multiple Emoji
- Date: Fri, 14 May 2021 00:42:05 +0000 (UTC)
commit bfad7693bfeb483929047fcd32a4837fc7ffbeb5
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 1 23:35:06 2020 -0400
emojichooser: Allow inserting multiple Emoji
Don't close the Emoji chooser when the Control
key is held while clicking. So you can insert
multiple Emoji without having to reopen the
chooser every time.
Fixes: #1002
gtk/gtkemojichooser.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 1aa7c445df..e3538b10ca 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -220,6 +220,23 @@ add_recent_item (GtkEmojiChooser *chooser,
g_variant_unref (item);
}
+static gboolean
+should_close (GtkEmojiChooser *chooser)
+{
+ GdkDisplay *display;
+ GdkSeat *seat;
+ GdkDevice *device;
+ GdkModifierType state;
+
+ display = gtk_widget_get_display (GTK_WIDGET (chooser));
+ seat = gdk_display_get_default_seat (display);
+ device = gdk_seat_get_pointer (seat);
+ gdk_device_get_state (device, gtk_widget_get_window (GTK_WIDGET (chooser)),
+ NULL, &state);
+
+ return (state & GDK_CONTROL_MASK) == 0;
+}
+
static void
emoji_activated (GtkFlowBox *box,
GtkFlowBoxChild *child,
@@ -232,7 +249,16 @@ emoji_activated (GtkFlowBox *box,
GVariant *item;
gunichar modifier;
- gtk_popover_popdown (GTK_POPOVER (chooser));
+ if (should_close (chooser))
+ gtk_popover_popdown (GTK_POPOVER (chooser));
+ else
+ {
+ GtkWidget *popover;
+
+ popover = gtk_widget_get_ancestor (GTK_WIDGET (box), GTK_TYPE_POPOVER);
+ if (popover != GTK_WIDGET (chooser))
+ gtk_popover_popdown (GTK_POPOVER (popover));
+ }
ebox = gtk_bin_get_child (GTK_BIN (child));
label = gtk_bin_get_child (GTK_BIN (ebox));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]