From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#43470: 27.1; Drag and Drop not working properly in 27.1 on OSX Date: Sat, 19 Sep 2020 15:08:17 +0100 Message-ID: <20200919140817.GB28875@breton.holly.idiocy.org> References: <20200917174640.GB635@breton.holly.idiocy.org> <32895e7e-d608-48ad-8f03-397f2d03cd06_IMAP_ADDED_MISSING@ICHABOD> <20200918125424.GF635@breton.holly.idiocy.org> <20200918191106.GH635@breton.holly.idiocy.org> <2c6d27a2-682b-d0eb-5b8f-b0b08c7293b0@duke.edu> <20200918221524.GA28875@breton.holly.idiocy.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22897"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "43470-done@debbugs.gnu.org" <43470-done@debbugs.gnu.org>, Daniel =?UTF-8?Q?Mart=C3=83=C6=92=C3=82?= n To: "Paul Magwene, Ph.D." Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 19 16:09:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJdY6-0005o4-UW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 16:09:11 +0200 Original-Received: from localhost ([::1]:52786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJdY5-0000al-Gh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 10:09:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJdXy-0000aa-3D for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 10:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJdXx-0000NF-Pn for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 10:09:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJdXx-0002qH-IH for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 10:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Sep 2020 14:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43470 X-GNU-PR-Package: emacs Original-Received: via spool by 43470-done@debbugs.gnu.org id=D43470.160052451210889 (code D ref 43470); Sat, 19 Sep 2020 14:09:01 +0000 Original-Received: (at 43470-done) by debbugs.gnu.org; 19 Sep 2020 14:08:32 +0000 Original-Received: from localhost ([127.0.0.1]:47645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJdXU-0002pZ-1X for submit@debbugs.gnu.org; Sat, 19 Sep 2020 10:08:32 -0400 Original-Received: from wilbur.contactoffice.com ([212.3.242.68]:50346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJdXQ-0002pG-Dd for 43470-done@debbugs.gnu.org; Sat, 19 Sep 2020 10:08:30 -0400 Original-Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by wilbur.contactoffice.com (Postfix) with ESMTP id B0724175C; Sat, 19 Sep 2020 16:08:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1600524501; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; l=2963; bh=HYmlMZ6XWYWO+kGYAsUv3jMRa2efHl7cqMmpvHrism8=; b=XhXaqnpVJgPbR/7SOvw5KUCDN/rhN5Wv/drK6qMiMhEH372Djhri9eW9Y0wx8kxM ILiA70x0D+bXyIvi2vBQ6TjbYOSKjJes3d4ovCm4Ap4Ug473W28+KX+rDR6zjFehZ+z rswcjm6RHRbRbJ3b6bHCmfFovGbBunL7NCaNy8X/biZq5duS6PU5Itu1FSpKR0PyaDK mkChiOfiJNohe+A8UU8zJdDM1iLVEMjwluvAZnxnV9YmMAgm3REV/7Qh+LUwsZFZmBI hCRJ2kcoTMnZsEizFHhjbsSY51KoMFA3A4mc3kEROcYxQ7AOekNPjp1lgiq/F8Ayg2g 7/VRPFZAqQ== Original-Received: by smtp.mailfence.com with ESMTPA ; Sat, 19 Sep 2020 16:08:18 +0200 (CEST) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 27F8D202572DCE; Sat, 19 Sep 2020 15:08:17 +0100 (BST) Mail-Followup-To: Alan Third , "Paul Magwene, Ph.D." , "43470-done@debbugs.gnu.org" <43470-done@debbugs.gnu.org>, Daniel =?UTF-8?Q?Mart=C3=83=C6=92=C3=82?= n Content-Disposition: inline In-Reply-To: X-ContactOffice-Account: com:241649512 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188383 Archived-At: On Fri, Sep 18, 2020 at 11:22:46PM +0000, Paul Magwene, Ph.D. wrote: > > My testing suggests that there's still source application specific behavior. > > * Simple drag of images works when Safari or Chrome is the web browser. > > * No combination of Option, Command, or Control seems to work in Firefox; the drag behavior always produces a URL. That's how Apple designed it, what we wanted to avoid was where the source application defined which modifiers Emacs saw in use as that just turned into a nightmare of random behaviour. Probably what's happening is that Firefox is setting some drag operations that don't include NSDragOperationCopy, which is the one we chose to always try opening the text as a URL. It would be interesting to know what it's setting. You could try adding something like NSLog ("%lx", op); into performDragOperation in nsterm.m and then we can compare it to the constants listed here: https://developer.apple.com/documentation/appkit/nsdragoperation?language=objc > So I guess the patch partially fixes the regression. Given the state > of the OS X api I'm not sure what the best way forward is. I'd try > and jump in to contribute but I unfortunately have zero experience > working with Objective C or programming against Apple's APIs The ns-drag-n-drop function is customisable, so if you wanted to ALWAYS force it to try and open ANY text as a URL you could do something like (defun ns-drag-n-drop (event) "Edit the files listed in the drag-n-drop EVENT. Switch to a buffer editing the last file dropped." (interactive "e") (let* ((window (posn-window (event-start event))) (arg (car (cdr (cdr event)))) (type (car arg)) (objects (cdr (cdr arg)))) (set-frame-selected-window nil window) (raise-frame) (setq window (selected-window)) (princ operations) (dolist (data objects) (dnd-handle-one-url window 'private (if (eq type 'file) (concat "file:" data) data))))) It's quite possible we should have more logic in ns-drag-n-drop to work out what to do given the data type and available dragging options. BTW, Apple's documentation seems to be inconsistent. One page[1] has this table: | Modifier Key | Dragging Operation | |--------------------+---------------------| | Option | NSDragOperationCopy | | Command | NSDragOperationMove | | Option and Command | NSDragOperationLink | and another[2] has this: | Modifier Key | Dragging Operation | |--------------+------------------------| | Control | NSDragOperationLink | | Option | NSDragOperationCopy | | Command | NSDragOperationGeneric | The latter seems to be the correct one. [1] https://developer.apple.com/documentation/appkit/nsdragginginfo/1415966-draggingsourceoperationmask?language=objc [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html#//apple_ref/doc/uid/20000976-104936 -- Alan Third