~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to tests/mir_test_framework/fake_input_device_impl.h

  • Committer: Package Import Robot
  • Author(s): CI Train Bot
  • Date: 2015-05-12 13:12:55 UTC
  • mto: This revision was merged to the branch mainline in revision 96.
  • Revision ID: package-import@ubuntu.com-20150512131255-y7z12i8n4pbvo70x
Tags: upstream-0.13.0+15.10.20150512
Import upstream version 0.13.0+15.10.20150512

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
 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef MIR_TEST_FRAMEWORK_FAKE_INPUT_DEVICE_IMPL_H_
 
20
#define MIR_TEST_FRAMEWORK_FAKE_INPUT_DEVICE_IMPL_H_
 
21
 
 
22
#include "mir_test_framework/fake_input_device.h"
 
23
 
 
24
#include "mir/input/input_device.h"
 
25
#include "mir/input/input_device_info.h"
 
26
 
 
27
namespace mi = mir::input;
 
28
namespace mir
 
29
{
 
30
namespace dispatch
 
31
{
 
32
class ActionQueue;
 
33
}
 
34
}
 
35
 
 
36
namespace mir_test_framework
 
37
{
 
38
class FakeInputDeviceImpl : public FakeInputDevice
 
39
{
 
40
public:
 
41
    FakeInputDeviceImpl(mi::InputDeviceInfo const& info);
 
42
    void emit_event(synthesis::KeyParameters const& key_params) override;
 
43
private:
 
44
    class InputDevice : public mi::InputDevice
 
45
    {
 
46
    public:
 
47
        InputDevice(mi::InputDeviceInfo const& info,
 
48
                    std::shared_ptr<mir::dispatch::Dispatchable> const& dispatchable);
 
49
        std::shared_ptr<mir::dispatch::Dispatchable> dispatchable() override;
 
50
        void start(mi::InputSink* destination) override;
 
51
        void stop() override;
 
52
 
 
53
        void synthesize_events(synthesis::KeyParameters const& key_params);
 
54
        mi::InputDeviceInfo get_device_info() override
 
55
        {
 
56
            return info;
 
57
        }
 
58
 
 
59
        mi::InputSink* sink{nullptr};
 
60
        mi::InputDeviceInfo info;
 
61
        std::shared_ptr<mir::dispatch::Dispatchable> const queue;
 
62
        uint32_t modifiers{0};
 
63
    };
 
64
    std::shared_ptr<mir::dispatch::ActionQueue> queue;
 
65
    std::shared_ptr<InputDevice> device;
 
66
};
 
67
 
 
68
}
 
69
 
 
70
#endif