2
* Copyright © 2016 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as 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
#ifndef MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_
20
#define MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_
22
#include <mir_toolkit/events/event.h>
26
* \addtogroup mir_toolkit
33
* MirInputDeviceStateEvent informs clients about the current state of the
34
* input devices. This is necessary when the client did not receive the most
35
* recent input events. The event is sent when the server was resumed after
36
* a pause, or when the client just received the input focus.
38
* The event contains a single pointer button state and the current cursor
39
* position and the pressed modifier keys. Additionally for key and pointer
40
* devices the pressed keys and buttons are supplied individually.
44
* Retrieve the button state.
46
* \param[in] ev The input device state event
47
* \return The combined pointer button state
49
MirPointerButtons mir_input_device_state_event_pointer_buttons(
50
MirInputDeviceStateEvent const* ev);
53
* Retrieve the pointer position
55
* \param[in] ev The input device state event
56
* \param[in] axis The pointer axis: mir_pointer_axis_x or mir_pointer_axis_y
57
* \return The pointer position
59
float mir_input_device_state_event_pointer_axis(
60
MirInputDeviceStateEvent const* ev, MirPointerAxis axis);
63
* Retrieve the time associated with a MirInputDeviceStateEvent
65
* \param[in] ev The input device state event
66
* \return The time in nanoseconds since epoch
68
int64_t mir_input_device_state_event_time(
69
MirInputDeviceStateEvent const* ev);
72
* Retrieve the modifier keys pressed on all input devices.
74
* \param[in] ev The input device state event
75
* \return The modifier mask
77
MirInputEventModifiers mir_input_device_state_event_modifiers(
78
MirInputDeviceStateEvent const* ev);
81
* Retrieve the number of attached input devices.
83
* \param[in] ev The input device state event
84
* \return The time in nanoseconds since epoch
86
uint32_t mir_input_device_state_event_device_count(
87
MirInputDeviceStateEvent const* ev);
90
* Retrieve the device id
92
* \param[in] ev The input device state event
93
* \param[in] index The index of the input device
94
* \return The device id
96
MirInputDeviceId mir_input_device_state_event_device_id(
97
MirInputDeviceStateEvent const* ev, uint32_t index);
100
* Retrieve an array of pressed keys on the device identified by the \a index.
101
* The keys are encoded as scan codes.
103
* \param[in] ev The input device state event
104
* \param[in] index The index of the input device
105
* \return An array of pressed keys
107
uint32_t const* mir_input_device_state_event_device_pressed_keys(
108
MirInputDeviceStateEvent const* ev, uint32_t index);
111
* Retrieve the size of scan code array of the device identified by the \a index.
113
* \param[in] ev The input device state event
114
* \param[in] index The index of the input device
115
* \return Size of the pressed keys array
117
uint32_t mir_input_device_state_event_device_pressed_keys_count(
118
MirInputDeviceStateEvent const* ev, uint32_t index);
121
* Retrieve the pointer button state of the device identified by the \a index
123
* \param[in] ev The input device state event
124
* \param[in] index The index of the input device
125
* \return The pointer button state of the device
127
MirPointerButtons mir_input_device_state_event_device_pointer_buttons(
128
MirInputDeviceStateEvent const* ev, uint32_t index);
135
#endif /* MIR_TOOLKIT_EVENTS_INPUT_DEVICE_STATE_EVENT_H_ */