[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Improved (and corrected) Swing key handling
From: |
Anthony Balkissoon |
Subject: |
[cp-patches] FYI: Improved (and corrected) Swing key handling |
Date: |
Thu, 10 Nov 2005 15:08:43 -0500 |
The method JComponent.processKeyEvent is Swing's entry point for
handling key events. Events like typing text in a text area even pass
through here to check first if the key event changes the focus (like
alt-tab), then if there is a low-level key listener that wants the
event, then if there is a registered key binding that deals with the
event, and then finally defaulting to inserting the text. So I decided
to tidy the code up and cut away the excess.
In the process, I noticed that there were actually correctness problems
in the code as well, specifically dealing with JInternalFrames, and so I
reported this bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24781 .
This patch fixes that bug and improves performance for certain cases.
2005-11-10 Anthony Balkissoon <address@hidden>
* javax/swing/JComponent.java:
(processKeyEvent): Reworked this method to improve performance. Return
early if the event has already been handled. Don't stop climbing when
we hit a JInternalFrame, only stop at Applets or Windows (this fixes
PR 24781). Don't check WHEN_IN_FOCUSED_WINDOW bindings if there is no
top-level container present. If there is a top-level container, pass
it to KeyboardManager.processKeyStroke rather than the JComponent that
actually received the event, to save time in finding the top-level
container within KeyboardManager.
* javax/swing/KeyboardManager.java:
(findTopLevel): Changed parameter from JComponent to Component to allow
generality and to allow passing in of already-determined top-level
containers to save time.
(processKeyStroke): Likewise.
--Tony
SwingKeyBindingsFix.diff
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: Improved (and corrected) Swing key handling,
Anthony Balkissoon <=