~vanvugt/mir/mir-display-config-header

« back to all changes in this revision

Viewing changes to src/server/input/seat_observer_multiplexer.h

  • Committer: Tarmac
  • Author(s): Christopher James Halse Rogers
  • Date: 2016-11-15 23:48:01 UTC
  • mfrom: (3730.3.26 reports-as-observers)
  • Revision ID: tarmac-20161115234801-2w603k4v3ffhfl3u
Replace the mir::Server-overridable Reports with Observers.

This resolves two problems:
1) It ensures that Mir will respect the various reporting options we provide, even when the shell wants to hook into some of the reports, and
2) It matches the semantic expectations around Reports vs Observers that (most of) the Mir team have. A couple of report call-sites which are unsafe for Observers are fixed in this branch.

Approved by mir-ci-bot, Kevin DuBois, Andreas Pokorny, Cemil Azizoglu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2016 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: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
 
17
 */
 
18
 
 
19
 
 
20
#ifndef MIR_INPUT_SEAT_OBSERVER_MULTIPLEXER_H_
 
21
#define MIR_INPUT_SEAT_OBSERVER_MULTIPLEXER_H_
 
22
 
 
23
#include "mir/input/seat_observer.h"
 
24
#include "mir/observer_multiplexer.h"
 
25
 
 
26
namespace mir
 
27
{
 
28
namespace input
 
29
{
 
30
 
 
31
class SeatObserverMultiplexer : public ObserverMultiplexer<SeatObserver>
 
32
{
 
33
public:
 
34
    SeatObserverMultiplexer(std::shared_ptr<Executor> const& default_executor);
 
35
 
 
36
    void seat_add_device(uint64_t id) override;
 
37
 
 
38
    void seat_remove_device(uint64_t id) override;
 
39
 
 
40
    void seat_dispatch_event(MirEvent const* event) override;
 
41
 
 
42
    void seat_get_rectangle_for(uint64_t id, geometry::Rectangle const& out_rect) override;
 
43
 
 
44
    void seat_set_key_state(uint64_t id, std::vector<uint32_t> const& scan_codes) override;
 
45
 
 
46
    void seat_set_pointer_state(uint64_t id, unsigned buttons) override;
 
47
 
 
48
    void seat_set_cursor_position(float cursor_x, float cursor_y) override;
 
49
 
 
50
    void seat_set_confinement_region_called(geometry::Rectangles const& regions) override;
 
51
 
 
52
    void seat_reset_confinement_regions() override;
 
53
 
 
54
private:
 
55
    std::shared_ptr<Executor> const executor;
 
56
};
 
57
 
 
58
}
 
59
}
 
60
 
 
61
#endif //MIR_INPUT_SEAT_OBSERVER_MULTIPLEXER_H_