title: NSStatusItem custom view NSDraggingDestination only works after click of item
body: <p>I have an NSStatusItem with a custom view that implements the NSDraggingDestination protocol. However, dragging and dropping only works if the status item was clicked / activated at least once. I want the custom view to accept drops regardless.</p>
  
  <p>A gif to showcase the problem:
  <img src="https://i.stack.imgur.com/3Kptn.gif" alt="Gif."></p>
  
  <p>Code from the example above (or <a href="http://cl.ly/Wl1j/MenuTest.zip" rel="nofollow noreferrer">Xcode Project</a>):</p>
  
  <pre><code>import Cocoa
  class AppDelegate: NSObject, NSApplicationDelegate {
      func applicationDidFinishLaunching(aNotification: NSNotification?) {
          let vc = StatusItemViewController()
      }
  
      func applicationWillTerminate(aNotification: NSNotification?) {
          // Insert code here to tear down your application
      }
  
  }
  
  class StatusItemView: NSView, NSDraggingDestination {
      public var image = NSImage(named: "NSQuickLookTemplate")
      public var action: Selector?
      public var target: AnyObject?
  
      private var statusItem: NSStatusItem
  
      init(statusItem: NSStatusItem) {
          let itemWidth = statusItem.length
          let itemHeight = NSStatusBar.systemStatusBar().thickness
          self.statusItem = statusItem
          super.init(frame: NSRect(x: 0.0, y: 0.0, width: itemWidth, height: itemHeight))
  
          var types = [NSURLPboardType, NSStringPboardType] as [String]
          for type in NSImage.imagePasteboardTypes() {
              types.append(type as String)
          }
          self.registerForDraggedTypes(types)
          statusItem.view = self
      }
  
      override func drawRect(dirtyRect: NSRect) {
          let iconSize = image.size
          let bounds = self.bounds
          let iconX = round((bounds.width - iconSize.width)/2)
          let iconY = round((bounds.height - iconSize.height)/2)
          image.drawAtPoint(NSPoint(x: iconX, y: iconY), fromRect: NSRect(), operation: NSCompositingOperation.CompositeOverlay, fraction: 1.0)
      }
  
      override func mouseDown(theEvent: NSEvent!) {
          if let _action = self.action {
              NSApp.sendAction(_action, to: self.target, from: self)
          }
      }
  
      override func performDragOperation(sender: NSDraggingInfo!) -&gt; Bool {
          println("Performed")
          return true
      }
  
      override func draggingEntered(sender: NSDraggingInfo!) -&gt; NSDragOperation {
          return NSDragOperation.Copy
      }
  
      override func draggingUpdated(sender: NSDraggingInfo!) -&gt; NSDragOperation {
          println("Dragging")
          return NSDragOperation.Copy
      }
  
      override func draggingExited(sender: NSDraggingInfo!) {
          println("Exit")
      }
  }
  
  class StatusItemViewController: NSObject {
      private var statusBarItem: NSStatusItem?
      private var statusItemView: StatusItemView!
  
      init() {
          self.statusBarItem = NSStatusBar.systemStatusBar().statusItemWithLength(24)
          super.init()
          if let item = statusBarItem {
              statusItemView = StatusItemView(statusItem: item)
              statusItemView.target = self
              statusItemView.action = "doAction:"
          } else {
              println("Unable to create status item, terminating self")
              NSApplication.sharedApplication().terminate(nil)
          }
      }
  
      deinit {
          NSStatusBar.systemStatusBar().removeStatusItem(statusBarItem)
          statusBarItem = nil
          statusItemView = nil
      }
  
      func doAction(sender: AnyObject!) {
          println("Here is where one would perform the action")
      }
  }
  </code></pre>
  
  <p>Perhaps this is a bug or perhaps I'm just missing something. Why is this happening and is there anything I can do to prevent this behaviour?</p>