diff options
author | Damian Minkov <damencho@jitsi.org> | 2014-06-05 15:36:45 +0300 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2014-06-05 15:36:45 +0300 |
commit | 64b51e078dddc12e4b06e7c9d2d76a9ce20a6092 (patch) | |
tree | 4bcbc5950141279b09927c7a7427cbb7379d2e7e /src | |
parent | fe39617026eb86d7e211b9a752655ec8d9f2f7bc (diff) | |
download | jitsi-64b51e078dddc12e4b06e7c9d2d76a9ce20a6092.zip jitsi-64b51e078dddc12e4b06e7c9d2d76a9ce20a6092.tar.gz jitsi-64b51e078dddc12e4b06e7c9d2d76a9ce20a6092.tar.bz2 |
Does not lose focus from chat write area when clicking on the conversation panel (reverts previous commit and adds new fix).
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java | 1 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java | 30 |
2 files changed, 30 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java index 4dd2617..7166164 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java @@ -237,7 +237,6 @@ public class ChatConversationPanel this.chatTextPane.setEditable(false); this.chatTextPane.setDocument(document); this.chatTextPane.setDragEnabled(true); - this.chatTextPane.setFocusable(false); chatTextPane.putClientProperty( JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java index a4f50c5..bf325c6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java @@ -64,6 +64,7 @@ public class ChatPanel ChatRoomLocalUserRoleListener, ChatRoomMemberPropertyChangeListener, FileTransferStatusListener, + KeyEventDispatcher, Skinnable { /** @@ -228,6 +229,9 @@ public class ChatPanel } this.addComponentListener(new TabSelectionComponentListener()); + + KeyboardFocusManager.getCurrentKeyboardFocusManager() + .addKeyEventDispatcher(this); } /** @@ -445,6 +449,9 @@ public class ChatPanel */ public void dispose() { + KeyboardFocusManager.getCurrentKeyboardFocusManager() + .removeKeyEventDispatcher(this); + writeMessagePanel.dispose(); chatSession.dispose(); conversationPanel.dispose(); @@ -3115,4 +3122,27 @@ public class ChatPanel chatConferencesDialog.setCreatePanelEnabled(!available); chatConferencesDialog.setEndConferenceButtonEnabled(available); } + + /** + * Dispatches key events and process those that were generated when + * conversationPanel ChatTextPane is focused and they were targeting the + * write message panel. + * @param e the <tt>KeyEvent</tt> to dispatch. + * @return <tt>true</tt> if the KeyboardFocusManager should take no + * further action with regard to the KeyEvent; <tt>false</tt> + * otherwise. + */ + public boolean dispatchKeyEvent(KeyEvent e) + { + if(e.getSource() != conversationPanel.getChatTextPane() + || writeMessagePanel.getEditorPane().isFocusOwner()) + return false; + + writeMessagePanel.getEditorPane().requestFocusInWindow(); + + KeyboardFocusManager.getCurrentKeyboardFocusManager() + .redispatchEvent(writeMessagePanel.getEditorPane(), e); + + return true; + } } |