On Tue, Mar 30, 2010 at 12:38 AM, Stef Epardaud <span dir="ltr"><<a href="mailto:stef@epardaud.fr">stef@epardaud.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Mar 29, 2010 at 02:04:22PM -0700, Daniel Cheng wrote:<br>
>      I'm still trying to use the DnD for a real-world use, and keep hitting<br>
>      problems. This is the HTML 5 draft at 7.9.4 Drag-and-drop processing<br>
>      model:<br>
>      "From this point until the end of the drag-and-drop operation, device<br>
>      input events (e.g. mouse and keyboard events) must be suppressed."<br>
><br>
</div><div class="im">>    DragEvent (via MouseEvent) should expose ctrlKey, altKey, metaKey, and<br>
>    shiftKey properties.<br>
<br>
</div>But then it's up to the developer to detect that the keys weren't<br>
pressed before (implement keydown events themselves), which is less<br>
practical.<br></blockquote><div><br></div><div>If you're copying the behavior of file managers, isn't it simply a matter of setting dropEffect to whatever the current state of the modifier keys are?</div><div><br>
</div><div>function dragOver(e) {</div><div>  if (e.ctrlKey) e.dropEffect = 'copy';</div><div>  else e.dropEffect = 'move';</div><div>  e.preventDefault();<br>}</div><div><br></div><div>I'm not sure how having separate keyboard events would help in this case, since you can't set dropEffect directly from a keyboard event.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
>    dragstart and drag events are fired at the source node, but since you're<br>
>    dragging from a non-DOM application, you won't get any. You should still be<br>
>    getting dragenter / dragover / dragleave / drop if the item is<br>
>    dragged/dropped over a DOM page though. It works for me in WebKit.<br>
<br>
</div>But if I want to be notified that an external application started a drag<br>
in my document, where should I place the listener then? document? body<br>
node?<br></blockquote><div><br></div><div>If an external application initiates a drag in your DOM page via the appropriate method for your platform, it should be the same as if a user initiated it. The dragstart event / drag events should end up getting fired at whatever node the application initiated the drag on. Maybe I'm misunderstanding your question though...</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888">--<br>
Stéphane Epardaud<br>
</font></blockquote></div><br>