entry completion: Stop using ::focus-out-event

We can just use ::event.
This commit is contained in:
Matthias Clasen 2018-01-06 12:03:30 -05:00
parent 8c6c2be316
commit 253ac15928

View File

@ -2566,6 +2566,19 @@ completion_insert_text_callback (GtkEntry *entry,
}
}
static gboolean
maybe_accept_completion (GtkEntry *entry,
GdkEvent *event)
{
gboolean focus_in;
if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE &&
gdk_event_get_focus_in (event, &focus_in) && !focus_in)
accept_completion_callback (entry);
return GDK_EVENT_PROPAGATE;
}
static void
connect_completion_signals (GtkEntryCompletion *completion)
{
@ -2582,8 +2595,8 @@ connect_completion_signals (GtkEntryCompletion *completion)
G_CALLBACK (clear_completion_callback), completion);
g_signal_connect (completion->priv->entry, "activate",
G_CALLBACK (accept_completion_callback), completion);
g_signal_connect (completion->priv->entry, "focus-out-event",
G_CALLBACK (accept_completion_callback), completion);
g_signal_connect (completion->priv->entry, "event",
G_CALLBACK (maybe_accept_completion), completion);
}
static void
@ -2643,6 +2656,8 @@ disconnect_completion_signals (GtkEntryCompletion *completion)
G_CALLBACK (clear_completion_callback), completion);
g_signal_handlers_disconnect_by_func (completion->priv->entry,
G_CALLBACK (accept_completion_callback), completion);
g_signal_handlers_disconnect_by_func (completion->priv->entry,
G_CALLBACK (maybe_accept_completion), completion);
}
void