~mir-team/qtmir/trunk

« back to all changes in this revision

Viewing changes to tests/mirserver/WindowManager/stub_surface.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
 
/*
2
 
 * Copyright © 2015 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3,
6
 
 * as published by the Free Software Foundation.
7
 
 *
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.
12
 
 *
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/>.
15
 
 */
16
 
 
17
 
#ifndef QPAMIRSERVER_STUB_SURFACE_H
18
 
#define QPAMIRSERVER_STUB_SURFACE_H
19
 
 
20
 
#include <mir/scene/surface.h>
21
 
 
22
 
// mir::scene::Surface is a horribly wide interface to expose from Mir
23
 
// and there's not even a proper stub in the Mir-0.15 package mirtest-dev
24
 
struct StubSurface : mir::scene::Surface
25
 
{
26
 
    std::string name() const override;
27
 
    void move_to(mir::geometry::Point const& top_left) override;
28
 
    float alpha() const override;
29
 
    mir::geometry::Size size() const override;
30
 
    mir::geometry::Size client_size() const override;
31
 
    std::shared_ptr<mir::frontend::BufferStream> primary_buffer_stream() const override;
32
 
    void set_streams(std::list<mir::scene::StreamInfo> const& streams) override;
33
 
    bool supports_input() const override;
34
 
    int client_input_fd() const override;
35
 
    std::shared_ptr<mir::input::InputChannel> input_channel() const override;
36
 
    mir::input::InputReceptionMode reception_mode() const override;
37
 
    void set_reception_mode(mir::input::InputReceptionMode mode) override;
38
 
    void set_input_region(std::vector<mir::geometry::Rectangle> const& input_rectangles) override;
39
 
    void resize(mir::geometry::Size const& size) override;
40
 
    mir::geometry::Point top_left() const override;
41
 
    mir::geometry::Rectangle input_bounds() const override;
42
 
    bool input_area_contains(mir::geometry::Point const& point) const override;
43
 
    void consume(MirEvent const* event) override;
44
 
    void set_alpha(float alpha) override;
45
 
    void set_orientation(MirOrientation orientation) override;
46
 
    void set_transformation(glm::mat4 const&) override;
47
 
    bool visible() const override;
48
 
    mir::graphics::RenderableList generate_renderables(mir::compositor::CompositorID id) const override;
49
 
    int buffers_ready_for_compositor(void const* compositor_id) const override;
50
 
    MirSurfaceType type() const override;
51
 
    MirSurfaceState state() const override;
52
 
    int configure(MirSurfaceAttrib attrib, int value) override;
53
 
    int query(MirSurfaceAttrib attrib) const override;
54
 
    void hide() override;
55
 
    void show() override;
56
 
    void set_cursor_image(std::shared_ptr<mir::graphics::CursorImage> const& image) override;
57
 
    std::shared_ptr<mir::graphics::CursorImage> cursor_image() const override;
58
 
    void set_cursor_stream(std::shared_ptr<mir::frontend::BufferStream> const& stream, mir::geometry::Displacement const& hotspot) override;
59
 
    void request_client_surface_close() override;
60
 
    std::shared_ptr<Surface> parent() const override;
61
 
    void add_observer(std::shared_ptr<mir::scene::SurfaceObserver> const& observer) override;
62
 
    void remove_observer(std::weak_ptr<mir::scene::SurfaceObserver> const& observer) override;
63
 
    void set_keymap(MirInputDeviceId id, std::string const& model, std::string const& layout,
64
 
        std::string const& variant, std::string const& options) override;
65
 
    void rename(std::string const& title) override;
66
 
};
67
 
 
68
 
#endif //QPAMIRSERVER_STUB_SURFACE_H