unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
Subject: Re: Drag and drop patch for X, please review.
Date: Tue, 20 Jan 2004 22:27:58 +0100	[thread overview]
Message-ID: <849323AA-4B8F-11D8-A2D5-00039363E640@swipnet.se> (raw)
In-Reply-To: <jwvfzeae3he.fsf-monnier+emacs/devel@asado.iro.umontreal.ca>


2004-01-20 kl. 22.12 skrev Stefan Monnier:

>> Later when the mouse moves, the source sends XdndPosition messages,
>> which among other things, contains the suggested action the source
>> wants to do. The target replies with XdndStatus messages.  The answer
>> contains among other things, the action the target wants to perform 
>> (copy,
>> move, private) and if it is acceptable to drop where the mouse is 
>> currently.
>
> Why does the source app send XdndPosition (rather than the target app
> keeping track of mouse movements) ?  Is suh an XdndPosition message 
> sent
> every time the mouse moves within the target's window ?
> What is the purpose of the XdndStatus message?  I.e. how does the 
> source
> use this information?  I can see its usefulness once the drop actually
> takes place, but during dragging I can't think of anything useful the
> source could do with it.

To simplify for the target.  It may also be that there are several
pointer devices (indeed, on my laptop, I can use three mice at the same
time), and the target can not know which one is used.
Also if for example, a press on a shift key while dragging means move,
and unshifted means copy, the source must inform
the target that the action has changed.  There is an optimization
where the target in the XdndStatus message tells the source not to
send XdndPosition when the mouse is inside a given rectangle.  But
the target must be prepared to accept XdndPositions anyway, the source
is free to ignore the given rectangle (which indeed GTK does,  Qt honors
the rectangle).

XdndStatus tells the source if the drop is accepted, and the above 
mentioned
rectangle.  The source uses the accept/reject status to change the
icon that is being dragged so the user can visually see if drop is
accepted or rejected where the mouse is now.  Also, if the mouse button 
is
released and the last XdndStatus said reject, the source usually does a 
bit
of animation so the dragged icon is "snapped back" to where the drag
started.

>
>> So if the mouse travels from the menu bar, to the tool bar, to a read
>> only buffer, to an ordinary buffer, and then to a dired buffer, and 
>> then
>> we do the drop, Emacs must send XdndStatus messages back to the source
>> with different actions in them.
>
> What happens if it just always sends some dummy XdndStatus message 
> instead?
> What happens if it waits for the button-release before sending any 
> XdndStatus?

If we don't send any XdndStatus, the source will conclude that the
target can not accept any drop whatsoever, and never send the XdndDrop
message.  A dummy is no good, we at least needs to set accept/reject
correctly.  The target does not get any button release info, the mouse
is grabbed by the source.  The only indication the target gets about
button release is the XdndDrop message, or an XdndLeave message if the
drop was rejected by the last XdndStatus message.

>
>>> Obviously, if there's no binding for the drop event at the drop 
>>> location,
>>> you should not accept the drop action.  So view-mode could explicily
>>> unbind the drop event, for example.
>
>> As can be seen above, we need to know this before the drop occurs.
>
> That's OK: we can lookup keymaps during the drag to figure out whether
> dnd-drop is bound at the location under the mouse.

That is true.

	Jan D.

  reply	other threads:[~2004-01-20 21:27 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-17 16:35 Drag and drop patch for X, please review Jan D.
2004-01-17 20:20 ` David Kastrup
2004-01-18 20:22   ` Jan D.
2004-01-18 21:50     ` Kim F. Storm
2004-01-18 21:09       ` Jan D.
2004-01-18  0:40 ` Miles Bader
2004-01-18 20:44   ` Jan D.
2004-01-18 21:34     ` Kai Grossjohann
2004-01-18 21:55       ` Jan D.
2004-01-18 23:08         ` Miles Bader
2004-01-19 20:12           ` Richard Stallman
2004-01-19 20:43           ` Jan D.
2004-01-20  2:34             ` Miles Bader
2004-01-19 20:49           ` Jan D.
2004-01-18 22:10     ` Kim F. Storm
2004-01-18 21:14       ` Jan D.
2004-01-19 18:24     ` Stefan Monnier
2004-01-19 20:47       ` Jan D.
2004-01-19 23:35         ` Jason Rumney
2004-01-19 23:50           ` Jan D.
2004-01-20 15:52         ` Stefan Monnier
2004-01-20 16:05           ` Jan D.
2004-01-20 18:41             ` Stefan Monnier
2004-01-20 20:50               ` Jan D.
2004-01-20 21:12                 ` Stefan Monnier
2004-01-20 21:27                   ` Jan D. [this message]
2004-01-20 22:09                     ` Stefan Monnier
2004-01-20 22:28                       ` Jan D.
2004-01-20 23:38                         ` Stefan Monnier
2004-01-21 21:08                 ` Richard Stallman
2004-01-21 22:30                   ` Jan D.
2004-01-22 10:19                     ` Kim F. Storm
2004-01-22  9:46                       ` Jan D.
2004-01-22 11:32                         ` Kim F. Storm
2004-01-23 18:25                         ` Richard Stallman
2004-01-23 20:05                           ` Jan D.
2004-01-24 21:39                             ` Richard Stallman
2004-01-18 19:14 ` Richard Stallman
2004-01-18 21:02   ` Jan D.
2004-01-19 20:12     ` Richard Stallman
2004-01-19 21:14       ` Jan D.
2004-01-20 15:31         ` Richard Stallman
2004-01-20 15:49           ` Jan D.
2004-01-21 21:09             ` Richard Stallman
2004-01-21 22:22               ` Jan D.
2004-01-22 19:00                 ` Richard Stallman
2004-01-22 19:27                   ` Jan D.
2004-01-20 16:02         ` Stefan Monnier
2004-01-20 16:24           ` Jan D.
2004-01-20 18:43             ` Stefan Monnier
2004-01-20 20:33               ` Jan D.
2004-01-20 20:43                 ` Stefan Monnier
2004-01-21 21:08               ` Richard Stallman
2004-01-21 21:14                 ` Stefan Monnier
2004-01-21 22:02                   ` Jan D.
2004-01-18 19:16 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=849323AA-4B8F-11D8-A2D5-00039363E640@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).