forked from AuroraMiddleware/gtk
dnd: Remove GdkDragContext::commit_drag_status() vfunc
The idea behind the vfunc doesn't work as status updates can happen asynchronously. A better solution needs to be found.
This commit is contained in:
parent
b00609c21c
commit
4b85b5299a
36
gdk/gdkdnd.c
36
gdk/gdkdnd.c
@ -864,42 +864,6 @@ gdk_drag_get_cursor (GdkDragContext *context,
|
||||
return drag_cursors[i].cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_commit_drag_status (GdkDragContext *context)
|
||||
{
|
||||
GdkDragContextClass *context_class;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (!context->is_source);
|
||||
|
||||
context_class = GDK_DRAG_CONTEXT_GET_CLASS (context);
|
||||
|
||||
if (context_class->commit_drag_status)
|
||||
context_class->commit_drag_status (context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_drag_context_handle_dest_event (GdkEvent *event)
|
||||
{
|
||||
GdkDragContext *context = NULL;
|
||||
|
||||
switch ((guint) event->any.type)
|
||||
{
|
||||
case GDK_DRAG_MOTION:
|
||||
case GDK_DROP_START:
|
||||
context = event->dnd.context;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!context)
|
||||
return FALSE;
|
||||
|
||||
gdk_drag_context_commit_drag_status (context);
|
||||
return TRUE;;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_action_is_unique:
|
||||
* @action: a #GdkDragAction
|
||||
|
@ -58,8 +58,6 @@ struct _GdkDragContextClass {
|
||||
const GdkEvent *event);
|
||||
void (*action_changed) (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
|
||||
void (*commit_drag_status) (GdkDragContext *context);
|
||||
};
|
||||
|
||||
struct _GdkDragContext {
|
||||
@ -86,7 +84,6 @@ void gdk_drag_context_set_actions (GdkDragContext *context,
|
||||
void gdk_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason);
|
||||
gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
|
||||
gboolean gdk_drag_context_handle_dest_event (GdkEvent *event);
|
||||
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
|
||||
|
@ -169,9 +169,6 @@ _gdk_event_emit (GdkEvent *event)
|
||||
|
||||
if (_gdk_event_func)
|
||||
(*_gdk_event_func) (event, _gdk_event_data);
|
||||
|
||||
if (gdk_drag_context_handle_dest_event (event))
|
||||
return;
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
|
@ -161,20 +161,15 @@ gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
|
||||
/* Destination side */
|
||||
|
||||
static void
|
||||
gdk_wayland_drop_context_set_status (GdkDragContext *context,
|
||||
gboolean accepted)
|
||||
gdk_wayland_drop_context_set_status (GdkWaylandDragContext *context_wayland,
|
||||
gboolean accepted)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
|
||||
if (!context->dest_surface)
|
||||
return;
|
||||
|
||||
if (accepted)
|
||||
{
|
||||
const char *const *mimetypes;
|
||||
gsize i, n_mimetypes;
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_mimetypes);
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drop_get_formats (GDK_DROP (context_wayland)), &n_mimetypes);
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
{
|
||||
if (mimetypes[i] != g_intern_static_string ("DELETE"))
|
||||
@ -192,13 +187,12 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_commit_status (GdkDragContext *context)
|
||||
gdk_wayland_drag_context_commit_status (GdkWaylandDragContext *wayland_context)
|
||||
{
|
||||
GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDisplay *display;
|
||||
uint32_t dnd_actions, all_actions = 0;
|
||||
|
||||
display = gdk_device_get_display (gdk_drag_context_get_device (context));
|
||||
display = gdk_drop_get_display (GDK_DROP (wayland_context));
|
||||
|
||||
dnd_actions = gdk_to_wl_actions (wayland_context->selected_action);
|
||||
|
||||
@ -211,7 +205,7 @@ gdk_wayland_drag_context_commit_status (GdkDragContext *context)
|
||||
WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION)
|
||||
wl_data_offer_set_actions (wayland_context->offer, all_actions, dnd_actions);
|
||||
|
||||
gdk_wayland_drop_context_set_status (context, wayland_context->selected_action != 0);
|
||||
gdk_wayland_drop_context_set_status (wayland_context, wayland_context->selected_action != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -222,6 +216,8 @@ gdk_wayland_drag_context_status (GdkDrop *drop,
|
||||
|
||||
wayland_context = GDK_WAYLAND_DRAG_CONTEXT (drop);
|
||||
wayland_context->selected_action = action;
|
||||
|
||||
gdk_wayland_drag_context_commit_status (wayland_context);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -234,7 +230,7 @@ gdk_wayland_drag_context_finish (GdkDrop *drop,
|
||||
|
||||
if (action)
|
||||
{
|
||||
gdk_wayland_drag_context_commit_status (GDK_DRAG_CONTEXT (drop));
|
||||
gdk_wayland_drag_context_commit_status (wayland_context);
|
||||
|
||||
if (display_wayland->data_device_manager_version >=
|
||||
WL_DATA_OFFER_FINISH_SINCE_VERSION)
|
||||
@ -414,7 +410,6 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
|
||||
context_class->action_changed = gdk_wayland_drag_context_action_changed;
|
||||
context_class->drop_performed = gdk_wayland_drag_context_drop_performed;
|
||||
context_class->cancel = gdk_wayland_drag_context_cancel;
|
||||
context_class->commit_drag_status = gdk_wayland_drag_context_commit_status;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user