From f9fe74c42eb543a09bfe0cf2d66e2fb54113b07e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 14 Mar 2016 23:26:16 +0300 Subject: Allow open/close chat input by double click on chat window. --- src/gui/windows/chatwindow.cpp | 24 +++++++++++++++++++++--- src/gui/windows/chatwindow.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index d7d5f690a..fe20fe935 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -731,9 +731,19 @@ void ChatWindow::mousePressed(MouseEvent &event) if (event.getButton() == MouseButton::LEFT) { - const ChatTab *const tab = getFocused(); - if (tab) - mMoved = !isResizeAllowed(event); + const int clicks = event.getClickCount(); + if (clicks == 2) + { + toggleChatFocus(); + if (gui) + gui->resetClickCount(); + } + else if (clicks == 1) + { + const ChatTab *const tab = getFocused(); + if (tab) + mMoved = !isResizeAllowed(event); + } } mDragOffsetX = event.getX(); @@ -2185,6 +2195,14 @@ void ChatWindow::showGMTab() } } +void ChatWindow::toggleChatFocus() +{ + if (mChatInput->isVisible() && mChatInput->isFocused()) + mChatInput->processVisible(Visible_false); + else + requestChatFocus(); +} + #ifdef EATHENA_SUPPORT void ChatWindow::joinRoom(const bool isJoin) { diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index c13338d7c..49c068a0f 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -371,6 +371,8 @@ class ChatWindow final : public Window, void initTradeFilter(); + void toggleChatFocus(); + unsigned int mRainbowColor; private: -- cgit v1.2.3-70-g09d2