[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and drop patch for X, please review.

From: Jan D.
Subject: Re: Drag and drop patch for X, please review.
Date: Mon, 19 Jan 2004 22:14:00 +0100

    If we know the target is a dired buffer, we can then accept the
    action that the source sends us (XdndActionCopy or XdndActionMove)
    instead of always using XdndActionPrivate and to the right thing
    for each action.

It should be easy to tell whether the buffer it was dropped into
is a Dired buffer.  But that is not the most elegant solution.

Is there a way that Dired mode could make a local variable binding,
or a local key binding, so as to control this?

I could add some more events or hooks at various points in the DND
protocol, but most DND protocols behave differently, so we would
probably get different behaviour when dropping with the XDND protocol
and when dropping with the Motif protocol.

Also, I don't want the protocols internals to be exposed too much, just
to be able to handle different protocols and future protocol changes better.

The way XDND works is basically it sends a XdndPosition to the target
(Emacs).  The XdndPosition contains the suggested action for the drop
(Move, Copy or Ask).  The target then reads available types for the drop
data, and determines if it wants to accept the suggested action, or
change it (Emacs always uses Private, which means, I'm doing something
that is special and don't affect the original data). The target answers with
a XdndStatus message which tells the source if the drop is accepted and
if accepted, the action the target will take.

Later on, the source sends a XdndDrop message.  Then the target can read
the drop data and replies with a XdndFinished message that tells the source
if the drop was successful or not.

Now, if the mouse moves from a ordinary buffer to a dired buffer,
we need to change the action in the XdndStatus message.  And if it moves
out of the dired buffer, the action must be changed again.

Probably some buffer local variable could be used to influence the
actions chosen, but that would mean that dired would have to have
knowledge on the DND protocol.  The TEST-FUN suggested could be extended
to take the proposed action and return the preferred action.  So then
the alist could be made buffer local for dired buffers.

The types text/uri-list, text/x-moz-url, FILE_NAME and _NETSCAPE_URL all
    can have file:// URLs.  text/uri-list is the one XDND and the
organization wants everybody to use. text/x-moz-url is used by mozilla
    and newer netscape.

In modern systems, do the directory browsers use text/uri-list?
If so, it is vital that Dired handle it right.

Yes, it is used by Gnome and KDE file browsers.

      If you have multiple windows in the
frame, it is hard to select the one the user intended.

What is the difficulty?  Can you tell the position at which the drop
occurred? If so, is it hard to find the window containing that position?

If the frame is split vertically and text is dropped on the menu bar, there
is a bit coordinate calculations to be made to determine which window
to use.  Not impossible, but quite elaborate for just a small benefit.
I kind of like the suggestion to push it in the kill buffer and display
a message about it.

        Jan D.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]