Prima

 view release on metacpan or  search on metacpan

unix/dnd.c  view on Meta::CPAN

#include "unix/guts.h"
#include "Window.h"
#include "Application.h"

/* See specs at https://www.freedesktop.org/wiki/Specifications/XDND/ */

#define dndAsk 0x100

static int
xdnd_atom_to_constant( Atom atom )
{
	if ( atom == XdndActionMove)
		return dndMove;
	else if ( atom == XdndActionCopy)
	      return dndCopy;
	else if ( atom == XdndActionLink)
	      return dndLink;
	else if ( atom == XdndActionAsk)
	      return dndAsk;
	return dndNone;
}

static int
xdnd_constant_to_atom( int cmd )
{
	switch ( cmd ) {
	case dndCopy   : return XdndActionCopy;
	case dndMove   : return XdndActionMove;
	case dndLink   : return XdndActionLink;
	case dndAsk    : return XdndActionAsk;
	default        : return None;
	}
}

static XWindow
query_xdnd_target(XWindow w)
{
	Bool found = false;
	XWindow foo, child;
	unsigned mask;
	int i, bar, nprops;
	Atom *atoms;

	atoms = XListProperties(DISP, w, &nprops);
	for (i = 0; i < nprops; i++)
		if (atoms[i] == XdndAware) {
			found = true;
			break;
		}
	if ( nprops) XFree(atoms);
	if ( found ) return w;

	if ( !XQueryPointer( DISP, w, &foo, &child, &bar, &bar, &bar, &bar, &mask))
		return None;
	if ( child == None )
		return None;
	return query_xdnd_target(child);
}

static int
query_pointer(XWindow * receiver, Point *p)
{
	XWindow foo;
	int bar, x, y, ret;
	unsigned mask;



( run in 2.299 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )