2
* Copyright (C) 2015-2016 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License version 3, as published by
6
* the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
* SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
#ifndef QTMIR_MIRSURFACEINTERFACE_H
18
#define QTMIR_MIRSURFACEINTERFACE_H
21
#include <unity/shell/application/MirSurfaceInterface.h>
23
#include "session_interface.h"
28
#include <QSharedPointer>
29
#include <QTouchEvent>
38
class MirSurfaceInterface : public unity::shell::application::MirSurfaceInterface
43
* @brief Position of the current surface buffer, in pixels.
45
Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
48
MirSurfaceInterface(QObject *parent = nullptr) : unity::shell::application::MirSurfaceInterface(parent) {}
49
virtual ~MirSurfaceInterface() {}
51
virtual QPoint position() const = 0;
52
virtual void requestPosition(const QPoint newPosition) = 0;
54
virtual void setLive(bool value) = 0;
56
virtual bool isFirstFrameDrawn() const = 0;
58
virtual void stopFrameDropper() = 0;
59
virtual void startFrameDropper() = 0;
61
virtual bool isBeingDisplayed() const = 0;
63
virtual void registerView(qintptr viewId) = 0;
64
virtual void unregisterView(qintptr viewId) = 0;
65
virtual void setViewVisibility(qintptr viewId, bool visible) = 0;
67
// methods called from the rendering (scene graph) thread:
68
virtual QSharedPointer<QSGTexture> texture() = 0;
69
virtual QSGTexture *weakTexture() const = 0;
70
virtual bool updateTexture() = 0;
71
virtual unsigned int currentFrameNumber() const = 0;
72
virtual bool numBuffersReadyForCompositor() = 0;
73
// end of methods called from the rendering (scene graph) thread
76
Defines the unityapi::MirSurfaceInterface::focused() value, which is what shell sees.
77
Set centrally by MirFocusController and used for window-management purposes by shell.
79
virtual void setFocused(bool focus) = 0;
82
Defines the "focus" attribute of the underlying mir::scene::Surface, which is what
83
the client application sees.
84
Set by MirSurfaceItems (aka views) and used to inform the client application about the
85
actual focus, pretty much a one-to-one mapping with QML's active focus concept, hence
88
virtual void setViewActiveFocus(qintptr viewId, bool value) = 0;
90
Whether any view of this surface currently has QML active focus
92
virtual bool activeFocus() const = 0;
94
virtual void mousePressEvent(QMouseEvent *event) = 0;
95
virtual void mouseMoveEvent(QMouseEvent *event) = 0;
96
virtual void mouseReleaseEvent(QMouseEvent *event) = 0;
97
virtual void hoverEnterEvent(QHoverEvent *event) = 0;
98
virtual void hoverLeaveEvent(QHoverEvent *event) = 0;
99
virtual void hoverMoveEvent(QHoverEvent *event) = 0;
100
virtual void wheelEvent(QWheelEvent *event) = 0;
102
virtual void keyPressEvent(QKeyEvent *event) = 0;
103
virtual void keyReleaseEvent(QKeyEvent *event) = 0;
105
virtual void touchEvent(Qt::KeyboardModifiers qmods,
106
const QList<QTouchEvent::TouchPoint> &qtTouchPoints,
107
Qt::TouchPointStates qtTouchPointStates,
108
ulong qtTimestamp) = 0;
110
virtual QString appId() const = 0;
112
virtual QCursor cursor() const = 0;
114
virtual SessionInterface* session() = 0;
116
virtual bool inputAreaContains(const QPoint &) const = 0;
119
virtual void onCompositorSwappedBuffers() = 0;
121
virtual void setShellChrome(Mir::ShellChrome shellChrome) = 0;
124
void cursorChanged(const QCursor &cursor);
125
void raiseRequested();
126
void closeRequested();
127
void firstFrameDrawn();
129
void isBeingDisplayedChanged();
131
void positionChanged(QPoint position);
136
#endif // QTMIR_MIRSURFACEINTERFACE_H