This file is indexed.

/usr/include/crystalspace-2.0/csutil/event.h is in libcrystalspace-dev 2.0+dfsg-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
/*
    Event system related helpers
    Copyright (C) 2003 by Jorrit Tyberghein
	      (C) 2003 by Frank Richter
              (C) 2005 by Adam D. Bradley <artdodge@cs.bu.edu>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
  
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
  
    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __CS_CSUTIL_EVENT_H__
#define __CS_CSUTIL_EVENT_H__

#include "csextern.h"
#include "iutil/event.h"
#include "iutil/eventhandlers.h"

/**\file
 * Event system related helpers
 */
/**
 * \addtogroup event_handling
 * @{ */

/**\name Keyboard event related
 * @{ */
/**
 * Helper class to conveniently deal with keyboard events.
 */
class CS_CRYSTALSPACE_EXPORT csKeyEventHelper
{
public:
  /// Retrieve the key's raw code.
  static utf32_char GetRawCode (const iEvent* event);
  /// Retrieve the key's cooked code.
  static utf32_char GetCookedCode (const iEvent* event);
  /// Retrieve the key's raw code.
  static void GetModifiers (const iEvent* event, csKeyModifiers& modifiers);
  /// Retrieve the event type (key up or down.)
  static csKeyEventType GetEventType (const iEvent* event);
  /**
   * Retrieve whether a keyboard down event was caused by the initial press
   * (not auto-repeat) or by having it held for a period of time (auto-repeat.)
   */
  static bool GetAutoRepeat (const iEvent* event);
  /// Retrieve the character type (dead or normal.)
  static csKeyCharType GetCharacterType (const iEvent* event);
  /// Get all the information in one compact struct.
  static bool GetEventData (const iEvent* event, csKeyEventData& data);
  /**
   * Get a bitmask corresponding to the pressed modifier keys from the
   * keyboard modifiers struct.
   * \sa CSMASK_ALT etc.
   */
  static uint32 GetModifiersBits (
    const csKeyModifiers& modifiers);
  /**
   * Get a bitmask corresponding to the pressed modifier keys from the event.
   * \sa CSMASK_ALT etc.
   */
  static uint32 GetModifiersBits (const iEvent* event);
  /**
   * Convert a bitmask returned by GetModifiersBits back to a csKeyModifiers
   * struct.
   */
  static void GetModifiers (uint32 mask, csKeyModifiers& modifiers);
};
/** @} */

/* forward declaration */
class csEvent;

/**\name Mouse event related
 * @{ */
/**
 * Helper class to conveniently deal with mouse events.
 */
class CS_CRYSTALSPACE_EXPORT csMouseEventHelper
{
public:
  //@{
  /// Create a new mouse event
  static csEvent *NewEvent (csRef<iEventNameRegistry> &reg, 
    csTicks, csEventID name, csMouseEventType etype, int x, int y, 
    uint32 AxesChanged, int button, bool buttonstate, uint32 buttonMask, 
    const csKeyModifiers& modifiers);
  static csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks, 
    csEventID name, uint8 n, csMouseEventType etype, int x, int y, 
    uint32 axesChanged, int button, bool buttonstate, uint32 buttonMask, 
    const csKeyModifiers& modifiers);
  static csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks, 
    csEventID name, uint8 n, csMouseEventType etype, const int32 *axes, 
    uint8 numAxes, uint32 axesChanged, int button, bool buttonstate, 
    uint32 buttonMask, const csKeyModifiers& modifiers);
  //@}

  // Deprecated in 1.3.
  static CS_DEPRECATED_METHOD_MSG("Use the variant with csKeyModifiers modifiers")
  csEvent *NewEvent (csRef<iEventNameRegistry> &reg, 
    csTicks t, csEventID name, csMouseEventType etype, int x, int y, 
    uint32 AxesChanged, int button, bool buttonstate, uint32 buttonMask, 
    uint32 modifiers)
  {
    csKeyModifiers m;
    csKeyEventHelper::GetModifiers (modifiers, m);
    return NewEvent (reg, t, name, etype, x, y, AxesChanged, button, 
      buttonstate, buttonMask, m);
  }
  // Deprecated in 1.3.
  static CS_DEPRECATED_METHOD_MSG("Use the variant with csKeyModifiers modifiers")
  csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks t, 
    csEventID name, uint8 n, csMouseEventType etype, int x, int y, 
    uint32 axesChanged, int button, bool buttonstate, uint32 buttonMask, 
    uint32 modifiers)
  {
    csKeyModifiers m;
    csKeyEventHelper::GetModifiers (modifiers, m);
    return NewEvent (reg, t, name, n, etype, x, y, axesChanged, button, 
      buttonstate, buttonMask, m);
  }
  // Deprecated in 1.3.
  static CS_DEPRECATED_METHOD_MSG("Use the variant with csKeyModifiers modifiers")
  csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks t, 
    csEventID name, uint8 n, csMouseEventType etype, const int32 *axes, 
    uint8 numAxes, uint32 axesChanged, int button, bool buttonstate, 
    uint32 buttonMask, uint32 modifiers)
  {
    csKeyModifiers m;
    csKeyEventHelper::GetModifiers (modifiers, m);
    return NewEvent (reg, t, name, n, etype, axes, numAxes, axesChanged,
      button, buttonstate, buttonMask, m);
  }

  /// Retrieve the event type (key up or down.)
  static csMouseEventType GetEventType (const iEvent* event);
  /// retrieve mouse number (0, 1, ...)
  static uint GetNumber(const iEvent *event);
  /// retrieve X value of mouse #0
  static int GetX(const iEvent *event)
  { return GetAxis(event, 0); }
  /// Retrieve Y value of mouse #0
  static int GetY(const iEvent *event)
  { return GetAxis(event, 1); }
  /// retrieve any axis (basis 0) value
  static int GetAxis(const iEvent *event, uint axis);
  /// retrieve number of axes
  static uint GetNumAxes(const iEvent *event);
  /// retrieve button code
  static int GetButton(const iEvent *event);
  /// retrieve button state (pressed/released)
  static bool GetButtonState(const iEvent *event);
  /// Retrieve current button mask
  static uint32 GetButtonMask(const iEvent *event);
  /// retrieve modifier flags
  static void GetModifiers(const iEvent *event, 
    csKeyModifiers& modifiers) 
  { csKeyEventHelper::GetModifiers(event, modifiers); }
  /// Retrieve modifiers bitmask
  static uint32 GetModifiers(const iEvent *event) 
  { 
    csKeyModifiers modifiers; 
    csKeyEventHelper::GetModifiers(event, modifiers); 
    return csKeyEventHelper::GetModifiersBits(modifiers); 
  }
  /// Retrieve event data
  static bool GetEventData (const iEvent* event, 
    csMouseEventData& data);
};

/** @} */
 
/**\name Joystick event related
 * @{ */
/**
 * Helper class to conveniently deal with joystick events.
 */
class CS_CRYSTALSPACE_EXPORT csJoystickEventHelper
{
public:
  //@{
  /// Create new joystick event
  static csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks, 
    csEventID name, int n, int x, int y, uint32 axesChanged, uint button, 
    bool buttonState, uint32 buttonMask, const csKeyModifiers& modifiers);
  static csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks, 
    csEventID name, int n, const int32* axes, uint8 numAxes, uint32 axesChanged, 
    uint button, bool buttonState, uint32 buttonMask, const csKeyModifiers& modifiers);
  //@}

  // Deprecated in 1.3.
  static CS_DEPRECATED_METHOD_MSG("Use the variant with csKeyModifiers modifiers")
  csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks t, 
    csEventID name, int n, int x, int y, uint32 axesChanged, uint button, 
    bool buttonState, uint32 buttonMask, uint32 modifiers)
  {
    csKeyModifiers m;
    csKeyEventHelper::GetModifiers (modifiers, m);
    return NewEvent (reg, t, name, n, x, y, axesChanged, button, 
      buttonState, buttonMask, m);
  }
  // Deprecated in 1.3.
  static CS_DEPRECATED_METHOD_MSG("Use the variant with csKeyModifiers modifiers")
  csEvent *NewEvent (csRef<iEventNameRegistry> &reg, csTicks t, 
    csEventID name, int n, const int32* axes, uint8 numAxes, uint32 axesChanged, 
    uint button, bool buttonState, uint32 buttonMask, uint32 modifiers)
  {
    csKeyModifiers m;
    csKeyEventHelper::GetModifiers (modifiers, m);
    return NewEvent (reg, t, name, n, axes, numAxes, axesChanged, button, 
      buttonState, buttonMask, m);
  }

  /// Retrieve joystick number (0, 1, 2, ...)
  static uint GetNumber(const iEvent *event);
  /// retrieve any axis (basis 0) value
  static int GetAxis(const iEvent *event, uint);
  /// retrieve number of axes
  static uint GetNumAxes(const iEvent *);
  /// retrieve button number
  static uint GetButton(const iEvent *event);
  /// retrieve button state (pressed/released)
  static bool GetButtonState(const iEvent *event);
  /// Retrieve current button mask
  static uint32 GetButtonMask(const iEvent *event);
  /// retrieve modifier flags
  static void GetModifiers(const iEvent *event, csKeyModifiers& modifiers) 
  { csKeyEventHelper::GetModifiers(event, modifiers); }
  /// Retrieve modifiers bitmask
  static uint32 GetModifiers(const iEvent *event) 
  { 
    csKeyModifiers modifiers; 
    csKeyEventHelper::GetModifiers(event, modifiers); 
    return csKeyEventHelper::GetModifiersBits(modifiers); 
  }
  /// Retrieve event data
  static bool GetEventData (const iEvent* event, csJoystickEventData& data);
};

/** @} */

/**\name Generic input event stuff
 * @{ */
/** 
 * Helper class to conveniently pull generic data out of input events.
 */
class CS_CRYSTALSPACE_EXPORT csInputEventHelper
{
public:
  /// Retrieve button number (0 on error or if keyboard event)
  static uint GetButton (iEventNameRegistry *,
  	const iEvent *event);
  /// Retrieve button/key state (true = press, false = release)
  static bool GetButtonState (iEventNameRegistry *,
  	const iEvent *event);
};

/**\name Command event related
 * @{ */
/**
 * Helper class to conveniently deal with command events.
 * Note that "command" is a vestigial event type; this class
 * will probably go away before long.
 */
class CS_CRYSTALSPACE_EXPORT csCommandEventHelper
{
public:
  /// Create a new "command" event
  static csEvent *NewEvent (csTicks, csEventID name, bool Broadcast, 
    intptr_t info = 0);

  /// Retrieve command code
  static uint GetCode(const iEvent *event);
  /// Retrieve command info
  static intptr_t GetInfo(const iEvent *event);
  /// Retrieve event data
  static bool GetEventData (const iEvent* event, csCommandEventData& data);
};

/** @} */

struct iEventQueue;
struct iObjectRegistry;

namespace CS
{

/**
 * Helper function for registering an event handler using a weak reference.
 * Use RemoveWeakListener() to remove an event handler registered with this
 * function.
 */
csHandlerID CS_CRYSTALSPACE_EXPORT RegisterWeakListener (iEventQueue *q, 
  iEventHandler *listener, csRef<iEventHandler> &handler);
csHandlerID CS_CRYSTALSPACE_EXPORT RegisterWeakListener (iEventQueue *q, 
  iEventHandler *listener, const csEventID &ename, csRef<iEventHandler> &handler);
csHandlerID CS_CRYSTALSPACE_EXPORT RegisterWeakListener (iEventQueue *q, 
  iEventHandler *listener, const csEventID ename[], csRef<iEventHandler> &handler);

/**
 * Helper function for removing an event handler that was registered with
 * RegisterWeakListener().
 */
void CS_CRYSTALSPACE_EXPORT RemoveWeakListener (iEventQueue *q, 
  csRef<iEventHandler> &handler);

} // namespace CS
  
/** @} */

#endif // __CS_CSUTIL_EVENT_H__