Command+[CVX] - question for Apple guys

Scott Kovatch scott.kovatch at oracle.com
Mon Sep 19 09:13:32 PDT 2011


If you override:

- (void)doCommandBySelector:(SEL)aSelector;

you should see this gets fired when you type Command C/V/X. I _believe_ the sequence for command-C (for example) is

flagsChanged: (command key)
doCommandBySelector:  (arg of "copy:")
keyDown: (C key)
keyUp: (C key)
keyUp: (C key)

So, if doCommandBySelector is fired, don't send a Java key event on the next keyDown.

Note that this isn't normally what happens -- NSApplication usually intercepts the command+C so the view won't see it. But it sounds like the AWT is forwarding all key events on to the first responder, which is what you want.

-- Scott K.

On Sep 19, 2011, at 7:35 AM, Alexander Potochkin wrote:

> Hello
> 
> I am working on
> http://java.net/jira/browse/MACOSX_PORT-74
> and found that with official Mac JDK 6 you can see the following key events generated:
> 
> Press Command key - > KeyPressed generated
> then press any of [CVX] -> No new AWT events generated
> but the clipboard works as expected
> 
> on our Mac port
> 
> Hitting [CVX] with the Command key pressed leads to generating pressed, typed and released events
> so it is no surprising that extra symbols are printed
> 
> The natural idea is to introduce a special case for this situation and don't generate AWT events there.
> I wonder if Mac JDK does this way?
> 
> Are there any other cases when we should suppress generating AWT key events with any other key combinations?
> 
> Thanks
> alexp



More information about the macosx-port-dev mailing list