@@ -0,0 +1,56 @@
2+ * Copyright (C) 2019 UBports Foundation.
3+ * Author(s) Marius Gripsgard <marius@ubports.com>
5+ * This program is free software: you can redistribute it and/or modify it under
6+ * the terms of the GNU Lesser General Public License version 3, as published by
7+ * the Free Software Foundation.
9+ * This program is distributed in the hope that it will be useful, but WITHOUT
10+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
11+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
14+ * You should have received a copy of the GNU Lesser General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#include "InputMethodManager.h"
21+#include <unity/shell/application/MirSurfaceInterface.h>
26+Q_LOGGING_CATEGORY(INPUTMETHODMANAGER, "InputMethodManager", QtInfoMsg)
27+#define DEBUG_MSG qCDebug(INPUTMETHODMANAGER).nospace().noquote() << __func__
29+namespace unityapi = unity::shell::application;
31+InputMethodManager *InputMethodManager::instance()
33+ static InputMethodManager* inputMethod(new InputMethodManager());
37+InputMethodManager::InputMethodManager()
41+void InputMethodManager::setWindow(Window* window)
43+ if (window == m_inputMethodWindow) {
47+ DEBUG_MSG << "(" << window << ")";
49+ m_inputMethodWindow = window;
50+ Q_EMIT surfaceChanged(surface());
53+unityapi::MirSurfaceInterface* InputMethodManager::surface() const
55+ return m_inputMethodWindow ? m_inputMethodWindow->surface() : nullptr;