classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: fixed keyboard focus handling in java.awt.DefaultK


From: Thomas Fitzsimmons
Subject: Re: [cp-patches] FYI: fixed keyboard focus handling in java.awt.DefaultKeyboardFocusManager
Date: Fri, 20 May 2005 17:40:13 -0400

On Fri, 2005-05-20 at 21:26 +0200, Roman Kennke wrote:
> Hi,
> 
> the DefaultKeyboardFocusManager as it was implemented had a serious
> problem: it recognized the KEY_PRESSED and KEY_RELEASED event for
> focusTraversalKeys and consumed them properly. BUT it did not recognize
> the KEY_TYPED event for the same key and let it go through the
> component. This ended up in TAB characters appearing in text components
> when shifting focus with TAB for example. The problem here is, that
> KEY_TYPED events are different than KEY_PRESSED and KEY_RELEASED (the
> former carry the character for the key, the latter the key codes VK_*).
> So the mapping is not straightforward and probably not even always
> possible. What I implemented is that all KEY_TYPED events that follow a
> KEY_PRESSED event for a focusTraversalKey are swallowed until the
> corresponding KEY_RELEASED event is received. I think that this is ok
> so.
> 
> 2005-05-20  Roman Kennke  <address@hidden>
> 
>         * java/awt/DefaultKeyboardFocusManager.java
>         (processKeyEvent): Properly swallow KEY_TYPED events after
>         a KEY_PRESSED event for a focusTraversalKey has been received.
>         Otherwise the focusTraversalKey (e.g. a TAB) would end up
>         beeing delivered to the focused component.
> 
> /Roman
> 
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches

+   * This flag indicates for which focus traversal key release event we
+   * possibly wait, bevor letting any more KEY_TYPED events through.

Typo, "before".

+    // Here we check if we are currently waiting for a KEY_PRESSED and

Aren't you typically waiting for a KEY_RELEASED event here, and
generally waiting for the keystroke opposite to the one that initiated
the focus traversal?

Once these comments are fixed, this can go in.

Thanks,
Tom






reply via email to

[Prev in Thread] Current Thread [Next in Thread]