2 * Copyright (C) 2013 Canonical Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 * Authored by: Thomas Voss <thomas.voss@canonical.com>
19 #ifndef INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_
20 #define INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_
27 * Key states (may be returned by queries about the current state of a
28 * particular key code, scan code or switch).
31 /* The key state is unknown or the requested key itself is not supported. */
32 ICSL_KEY_STATE_UNKNOWN
= -1,
35 ICSL_KEY_STATE_UP
= 0,
37 /* The key is down. */
38 ICSL_KEY_STATE_DOWN
= 1,
40 /* The key is down but is a virtual key press that is being emulated by the system. */
41 ICSL_KEY_STATE_VIRTUAL
= 2
45 * Meta key / modifer state.
49 /* No meta keys are pressed. */
52 /* This mask is used to check whether one of the ALT meta keys is pressed. */
53 ISCL_META_ALT_ON
= 0x02,
55 /* This mask is used to check whether the left ALT meta key is pressed. */
56 ISCL_META_ALT_LEFT_ON
= 0x10,
58 /* This mask is used to check whether the right ALT meta key is pressed. */
59 ISCL_META_ALT_RIGHT_ON
= 0x20,
61 /* This mask is used to check whether one of the SHIFT meta keys is pressed. */
62 ISCL_META_SHIFT_ON
= 0x01,
64 /* This mask is used to check whether the left SHIFT meta key is pressed. */
65 ISCL_META_SHIFT_LEFT_ON
= 0x40,
67 /* This mask is used to check whether the right SHIFT meta key is pressed. */
68 ISCL_META_SHIFT_RIGHT_ON
= 0x80,
70 /* This mask is used to check whether the SYM meta key is pressed. */
71 ISCL_META_SYM_ON
= 0x04,
73 /* This mask is used to check whether the FUNCTION meta key is pressed. */
74 ISCL_META_FUNCTION_ON
= 0x08,
76 /* This mask is used to check whether one of the CTRL meta keys is pressed. */
77 ISCL_META_CTRL_ON
= 0x1000,
79 /* This mask is used to check whether the left CTRL meta key is pressed. */
80 ISCL_META_CTRL_LEFT_ON
= 0x2000,
82 /* This mask is used to check whether the right CTRL meta key is pressed. */
83 ISCL_META_CTRL_RIGHT_ON
= 0x4000,
85 /* This mask is used to check whether one of the META meta keys is pressed. */
86 ISCL_META_META_ON
= 0x10000,
88 /* This mask is used to check whether the left META meta key is pressed. */
89 ISCL_META_META_LEFT_ON
= 0x20000,
91 /* This mask is used to check whether the right META meta key is pressed. */
92 ISCL_META_META_RIGHT_ON
= 0x40000,
94 /* This mask is used to check whether the CAPS LOCK meta key is on. */
95 ISCL_META_CAPS_LOCK_ON
= 0x100000,
97 /* This mask is used to check whether the NUM LOCK meta key is on. */
98 ISCL_META_NUM_LOCK_ON
= 0x200000,
100 /* This mask is used to check whether the SCROLL LOCK meta key is on. */
101 ISCL_META_SCROLL_LOCK_ON
= 0x400000,
109 /* The key has been pressed down. */
110 ISCL_KEY_EVENT_ACTION_DOWN
= 0,
112 /* The key has been released. */
113 ISCL_KEY_EVENT_ACTION_UP
= 1,
115 /* Multiple duplicate key events have occurred in a row, or a complex string is
116 * being delivered. The repeat_count property of the key event contains the number
117 * of times the given key code should be executed.
119 ISCL_KEY_EVENT_ACTION_MULTIPLE
= 2
127 /* This mask is set if the device woke because of this key event. */
128 ISCL_KEY_EVENT_FLAG_WOKE_HERE
= 0x1,
130 /* This mask is set if the key event was generated by a software keyboard. */
131 ISCL_KEY_EVENT_FLAG_SOFT_KEYBOARD
= 0x2,
133 /* This mask is set if we don't want the key event to cause us to leave touch mode. */
134 ISCL_KEY_EVENT_FLAG_KEEP_TOUCH_MODE
= 0x4,
136 /* This mask is set if an event was known to come from a trusted part
137 * of the system. That is, the event is known to come from the user,
138 * and could not have been spoofed by a third party component. */
139 ISCL_KEY_EVENT_FLAG_FROM_SYSTEM
= 0x8,
141 /* This mask is used for compatibility, to identify enter keys that are
142 * coming from an IME whose enter key has been auto-labelled "next" or
143 * "done". This allows TextView to dispatch these as normal enter keys
144 * for old applications, but still do the appropriate action when
146 ISCL_KEY_EVENT_FLAG_EDITOR_ACTION
= 0x10,
148 /* When associated with up key events, this indicates that the key press
149 * has been canceled. Typically this is used with virtual touch screen
150 * keys, where the user can slide from the virtual key area on to the
151 * display: in that case, the application will receive a canceled up
152 * event and should not perform the action normally associated with the
153 * key. Note that for this to work, the application can not perform an
154 * action for a key until it receives an up or the long press timeout has
156 ISCL_KEY_EVENT_FLAG_CANCELED
= 0x20,
158 /* This key event was generated by a virtual (on-screen) hard key area.
159 * Typically this is an area of the touchscreen, outside of the regular
160 * display, dedicated to "hardware" buttons. */
161 ISCL_KEY_EVENT_FLAG_VIRTUAL_HARD_KEY
= 0x40,
163 /* This flag is set for the first key repeat that occurs after the
164 * long press timeout. */
165 ISCL_KEY_EVENT_FLAG_LONG_PRESS
= 0x80,
167 /* Set when a key event has ISCL_KEY_EVENT_FLAG_CANCELED set because a long
168 * press action was executed while it was down. */
169 ISCL_KEY_EVENT_FLAG_CANCELED_LONG_PRESS
= 0x100,
171 /* Set for ISCL_KEY_EVENT_ACTION_UP when this event's key code is still being
172 * tracked from its initial down. That is, somebody requested that tracking
173 * started on the key down and a long press has not caused
174 * the tracking to be canceled. */
175 ISCL_KEY_EVENT_FLAG_TRACKING
= 0x200,
177 /* Set when a key event has been synthesized to implement default behavior
178 * for an event that the application did not handle.
179 * Fallback key events are generated by unhandled trackball motions
180 * (to emulate a directional keypad) and by certain unhandled key presses
181 * that are declared in the key map (such as special function numeric keypad
182 * keys when numlock is off). */
183 ISCL_KEY_EVENT_FLAG_FALLBACK
= 0x400,
190 #endif // INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_