dnd: Add gdk_drag_action_is_unique()

This will be necessary once we remove the ASK action.
This commit is contained in:
Benjamin Otte 2018-05-12 00:13:11 +02:00
parent ac44353f9b
commit 74a8ffc4a8
3 changed files with 25 additions and 0 deletions

View File

@ -798,6 +798,9 @@ gdk_drag_context_get_dest_surface
gdk_drag_context_get_drag_surface
gdk_drag_context_set_hotspot
<SUBSECTION>
gdk_drag_action_is_unique
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
GDK_TYPE_DRAG_CONTEXT

View File

@ -876,3 +876,22 @@ gdk_drag_context_handle_dest_event (GdkEvent *event)
gdk_drag_context_commit_drag_status (context);
return TRUE;;
}
/**
* gdk_drag_action_is_unique:
* @action: a #GdkDragAction
*
* Checks if @action represents a single action or if it
* includes multiple flags that can be selected from.
*
* When @action is 0 - ie no action was given, %TRUE
* is returned.
*
* Returns: %TRUE if exactly one action was given
**/
GdkDragAction
gdk_drag_action_is_unique (GdkDragAction action)
{
return (action & (action - 1)) == 0;
}

View File

@ -97,6 +97,9 @@ GdkSurface *gdk_drag_context_get_source_surface (GdkDragContext *contex
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_drag_context_get_dest_surface (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_action_is_unique (GdkDragAction action);
/* Destination side */
GDK_AVAILABLE_IN_ALL
void gdk_drag_status (GdkDragContext *context,