Hrvoje Niksic <hniksic(a)srce.hr> writes:
> Another possible is to add the button, mod and pos info into
the
> object list. dragdrop-drop-dispatch could then create a dummy
> button-xy event with the actual values (channel must also be stored
> in object) so the function can use the internal functions
> event-point (and others) to get the position in the buffer and the
> action the user wanted.
I don't understand this.
I think I have a solution. Do you think that this is evil:
- when I create the misc-user-event object (the dnd-data), I cons a reverence
to the event itself into it. So the function still has access to it's event.
And this is how it looks...
events.h defines misc_user_data as:
struct misc_user_data
{
Lisp_Object function;
Lisp_Object object;
int button;
unsigned char modifiers;
int x, y;
};
event-Xt does the following when a drop occurs (it's a nice reference
loop...):
XSETEVENT (lisp_event, emacs_event);
emacs_event->event.eval.function = Qdragdrop_drop_dispatch;
emacs_event->event.eval.object = Fcons ( lisp_event,
Fcons (l_type,
Fcons (l_dndlist, Qnil)));
now event-stream.c catchs the misc_user and does:
if (XEVENT (event)->event_type == misc_user_event)
{
call1 (XEVENT (event)->event.eval.function,
XEVENT (event)->event.eval.object);
}
This calls dragdrop-drop-dispatch which is defined as:
(defun dragdrop-drop-dispatch (object)
(let ((event (car object))
(data (cdr object)))
(message "drop at %d,%d; type %d; data '%s'"
(event-x event)
(event-y event)
(car data)
(cadr data))))
And voila: I see the info of the drag in the minibuffer.
Is the loop reference evil? It seems to work fine...
Regards,
Oliver.