2 * Copyright (C) 2014-2016 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 "ApplicationInfo.h"
20#include "VirtualKeyboard.h"
24SurfaceManager *SurfaceManager::the_surface_manager = nullptr;
26SurfaceManager *SurfaceManager::instance()
28 return the_surface_manager;
31SurfaceManager::SurfaceManager(QObject *parent) :
33 , m_virtualKeyboard(nullptr)
35 Q_ASSERT(the_surface_manager == nullptr);
36 the_surface_manager = this;
38 m_virtualKeyboard = new VirtualKeyboard;
39 const QString persistentId = m_virtualKeyboard->persistentId();
40 connect(m_virtualKeyboard, &QObject::destroyed, this, [this, persistentId](QObject*) {
41 m_virtualKeyboard = nullptr;
42 Q_EMIT inputMethodSurfaceChanged();
43 Q_EMIT surfaceDestroyed(persistentId);
47SurfaceManager::~SurfaceManager()
49 Q_ASSERT(the_surface_manager == this);
50 the_surface_manager = nullptr;
53MirSurface *SurfaceManager::createSurface(const QString& name,
56 const QUrl& screenshot)
58 MirSurface* surface = new MirSurface(name, type, state, screenshot);
59 const QString persistentId = surface->persistentId();
61 connect(surface, &QObject::destroyed, this, [this, persistentId](QObject*) {
62 Q_EMIT surfaceDestroyed(persistentId);
65 surface->setMinimumWidth(m_newSurfaceMinimumWidth);
66 surface->setMaximumWidth(m_newSurfaceMaximumWidth);
67 surface->setMinimumHeight(m_newSurfaceMinimumHeight);
68 surface->setMaximumHeight(m_newSurfaceMaximumHeight);
69 surface->setWidthIncrement(m_newSurfaceWidthIncrement);
70 surface->setHeightIncrement(m_newSurfaceHeightIncrement);
72 Q_EMIT surfaceCreated(surface);
76MirSurface *SurfaceManager::inputMethodSurface() const
78 return m_virtualKeyboard;
81void SurfaceManager::setNewSurfaceMinimumWidth(int value)
83 if (m_newSurfaceMinimumWidth != value) {
84 m_newSurfaceMinimumWidth = value;
85 Q_EMIT newSurfaceMinimumWidthChanged(m_newSurfaceMinimumWidth);
89void SurfaceManager::setNewSurfaceMaximumWidth(int value)
91 if (m_newSurfaceMaximumWidth != value) {
92 m_newSurfaceMaximumWidth = value;
93 Q_EMIT newSurfaceMaximumWidthChanged(m_newSurfaceMaximumWidth);
97void SurfaceManager::setNewSurfaceMinimumHeight(int value)
99 if (m_newSurfaceMinimumHeight != value) {
100 m_newSurfaceMinimumHeight = value;
101 Q_EMIT newSurfaceMinimumHeightChanged(m_newSurfaceMinimumHeight);
105void SurfaceManager::setNewSurfaceMaximumHeight(int value)
107 if (m_newSurfaceMaximumHeight != value) {
108 m_newSurfaceMaximumHeight = value;
109 Q_EMIT newSurfaceMaximumHeightChanged(m_newSurfaceMaximumHeight);
113void SurfaceManager::setNewSurfaceWidthIncrement(int value)
115 if (m_newSurfaceWidthIncrement != value) {
116 m_newSurfaceWidthIncrement = value;
117 Q_EMIT newSurfaceWidthIncrementChanged(m_newSurfaceWidthIncrement);
121void SurfaceManager::setNewSurfaceHeightIncrement(int value)
123 if (m_newSurfaceHeightIncrement != value) {
124 m_newSurfaceHeightIncrement = value;
125 Q_EMIT newSurfaceHeightIncrementChanged(m_newSurfaceHeightIncrement);
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