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
This commit is contained in:
parent
71bcecbc8d
commit
bfad7693bf
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user