2 * Copyright (C) 2015 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 "MirSurface.h"
21MirSurface::MirSurface(const QString& name,
24 const QUrl& screenshot,
25 const QUrl &qmlFilePath)
26 : unity::shell::application::MirSurfaceInterface(nullptr)
30 , m_orientationAngle(Mir::Angle0)
31 , m_screenshotUrl(screenshot)
32 , m_qmlFilePath(qmlFilePath)
35 , m_activeFocus(false)
39// qDebug() << "MirSurface::MirSurface() " << name;
42MirSurface::~MirSurface()
44// qDebug() << "MirSurface::~MirSurface() " << name();
47QString MirSurface::name() const
52Mir::Type MirSurface::type() const
57Mir::State MirSurface::state() const
62void MirSurface::setState(Mir::State state)
68 Q_EMIT stateChanged(state);
71bool MirSurface::live() const
76bool MirSurface::visible() const
81void MirSurface::setLive(bool live)
83// qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
88 Q_EMIT liveChanged(live);
90 if (!m_live && m_views.count() == 0) {
95QUrl MirSurface::qmlFilePath() const
100QUrl MirSurface::screenshotUrl() const
102 return m_screenshotUrl;
105void MirSurface::setScreenshotUrl(QUrl screenshotUrl)
107 if (screenshotUrl == m_screenshotUrl)
110 m_screenshotUrl = screenshotUrl;
111 Q_EMIT screenshotUrlChanged(screenshotUrl);
114Mir::OrientationAngle MirSurface::orientationAngle() const
116 return m_orientationAngle;
119void MirSurface::setOrientationAngle(Mir::OrientationAngle angle)
121 if (angle == m_orientationAngle)
124 m_orientationAngle = angle;
125 Q_EMIT orientationAngleChanged(angle);
130void MirSurface::registerView(qintptr viewId)
132 m_views.insert(viewId, MirSurface::View{false});
133// qDebug().nospace() << "MirSurface[" << name() << "]::registerView(" << viewId << ")"
134// << " after=" << m_views.count();
137void MirSurface::unregisterView(qintptr viewId)
139// qDebug().nospace() << "MirSurface[" << name() << "]::unregisterView(" << viewId << ")"
140// << " after=" << m_views.count() << " live=" << m_live;
141 m_views.remove(viewId);
142 if (!m_live && m_views.count() == 0) {
148void MirSurface::setViewVisibility(qintptr viewId, bool visible)
150 if (!m_views.contains(viewId)) return;
152 m_views[viewId].visible = visible;
156void MirSurface::updateVisibility()
158 bool newVisible = false;
159 QHashIterator<qintptr, View> i(m_views);
160 while (i.hasNext()) {
162 newVisible |= i.value().visible;
165 if (newVisible != visible()) {
166// qDebug().nospace() << "MirSurface[" << name() << "]::updateVisibility(" << newVisible << ")";
168 m_visible = newVisible;
169 Q_EMIT visibleChanged(m_visible);
173bool MirSurface::activeFocus() const
175 return m_activeFocus;
178void MirSurface::setActiveFocus(bool value)
180 if (m_activeFocus == value)
183 m_activeFocus = value;
185 Q_EMIT activeFocusChanged(value);
188int MirSurface::width() const
193int MirSurface::height() const
198void MirSurface::resize(int width, int height)
200 bool changed = false;
201 if (width != m_width) {
203 Q_EMIT widthChanged();
207 if (m_height != height) {
209 Q_EMIT heightChanged();
214 Q_EMIT sizeChanged(QSize(width, height));
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