bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#30929: 26.0.91; Text drag and drop does not work


From: Alan Third
Subject: bug#30929: 26.0.91; Text drag and drop does not work
Date: Sat, 7 Apr 2018 16:01:19 +0100
User-agent: Mutt/1.9.3 (2018-01-21)

On Wed, Mar 28, 2018 at 10:20:13PM +1300, Nick Helm wrote:
> > It’s setting the actual modifier keys, so when a user changes those
> > keys’ settings this breaks.
> >
> > You can also set these flags by using the actual modifier keys.
> >
> > This looks like it matches up with what Apple expect you to do, but it
> > doesn’t seem to match up with Emacs’s event handling very well. 
> 
> That looks about right to me too, it least it matches the general
> approach in the docs.
> 
> I had a go at mapping the hardware modifiers to Emacs events (and
> existing bindings) for each drag type and DragOperation mask. Patch
> attached. This doesn't support the ns-right-*-modifiers yet, but they
> should be pretty easy to add if you want to go this way.

Except we have no way of identifying whether the left or right
modifier has been pressed.

I’ve been thinking about this and I’m not entirely sure it’s a good
idea to expose these modifier presses to Emacs. At least not by
default.

I have two reasons for avoiding this:

  1. They’re not always modifier presses. Applications set these flags
     themselves and it seems strange to me that it can look like a modifier
     has been pressed when the user has done no such thing.

  2. It’s so very easy to break the bindings by rebinding the
     modifiers, which is often recommended for people using non‐US
     keyboards.

ns-drag-n-drop is perfectly capable of determining what action to take
by examining what it’s been passed in the event. So I think that if we
receive, for example, a filename and only NSDragOperationLink is set
then we should mark the filename as a string and then send the event
to lisp where it is inserted as plain text. But if NSDragOperationCopy
or NSDragOperationGeneric is set we mark it as a file and lisp will
open the file.

This does mean that the modifier presses aren’t customisable, but they
will always match the OS default at least.

If there’s a good use case for allowing these modifiers to leak
through then I suggest we make it customisable. That way new users
aren’t going to completely break drag‐n‐drop accidentally, and people
who know what they’re doing can break it as much as they want and live
with the consequences.

-- 
Alan Third





reply via email to

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