~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/src/modules/Unity/Application/mirsurfaceinterface.h

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2015-2016 Canonical, Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 */
16
 
 
17
 
#ifndef QTMIR_MIRSURFACEINTERFACE_H
18
 
#define QTMIR_MIRSURFACEINTERFACE_H
19
 
 
20
 
// Unity API
21
 
#include <unity/shell/application/MirSurfaceInterface.h>
22
 
 
23
 
#include "session_interface.h"
24
 
 
25
 
// Qt
26
 
#include <QCursor>
27
 
#include <QPoint>
28
 
#include <QSharedPointer>
29
 
#include <QTouchEvent>
30
 
 
31
 
class QHoverEvent;
32
 
class QMouseEvent;
33
 
class QKeyEvent;
34
 
class QSGTexture;
35
 
 
36
 
namespace qtmir {
37
 
 
38
 
class MirSurfaceInterface : public unity::shell::application::MirSurfaceInterface
39
 
{
40
 
    Q_OBJECT
41
 
 
42
 
    /**
43
 
     * @brief Position of the current surface buffer, in pixels.
44
 
     */
45
 
    Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
46
 
 
47
 
public:
48
 
    MirSurfaceInterface(QObject *parent = nullptr) : unity::shell::application::MirSurfaceInterface(parent) {}
49
 
    virtual ~MirSurfaceInterface() {}
50
 
 
51
 
    virtual QPoint position() const = 0;
52
 
    virtual void requestPosition(const QPoint newPosition) = 0;
53
 
 
54
 
    virtual void setLive(bool value) = 0;
55
 
 
56
 
    virtual bool isFirstFrameDrawn() const = 0;
57
 
 
58
 
    virtual void stopFrameDropper() = 0;
59
 
    virtual void startFrameDropper() = 0;
60
 
 
61
 
    virtual bool isBeingDisplayed() const = 0;
62
 
 
63
 
    virtual void registerView(qintptr viewId) = 0;
64
 
    virtual void unregisterView(qintptr viewId) = 0;
65
 
    virtual void setViewVisibility(qintptr viewId, bool visible) = 0;
66
 
 
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
74
 
 
75
 
    /*
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.
78
 
     */
79
 
    virtual void setFocused(bool focus) = 0;
80
 
 
81
 
    /*
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
86
 
        the name.
87
 
     */
88
 
    virtual void setViewActiveFocus(qintptr viewId, bool value) = 0;
89
 
    /*
90
 
        Whether any view of this surface currently has QML active focus
91
 
     */
92
 
    virtual bool activeFocus() const = 0;
93
 
 
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;
101
 
 
102
 
    virtual void keyPressEvent(QKeyEvent *event) = 0;
103
 
    virtual void keyReleaseEvent(QKeyEvent *event) = 0;
104
 
 
105
 
    virtual void touchEvent(Qt::KeyboardModifiers qmods,
106
 
            const QList<QTouchEvent::TouchPoint> &qtTouchPoints,
107
 
            Qt::TouchPointStates qtTouchPointStates,
108
 
            ulong qtTimestamp) = 0;
109
 
 
110
 
    virtual QString appId() const = 0;
111
 
 
112
 
    virtual QCursor cursor() const = 0;
113
 
 
114
 
    virtual SessionInterface* session() = 0;
115
 
 
116
 
    virtual bool inputAreaContains(const QPoint &) const = 0;
117
 
 
118
 
public Q_SLOTS:
119
 
    virtual void onCompositorSwappedBuffers() = 0;
120
 
 
121
 
    virtual void setShellChrome(Mir::ShellChrome shellChrome) = 0;
122
 
 
123
 
Q_SIGNALS:
124
 
    void cursorChanged(const QCursor &cursor);
125
 
    void raiseRequested();
126
 
    void closeRequested();
127
 
    void firstFrameDrawn();
128
 
    void framesPosted();
129
 
    void isBeingDisplayedChanged();
130
 
    void frameDropped();
131
 
    void positionChanged(QPoint position);
132
 
};
133
 
 
134
 
} // namespace qtmir
135
 
 
136
 
#endif // QTMIR_MIRSURFACEINTERFACE_H