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

« back to all changes in this revision

Viewing changes to include/client/mir_toolkit/events/input/pointer_event.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 Lesser 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 Lesser General Public License for more details.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Authored by: Robert Carr <robert.carr@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef MIR_TOOLKIT_POINTER_EVENT_H_
 
20
#define MIR_TOOLKIT_POINTER_EVENT_H_
 
21
 
 
22
#include <stdbool.h>
 
23
 
 
24
#ifdef __cplusplus
 
25
/**
 
26
 * \addtogroup mir_toolkit
 
27
 * @{
 
28
 */
 
29
extern "C" {
 
30
#endif
 
31
 
 
32
/**
 
33
 * An event type describing a change in pointer device state.
 
34
 */
 
35
typedef struct MirPointerEvent MirPointerEvent;
 
36
 
 
37
/**
 
38
 * Possible pointer actions
 
39
 */
 
40
typedef enum {
 
41
    /* A pointer button has come up */
 
42
    mir_pointer_action_button_up = 0,
 
43
    /* A pointer button has gone down */
 
44
    mir_pointer_action_button_down = 1,
 
45
    /* The pointer has entered the surface to which this event was delivered */
 
46
    mir_pointer_action_enter = 2,
 
47
    /* The pointer has left the surface to which this event was delivered */
 
48
    mir_pointer_action_leave = 3,
 
49
    /* Axis values have changed for the pointer */
 
50
    mir_pointer_action_motion = 4
 
51
} MirPointerAction;
 
52
 
 
53
/**
 
54
 * Identifiers for pointer axis
 
55
 */
 
56
typedef enum {
 
57
/* Absolute axis containing the x coordinate of the pointer */
 
58
    mir_pointer_axis_x = 0,
 
59
/* Absolute axis containing the y coordinate of the pointer */
 
60
    mir_pointer_axis_y = 1,
 
61
/* Relative axis containing ticks reported by the vertical scroll wheel */
 
62
    mir_pointer_axis_vscroll = 2,
 
63
/* Relative axis containing ticks reported by the horizontal scroll wheel */
 
64
    mir_pointer_axis_hscroll = 3
 
65
} MirPointerAxis;
 
66
 
 
67
/* 
 
68
 * Identifiers for pointer buttons
 
69
 */
 
70
typedef enum {
 
71
    mir_pointer_button_primary   = 1,
 
72
    mir_pointer_button_secondary = 2,
 
73
    mir_pointer_button_tertiary  = 3,
 
74
    mir_pointer_button_back      = 4,
 
75
    mir_pointer_button_forward   = 5
 
76
} MirPointerButton;
 
77
 
 
78
/**
 
79
 * Retrieve the modifier keys pressed when the pointer action occured.
 
80
 *
 
81
 *   \param [in] event The pointer event
 
82
 *   \return           The modifier mask
 
83
 */
 
84
MirInputEventModifiers mir_pointer_event_modifiers(MirPointerEvent const* event);
 
85
 
 
86
/**
 
87
 * Retrieve the action which occured to generate a given pointer event.
 
88
 *
 
89
 *  \param [in] event       The pointer event
 
90
 *  \return                 Action performed by the pointer
 
91
 */
 
92
MirPointerAction mir_pointer_event_action(MirPointerEvent const* event);
 
93
 
 
94
/**
 
95
 * Retrieve the state of a given pointer button when the action occurred.
 
96
 *
 
97
 * \param [in] event         The pointer event
 
98
 * \param [in] button        The button to check
 
99
 *
 
100
 * \return                   Whether the given button is depressed
 
101
 */
 
102
bool mir_pointer_event_button_state(MirPointerEvent const* event,
 
103
    MirPointerButton button);
 
104
 
 
105
/**
 
106
 * Retrieve the axis value reported by a given pointer event.
 
107
 *
 
108
 *  \param [in] event       The pointer event
 
109
 *  \param [in] axis        The axis to retreive a value from
 
110
 *  \return                 The value of the given axis
 
111
 */
 
112
float mir_pointer_event_axis_value(MirPointerEvent const* event, 
 
113
    MirPointerAxis axis);
 
114
 
 
115
#ifdef __cplusplus
 
116
}
 
117
/**@}*/
 
118
#endif
 
119
 
 
120
#endif /* MIR_TOOLKIT_POINTER_EVENT_H_ */