Re: knowing if a titlebar click is actually a resize click
Re: knowing if a titlebar click is actually a resize click
- Subject: Re: knowing if a titlebar click is actually a resize click
- From: Seth Willits <email@hidden>
- Date: Wed, 12 Jun 2013 14:59:18 -0700
On Jun 12, 2013, at 12:45 PM, Steve Mills wrote:
>> On Jun 12, 2013, at 10:48 AM, Steve Mills wrote:
>>
>>> How can I tell in my sendEvent override that a click is supposed to resize the window from the top and not drag the window?
>>
>> I assume you're having to display the resize cursor yourself since the window is marked as non-resizable? Naturally, being within that tracking rect would determine if it's a resize click.
>
> No, just the opposite. I'm handling moving so we can snap to other windows, so our move code is running because the click is in the titlebar, even when Cocoa has already changed the cursor to a resize cursor. Are those tracking rects exposed in a public API? NSView has a trackingRects method, but the window doesn't.
Hmm. I would have though a non-movable window couldn't be resized and thus wouldn't show the resize cursor.
I don't know that the OS uses standard tracking rects — I was thinking you'd be providing your own according to the above. Since that's not the case, you'll just have to do the simple checking to see if the click is within the top edge of the window. The only potential disconnect is that you may assume the top X points are click-to-resize when it's actually Y points. That's not likely to change change much if at all over the years, so doing the hit test yourself is pretty safe.
The only other potential solution I see is to check to see if the cursor is a resize cursor. I don't know if that cursor change is available at the app level so that might not be doable. (In addition, I think you'll have issues if the window is in the background since the cursor isn't shown but the window should still be resizable and I think you still have to control the resizing?)
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden