From 34db0c230e980131930925e44465affb04fe5ebd Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Tue, 6 Mar 2007 11:11:30 +0000 Subject: [PATCH] try to fix focus problems in the chat window --- .../gui/main/message/ChatWindowManager.java | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindowManager.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindowManager.java index 3fdaa04c7..fa2209197 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindowManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindowManager.java @@ -64,24 +64,33 @@ public void openChat(ChatPanel chatPanel, boolean setSelected) if(chatWindow.isVisible()) { - if ((ConfigurationManager.isAutoPopupNewMessage() - && chatWindow.getExtendedState() != JFrame.ICONIFIED) - || setSelected) + if(chatWindow.getExtendedState() != JFrame.ICONIFIED) { - if(chatWindow.getState() == JFrame.ICONIFIED) - chatWindow.setExtendedState(JFrame.NORMAL); - - chatWindow.toFront(); - chatWindow.setCurrentChatPanel(chatPanel); + if(ConfigurationManager.isAutoPopupNewMessage() + || setSelected) + chatWindow.toFront(); } else { - if (chatWindow.getState() == JFrame.ICONIFIED - && !chatWindow.getTitle().startsWith("*")) + if(setSelected) { - chatWindow.setTitle( - "*" + chatWindow.getTitle()); + chatWindow.setExtendedState(JFrame.NORMAL); + chatWindow.toFront(); } + + if(!chatWindow.getTitle().startsWith("*")) + chatWindow.setTitle( + "*" + chatWindow.getTitle()); + } + + if(setSelected) + { + chatWindow.setCurrentChatPanel(chatPanel); + } + else if(!chatWindow.getCurrentChatPanel().equals(chatPanel) + && chatWindow.getChatTabCount() > 0) + { + chatPanel.getChatWindow().highlightTab(chatPanel); } } else @@ -92,12 +101,6 @@ public void openChat(ChatPanel chatPanel, boolean setSelected) } chatPanel.setCaretToEnd(); - - if(!chatWindow.getCurrentChatPanel().equals(chatPanel) - && chatWindow.getChatTabCount() > 0) - { - chatPanel.getChatWindow().highlightTab(chatPanel); - } } }