On 15 Jun 2014, at 00:46, Cosmin Apreutesei <cosmin.apreute...@gmail.com> wrote:
> How can I hit-test the title bar rectangle without the resizing
> corners and edges?

 There’s no official API to do this that I’m aware of.

> (I need this so I can implement synchronous window moving events).

 Can I ask why you’re trying to do this? This sounds like something that’s so 
unusual to do that I suspect you’re trying to use an overly complicated 
approach to achieve something that is really simple in Cocoa. And what exactly 
do you mean by “synchronous window moving event”?

 You shouldn’t generally need to have to worry about window dragging. You can 
set views to be spots where the window can be dragged, but apart from that the 
Window Server is supposed to take care of moving windows asynchronously, 
without any interaction with your app. This makes dragging more responsive, and 
makes it work even while your application is blocked, hung, etc.

 If you want to move something else when the window is dragged, make it a view 
in the window, or a child window. If you have some other data that needs to be 
updated, it is usually OK to do that after the window has been moved, by 
registering for each NSWindow’s NSWindowDidMove notification. There is nothing 
else the user can do while she is dragging the window, so there’s not really 
much need to update any internal state while the drag is still in progress.

 If you need to e.g. display an indicator of where the mouse cursor is right 
now, you will probably want to look at NSMouseMoved and NSMouseDragged events. 
You could for instance register a global event monitor for that. If you’re just 
trying to update the mouse cursor, there are cursor regions and tracking 
regions for that.

 And finally, if you’re trying to snap a window to a grid or resize it on a 
grid or something like that, there are NSWindow delegate methods that give you 
the rect AppKit would use for the new window size/position, where you can 
return a modified version of the rect.

 Any of these sound like what you’re doing?

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to