2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "SurfaceManager.h"
19#include "GenericApp.h"
20#include "VirtualKeyboard.h"
24SurfaceManager *SurfaceManager::the_surface_manager = nullptr;
26SurfaceManager *SurfaceManager::singleton()
28 if (!the_surface_manager) {
29 the_surface_manager = new SurfaceManager();
31 return the_surface_manager;
34SurfaceManager::SurfaceManager(QObject *parent) :
36 , m_virtualKeyboard(nullptr)
40MirSurfaceItem *SurfaceManager::createSurface(const QString& name,
41 MirSurfaceItem::Type type,
42 MirSurfaceItem::State state,
43 const QUrl& screenshot)
45 MirSurfaceItem* surface = new GenericApp(name,
49 Q_EMIT surfaceCreated(surface);
53void SurfaceManager::registerSurface(MirSurfaceItem *surface)
55 connect(surface, &MirSurfaceItem::deregister, this, [this] {
56 MirSurfaceItem* surface = qobject_cast<MirSurfaceItem*>(sender());
57 disconnect(surface, 0, this, 0);
59 surface->setLive(false);
60 Q_EMIT surfaceDestroyed(surface);
63 GenericApp *genericApp = qobject_cast<GenericApp*>(surface);
65 connect(genericApp, &GenericApp::inputMethodRequested,
66 this, &SurfaceManager::showInputMethod, Qt::QueuedConnection);
67 connect(genericApp, &GenericApp::inputMethodDismissed,
68 this, &SurfaceManager::hideInputMethod, Qt::QueuedConnection);
72void SurfaceManager::showInputMethod()
74 inputMethodSurface()->setState(MirSurfaceItem::Restored);
77void SurfaceManager::hideInputMethod()
79 if (m_virtualKeyboard) {
80 m_virtualKeyboard->setState(MirSurfaceItem::Minimized);
84MirSurfaceItem *SurfaceManager::inputMethodSurface()
86 if (!m_virtualKeyboard) {
87 m_virtualKeyboard = new VirtualKeyboard;
88 Q_EMIT surfaceCreated(m_virtualKeyboard);
90 return m_virtualKeyboard;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list