on xenial help sign in
unity8/plugins/WindowManager/InputMethodManager.cpp
56 lines 1.6 kB history raw
1/*
2 * Copyright (C) 2019 UBports Foundation.
3 * Author(s) Marius Gripsgard <marius@ubports.com>
4 *
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.
8 *
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.
13 *
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/>.
16 */
18#include "InputMethodManager.h"
19#include <QDebug>
21#include <unity/shell/application/MirSurfaceInterface.h>
23// local
24#include "Window.h"
26Q_LOGGING_CATEGORY(INPUTMETHODMANAGER, "InputMethodManager", QtInfoMsg)
27#define DEBUG_MSG qCDebug(INPUTMETHODMANAGER).nospace().noquote() << __func__
29namespace unityapi = unity::shell::application;
31InputMethodManager *InputMethodManager::instance()
33 static InputMethodManager* inputMethod(new InputMethodManager());
34 return inputMethod;
37InputMethodManager::InputMethodManager()
41void InputMethodManager::setWindow(Window* window)
43 if (window == m_inputMethodWindow) {
44 return;
45 }
47 DEBUG_MSG << "(" << window << ")";
49 m_inputMethodWindow = window;
50 Q_EMIT surfaceChanged(surface());
53unityapi::MirSurfaceInterface* InputMethodManager::surface() const
55 return m_inputMethodWindow ? m_inputMethodWindow->surface() : nullptr;