~mir-team/qtmir/trunk

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/mirsurfaceinterface.h

  • Committer: Bileto Bot
  • Author(s): Albert Astals Cid, Gerry Boland
  • Date: 2017-03-20 21:15:13 UTC
  • mfrom: (606.4.12 make_sure_surface_not_null)
  • Revision ID: ci-train-bot@canonical.com-20170320211513-z7v3z0ldes3gtcc0
Check for find() result not being null before using it

We do it in onWindowReady, onWindowMoved, onWindowFocusChanged, etc so no reason to not do it in onWindowRemoved

Approved by: Lukáš Tinkl, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2015 Canonical, Ltd.
 
2
 * Copyright (C) 2015-2016 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
24
24
 
25
25
// Qt
26
26
#include <QCursor>
 
27
#include <QPoint>
27
28
#include <QSharedPointer>
28
29
#include <QTouchEvent>
29
30
 
37
38
class MirSurfaceInterface : public unity::shell::application::MirSurfaceInterface
38
39
{
39
40
    Q_OBJECT
 
41
 
40
42
public:
41
43
    MirSurfaceInterface(QObject *parent = nullptr) : unity::shell::application::MirSurfaceInterface(parent) {}
42
44
    virtual ~MirSurfaceInterface() {}
43
45
 
44
46
    virtual void setLive(bool value) = 0;
45
47
 
46
 
    virtual bool isFirstFrameDrawn() const = 0;
 
48
    virtual bool isReady() const = 0;
47
49
 
48
50
    virtual void stopFrameDropper() = 0;
49
51
    virtual void startFrameDropper() = 0;
52
54
 
53
55
    virtual void registerView(qintptr viewId) = 0;
54
56
    virtual void unregisterView(qintptr viewId) = 0;
55
 
    virtual void setViewVisibility(qintptr viewId, bool visible) = 0;
 
57
    virtual void setViewExposure(qintptr viewId, bool exposed) = 0;
56
58
 
57
59
    // methods called from the rendering (scene graph) thread:
58
60
    virtual QSharedPointer<QSGTexture> texture() = 0;
62
64
    virtual bool numBuffersReadyForCompositor() = 0;
63
65
    // end of methods called from the rendering (scene graph) thread
64
66
 
65
 
    virtual void setFocus(bool focus) = 0;
 
67
    /*
 
68
        Defines the unityapi::MirSurfaceInterface::focused() value, which is what shell sees.
 
69
        Set centrally by MirFocusController and used for window-management purposes by shell.
 
70
     */
 
71
    virtual void setFocused(bool focus) = 0;
66
72
 
67
 
    virtual void close() = 0;
 
73
    /*
 
74
        Defines the "focus" attribute of the underlying mir::scene::Surface, which is what
 
75
        the client application sees.
 
76
        Set by MirSurfaceItems (aka views) and used to inform the client application about the
 
77
        actual focus, pretty much a one-to-one mapping with QML's active focus concept, hence
 
78
        the name.
 
79
     */
 
80
    virtual void setViewActiveFocus(qintptr viewId, bool value) = 0;
 
81
    /*
 
82
        Whether any view of this surface currently has QML active focus
 
83
     */
 
84
    virtual bool activeFocus() const = 0;
68
85
 
69
86
    virtual void mousePressEvent(QMouseEvent *event) = 0;
70
87
    virtual void mouseMoveEvent(QMouseEvent *event) = 0;
86
103
 
87
104
    virtual QCursor cursor() const = 0;
88
105
 
89
 
Q_SIGNALS:
90
 
    void cursorChanged(const QCursor &cursor);
 
106
    virtual SessionInterface* session() = 0;
 
107
 
 
108
    virtual bool inputAreaContains(const QPoint &) const = 0;
 
109
 
 
110
    virtual void requestFocus() = 0;
91
111
 
92
112
public Q_SLOTS:
93
113
    virtual void onCompositorSwappedBuffers() = 0;
94
114
 
 
115
    virtual void setShellChrome(Mir::ShellChrome shellChrome) = 0;
 
116
 
95
117
Q_SIGNALS:
96
 
    void firstFrameDrawn();
 
118
    void ready();
 
119
    void cursorChanged(const QCursor &cursor);
 
120
    void raiseRequested();
97
121
    void framesPosted();
98
122
    void isBeingDisplayedChanged();
99
123
    void frameDropped();