2
* Copyright © 2014 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
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 Lesser General Public License for more details.
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/>.
16
* Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
19
#include "input_receiver_report.h"
20
#include "mir/report/lttng/mir_tracepoint.h"
23
#include <boost/throw_exception.hpp>
25
#define TRACEPOINT_DEFINE
26
#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
27
#include "input_receiver_report_tp.h"
29
void mir::client::lttng::InputReceiverReport::received_event(MirEvent const& event)
33
case mir_event_type_key:
36
case mir_event_type_motion:
40
BOOST_THROW_EXCEPTION(std::runtime_error("Unexpected event type"));
44
void mir::client::lttng::InputReceiverReport::report(MirKeyEvent const& event) const
46
mir_tracepoint(mir_client_input_receiver, key_event, event.device_id, event.source_id,
47
static_cast<int>(event.action), static_cast<int>(event.flags), event.modifiers, event.key_code,
48
event.scan_code, event.down_time, event.event_time);
51
void mir::client::lttng::InputReceiverReport::report(MirMotionEvent const& event) const
53
mir_tracepoint(mir_client_input_receiver, motion_event, event.device_id, event.source_id, event.action,
54
static_cast<int>(event.flags), event.modifiers, event.edge_flags,
55
static_cast<int>(event.button_state), event.down_time, event.event_time);
56
for (unsigned int i = 0; i < event.pointer_count; i++)
58
mir_tracepoint(mir_client_input_receiver, motion_event_coordinate,
59
event.pointer_coordinates[i].id, event.pointer_coordinates[i].x, event.pointer_coordinates[i].y,
60
event.pointer_coordinates[i].touch_major, event.pointer_coordinates[i].touch_minor,
61
event.pointer_coordinates[i].size, event.pointer_coordinates[i].pressure,
62
event.pointer_coordinates[i].orientation);