gdk/wayland: Emit GDK_SELECTION_NOTIFY on all failure/unset paths
Either on failure, or when replacing a selection buffer due to a new wl_offer. We should emit one event for each pending requestor then.
This commit is contained in:
@@ -114,6 +114,9 @@ struct _GdkWaylandSelection
|
||||
static void selection_buffer_read (SelectionBuffer *buffer);
|
||||
static void async_write_data_write (AsyncWriteData *write_data);
|
||||
static void emit_selection_clear (GdkDisplay *display, GdkAtom selection);
|
||||
static void emit_empty_selection_notify (GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target);
|
||||
|
||||
static void
|
||||
selection_buffer_notify (SelectionBuffer *buffer)
|
||||
@@ -168,11 +171,22 @@ selection_buffer_ref (SelectionBuffer *buffer)
|
||||
static void
|
||||
selection_buffer_unref (SelectionBuffer *buffer_data)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
buffer_data->ref_count--;
|
||||
|
||||
if (buffer_data->ref_count != 0)
|
||||
return;
|
||||
|
||||
for (l = buffer_data->requestors; l; l = l->next)
|
||||
{
|
||||
emit_empty_selection_notify (l->data, buffer_data->selection,
|
||||
buffer_data->target);
|
||||
}
|
||||
|
||||
g_list_free (buffer_data->requestors);
|
||||
buffer_data->requestors = NULL;
|
||||
|
||||
if (buffer_data->cancellable)
|
||||
g_object_unref (buffer_data->cancellable);
|
||||
|
||||
@@ -1313,7 +1327,10 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
|
||||
selection_data = selection_lookup_offer_by_atom (wayland_selection, selection);
|
||||
if (!selection_data)
|
||||
return;
|
||||
{
|
||||
emit_empty_selection_notify (requestor, selection, target);
|
||||
return;
|
||||
}
|
||||
|
||||
offer = gdk_wayland_selection_get_offer (display, selection);
|
||||
target_list = gdk_wayland_selection_get_targets (display, selection);
|
||||
|
||||
Reference in New Issue
Block a user