From 9be5ebf772f03cdaea50bf33b70f30dd4f1c0dd2 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Tue, 8 Sep 2015 09:59:58 +0200
Subject: Set keyboard focus to text input after selecting an emoticon

After selecting an emoticon on Windows the keyboard focus does not
return to the text input. OS X did not exhibit that behavior.

This fix explicitly sets the focus back to the text input after
selection of an emoticon, as expected by the user.

Test-Information:

Verified the behavior on OS X 10.9.5 and Windows 7, both with
Qt 5.4.2.

Change-Id: I8737a7e3f6d1a6b7a8e60261e9bd14c7be8d07a6

diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index ffcbf15..3818991 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -49,6 +49,7 @@
 
 #include <Swift/QtUI/QtAddBookmarkWindow.h>
 #include <Swift/QtUI/QtEditBookmarkWindow.h>
+#include <Swift/QtUI/QtEmoticonsGrid.h>
 #include <Swift/QtUI/QtPlainChatView.h>
 #include <Swift/QtUI/QtScaledAvatarCache.h>
 #include <Swift/QtUI/QtSettingsProvider.h>
@@ -645,6 +646,7 @@ void QtChatWindow::handleEmoticonsButtonClicked() {
 
 void QtChatWindow::handleEmoticonClicked(QString emoticonAsText) {
 	input_->textCursor().insertText(emoticonAsText);
+	input_->setFocus();
 }
 
 void QtChatWindow::handleTextInputReceivedFocus() {
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 19046c9..8d7db59 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -20,7 +20,6 @@
 
 #include <Swift/QtUI/ChatSnippet.h>
 #include <Swift/QtUI/QtAffiliationEditor.h>
-#include <Swift/QtUI/QtEmoticonsGrid.h>
 #include <Swift/QtUI/QtMUCConfigurationWindow.h>
 #include <Swift/QtUI/QtSwiftUtil.h>
 #include <Swift/QtUI/QtTabbable.h>
@@ -41,6 +40,7 @@ namespace Swift {
 	class UIEventStream;
 	class QtChatWindowJSBridge;
 	class SettingsProvider;
+	class QtEmoticonsGrid;
 
 	class LabelModel : public QAbstractListModel {
 		Q_OBJECT
-- 
cgit v0.10.2-6-g49f6