cacau
cacau

Reputation: 3646

NSView getting dragged events when dragging window

In my app there's the strange issue that a custom NSView receives forwarded mouseDragged events when the window is dragged around the screen, usually by its toolbar.

From the stack trace it seems that the Cocoa frameworks do this on their own.
(Probably the usual responder chain thing)

Now I'm trying to detect whether the dragged-event originated from my view or somewhere else - is there any robust way of doing so?

I couldn't find a public member that would store the view where the mouse-down occured (though NSEvent seems to store it internally in a private field).

Or any option to configure the window to not forward the dragged messages maybe?

Any hints appreciated!

Upvotes: 0

Views: 197

Answers (1)

H6_
H6_

Reputation: 32808

NSEvent has locationInWindow which returns the location where the event happened as a NSPoint. Together with NSPointInRect you could check if the location is in your window frame or similar.

Upvotes: 0

Related Questions