Review request for 7124430: [macosx] LWCToolkit.grab() and LWCToolkit.ungrab() events are not implemented yet

Anton V. Tarasov anton.tarasov at oracle.com
Mon Jan 16 23:30:54 PST 2012


Anthony was right (thanks for the persistence! :)

Please review the new version, with -[NSWindow sendEvent:] overridden:

http://cr.openjdk.java.net/~ant/7124430/webrev.2/

Thanks,
Anton.

On 1/13/12 9:17 PM, Anthony Petrov wrote:
> Overriding NSWindow -sendEvent: does allow one to catch mouse click 
> events on the Mac. We use this technique in JavaFX for grab/ungrab 
> functionality, and everything works smoothly.
>
> Anton was just trying to override NSApplication -sendEvent: which 
> indeed won't help in that case (note the class name difference).
>
> -- 
> best regards,
> Anthony
>
> On 1/13/2012 9:34 PM, Mike Swingler wrote:
>> Don't worry about trying to catch the window title bar frame, you 
>> really can't, and you shouldn't try. The titlebar/toolbar area is 
>> specially marked so that the WindowServer will still allow the window 
>> to be movable, even if the app is spinning and non-responsive. Due to 
>> this fact, the app is infrequently notified when it's window is being 
>> moved, because that app isn't even involved.
>>
>> Regards,
>> Mike Swingler
>> Apple Inc.
>>
>> On Jan 13, 2012, at 7:49 AM, Anton V. Tarasov wrote:
>>
>>> Hi Anthony,
>>>
>>> Thanks for the tip. Though I did look through some forum discussions 
>>> where people asked question
>>> "is it possible to catch a mouse down event in a frame's titlebar?" 
>>> The answer was "not a direct way".
>>> Commonly, a suggestion is to workaround it by means of 
>>> -windowWillMove usage, but this looks quite
>>> odd to me...
>>>
>>> For instance:
>>>
>>> http://www.cocoabuilder.com/archive/cocoa/6725-catching-mousedown-in-an-nswindow-titlebar.html 
>>>
>>>
>>> "PS: I have tried to overiding -sendEvent in the instance of a subclass
>>> of NSApplication object to see what events are going thru, mouseDown
>>> and mouseUp events in the titlebar don't go thru. It's seem that the
>>> windows are moved directly by the WindowServer, as you explained me."
>>>
>>> Did you have an experience of trying it yourself?
>>>
>>> Thanks,
>>> Anton.
>>>
>>> On 1/13/12 4:58 PM, Anthony Petrov wrote:
>>>> Hi Anton,
>>>>
>>>> You want to override NSWindow -sendEvent: in order to catch clicks 
>>>> on the titlebar of windows on the Mac.
>>>>
>>>> -- 
>>>> best regards,
>>>> Anthony
>>>>
>>>> On 1/13/2012 6:36 PM, Anton V. Tarasov wrote:
>>>>> Hello,
>>>>>
>>>>> Please review a fix for 7124430.
>>>>>
>>>>> webrev: http://cr.openjdk.java.net/~ant/7124430/webrev.1/
>>>>>
>>>>> UngrabEvent dispatching is implemented according to the cases 
>>>>> mentioned
>>>>> in the UngrabEvent class description, except for the case of clicking
>>>>> in an owner frame's title. The latter, as I found, can't be 
>>>>> implemented
>>>>> on Mac OS X platform. Along with the implementation, a regression 
>>>>> test
>>>>> is proposed.
>>>>>
>>>>> Thanks,
>>>>> Anton.
>>>>>
>>>>>
>>



More information about the macosx-port-dev mailing list