Interprocess Dragging is a Drag (Sometimes)

September 23rd, 2005

My “Apple Bug Friday” entries today are both related to a really cool feature of Mac OS X: process switching while dragging. As the operating system has evolved, dragging in general has improved. One of my favorite improvements is that while dragging you can now invoke the Cmd-Tab process switcher keys to bring another application to the front. So instead of performing that tedious “line up” to prepare two applications for a drag, you can simply start in one application with the knowledge that you’ll be able to navigate to the other app before your finger releases the dragged item. I often use this, for instance, when sending attachments through Mail:

  1. Locate the attachable files in the Finder.
  2. Select them and start a drag.
  3. Cmd-Tab to activate Mail.
  4. Cmd-N to create a new mail message.
  5. Drop the drag into the content of the new message!

It’s just … downright amazing that you can do this! So where are the bugs? There are two major shortcomings I’ve observed in Apple’s overall fantastic implementation:

Radar 4270813 – Can’t cancel drag outside of initiating application

Normally when you start a drag and end up with second thoughts, you can rely on the effectiveness of the escape key to reject the drag without any worries that you might be accidentally moving a file or object to some new, unfathomable location. For some reason this mechanism simply stops working once you’ve switched to an application other than the app that originated the drag. So, assuming I want to safely cancel a drag that I’ve started and then switched applications for, I have to now navigate back to the original application just to hit the escape key and cancel the drag!

For instance:

  1. Navigate to the Finder and begin dragging a file.
  2. Cmd-Tab to another app, say, Mail.
  3. Hit the escape key. No effect.
  4. Cmd-Tab back to Finder.
  5. Hit the escape key. Drag cancelled!

What a drag! The cancel key should kill the drag safely regardless of where the user has wandered. This is especially problematic if, for some reason, your short-term memory fails you and you can’t remember which application originated the drag.

Radar 4270824 – Can’t completely switch back to drag-originating app

So, once you switch back to the originating app you can hit cancel and breathe a sigh of relief. The problem is, switching back to the originating app while the drag is still in place produces another bug, which is that although the originating app is now “front-most”, none of its IU (not even its menu bar) has yet been brought to the front. So it’s not only confusing, but if you decided you wanted to drag to the originating app after all, you’re out of luck. You’ll have to cancel the drag and start over.

Illustration:

  1. Initiate a drag in the Finder by selecting and dragging a file from a folder list.
  2. While keeping the drag alive with the mouse, Cmd-Tab to another application, say Safari.
  3. Decide you don’t want to drag to Safari after all, and Cmd-Tab back to the Finder.

Result: Although the Finder is somewhat active, none of its windows have come forward, and the menu bar still says “Safari.”

Workaround: If you can glimpse any part of a Finder window’s content, then dragging the item to this content and “moving it around” seems to trigger full activation of the Finder. I imagine it’s similar for other applications.

What a drag! Cmd-Tabbing to an application should always bring it forward.

9 Responses to “Interprocess Dragging is a Drag (Sometimes)”

  1. David Dunham Says:

    What about cancelling by dragging to the menu bar?

  2. Daniel Jalkut Says:

    Hi David – that sounds like a great workaround. I had never thought of the menu bar as a “safe destination” for such drags, before.

    I would still prefer to have the escape key work all the time, so there was one reliable method of cancelling, but I will keep the menu bar in mind the next time I’m too lazy to tab back to to the original app!

  3. Mike Zornek Says:

    That command-tab while dragging is really cool. Never thought to try it before on my own.

    In my own case for attaching files to email, I usually just drag a file to the Entourage icon in the Dock and it will either create a new mail message with the attached file, or attach it to the front most new mail window. It works well.

    Thanks again for the trick!

  4. Daniel Jalkut Says:

    Cool. I just noticed that Mail responds to drops of arbitrary files in that way, too. Good to know! I usually neglect the droppability of apps in the dock, but I might get used to this feature.

  5. Chris Thomas Says:

    Kind of a tangent:

    It used to be that the classic Window Manager would hide the window outline when you dragged it into the menu bar. If you dragged back out of the menubar without releasing the mouse the outline would reappear. If you instead released the mouse in the menubar, the drag would be canceled.

    (This makes less intuitive sense with live drag, hence the current behavior of sliding the window along the bottom of the menubar.)

    When the Drag Manager was implemented, they too canceled the drag if it went into the menubar (IIRC) except that the drag outline didn’t disappear, so you had no visual indication that the drag would cancel. I wrote a bug up against this years ago, but it’s probably sitting in the pile along with “Menu Manager doesn’t allow events to occur in the background when a menu is pulled down…”

    (I can’t believe all of this stuff is still in my brain. I use Cocoa primarily now…)

  6. Jacob Rus Says:

    This is off the subject, but one great way to drag to another application is to start dragging, hit F10, the application exposé key, and then tab through the applications. If you do this, the other application doesn’t even need to have the target window active at the beginning of the drag! The escape thing bug still happens, but I think the drag cancels if you drop outside of any of the windows revealed by exposé (another workaround?).

  7. Simone Manganelli Says:

    I’m with David Dunham: I usually cancel drags by dragging to the menubar. That’s 100% reliable — at least as far as I can tell — to cancel drags. :)

    — Simone

  8. Matt Gemmell Says:

    Remember that you can also use cmd-backtick (`) to cycle between the windows of the current application. You can combine this with cmd-tab during drags to select any window at all as your drag destination, even if it’s not the frontmost window in its own application. I use this all the time.

    Cmd-` is obviously also really useful even when you’re not dragging, if you want to switch windows via the keyboard without invoking Expose. Cmd-shift-` cycles through the current app’s windows in reverse order, as you’d expect.

  9. Daniel Jalkut Says:

    Hi Matt – yeah I definitely use that shortcut all the time! Thanks for reminding everybody about it.

Comments are Closed.

Follow the Conversation

Stay up-to-date by subscribing to the Comments RSS Feed for this entry.