Hrvoje Niksic <hniksic(a)srce.hr> writes:
> > > This can be displayed (inserted, etc.) by this
function. I'm now
> > > adding the needed button information to the misc_user_event. I
> > > hope this will not break anything.
> >
> > > There are actually two ways to do this:
> > > a) hardcode them into the misc_user and make the event-x,
> > > event-button, etc. function recognize this (the easy way).
Could you please elaborate on this? I'm afraid I didn't catch all the
context.
What I have done in the last hours is the following:
- I removed the extra drag and drop events
- I made the OffiX drop catcher in event-Xt.c generate misc-user-events
with a function of dragdrop-drop-dispatcher and the dnd-data as object.
This runs fine (now with egcs -O3 -mpentium -- without -fno-caller-saves).
But to make the thing really work, the function called
(dragdrop-drop-dispatch) must have access to the position, button, and
modifiers where the drop happened. The question is where to put them to get
the easiest transition to the new model (and without breaking existing stuff
using misc_user_event).
Extending the misc_user_data by the data provided in a button_data is not
enough. If I do it this way, I must change the way XEmacs calls
misc_user_events from
/* this is from event-stream.c */
if (XEVENT (event)->event_type == misc_user_event)
{
call1 (XEVENT (event)->event.eval.function,
XEVENT (event)->event.eval.object);
}
to
if (XEVENT (event)->event_type == misc_user_event)
{
call2 (XEVENT (event)->event.misc.function,
XEVENT (event)->event.misc.object,
event);
}
But I thing this is evil and would certainly break something (perhaps I can
create a workaround by setting for example the button value of a non-dragdrop
misc_user_event to -1. So I can base the decision how to call the thing on
this).
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.
To pinpoint the whole thing again:
A drop needs to know where it happened to create the correct reaction (insert
the text, change a value in customize, create a new buffer, etc...), perhaps
by using properties of an underlying extent (if the drop happened within it).
But perhaps there is some other way?
Regards,
Oliver.