56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
/*
|
|
* dragcommon.c — backend-neutral DnD helpers.
|
|
*
|
|
* X11-specific XDND code has moved to dragcommon_x11.c. This file
|
|
* holds only the parts that don't touch a windowing system: array
|
|
* accessors and free-on-view-destroy bookkeeping.
|
|
*/
|
|
|
|
#include "wconfig.h"
|
|
#include "WINGsP.h"
|
|
|
|
static void freeDragOperationItem(void *item)
|
|
{
|
|
wfree(item);
|
|
}
|
|
|
|
WMArray *WMCreateDragOperationArray(int initialSize)
|
|
{
|
|
return WMCreateArrayWithDestructor(initialSize, freeDragOperationItem);
|
|
}
|
|
|
|
WMDragOperationItem *WMCreateDragOperationItem(WMDragOperationType type, char *text)
|
|
{
|
|
W_DragOperationItem *result = wmalloc(sizeof(W_DragOperationItem));
|
|
|
|
result->type = type;
|
|
result->text = text;
|
|
|
|
return (WMDragOperationItem *) result;
|
|
}
|
|
|
|
WMDragOperationType WMGetDragOperationItemType(WMDragOperationItem * item)
|
|
{
|
|
return ((W_DragOperationItem *) item)->type;
|
|
}
|
|
|
|
char *WMGetDragOperationItemText(WMDragOperationItem * item)
|
|
{
|
|
return ((W_DragOperationItem *) item)->text;
|
|
}
|
|
|
|
/* called in destroyView (wview.c) */
|
|
void W_FreeViewXdndPart(WMView * view)
|
|
{
|
|
WMUnregisterViewDraggedTypes(view);
|
|
|
|
if (view->dragSourceProcs)
|
|
wfree(view->dragSourceProcs);
|
|
|
|
if (view->dragDestinationProcs)
|
|
wfree(view->dragDestinationProcs);
|
|
|
|
if (view->dragImage)
|
|
WMReleasePixmap(view->dragImage);
|
|
}
|