Implement gdk_drag_context_{get,set}_device in Quartz backend

This commit is contained in:
Kristian Rietveld 2010-06-29 13:10:44 +02:00
parent 95a1c31c18
commit 03a313d2a9
2 changed files with 51 additions and 0 deletions

View File

@ -87,6 +87,56 @@ gdk_drag_context_new (void)
return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
}
/**
* gdk_drag_context_set_device:
* @context: a #GdkDragContext
* @device: a #GdkDevice
*
* Associates a #GdkDevice to @context, so all Drag and Drop events
* for @context are emitted as if they came from this device.
**/
void
gdk_drag_context_set_device (GdkDragContext *context,
GdkDevice *device)
{
GdkDragContextPrivate *private;
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (GDK_IS_DEVICE (device));
private = GDK_DRAG_CONTEXT_PRIVATE (context);
if (private->device)
{
g_object_unref (private->device);
private->device = NULL;
}
if (device)
private->device = g_object_ref (device);
}
/**
* gdk_drag_context_get_device:
* @context: a #GdkDragContext
*
* Returns the #GdkDevice associated to the drag context.
*
* Returns: The #GdkDevice associated to @context.
**/
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context)
{
GdkDragContextPrivate *private;
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
private = GDK_DRAG_CONTEXT_PRIVATE (context);
return private->device;
}
GdkDragContext *_gdk_quartz_drag_source_context = NULL;
GdkDragContext *

View File

@ -94,6 +94,7 @@ struct _GdkCursorPrivate
struct _GdkDragContextPrivate
{
id <NSDraggingInfo> dragging_info;
GdkDevice *device;
};
extern GdkDisplay *_gdk_display;