This file is indexed.

/usr/include/gaminggear-0/gaminggear/macro.h is in libgaminggear-dev 0.15.1-7.

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
#ifndef __GAMINGGEAR_MACRO_H__
#define __GAMINGGEAR_MACRO_H__

/*
 * This file is part of libgaminggear.
 *
 * libgaminggear is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * libgaminggear 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with libgaminggear. If not, see <http://www.gnu.org/licenses/>.
 */

/*! \file gaminggear/macro.h
 *  \brief Macros.
 */

#include <glib.h>

G_BEGIN_DECLS

typedef struct _GaminggearMacro GaminggearMacro;
typedef struct _GaminggearMacroKeystroke GaminggearMacroKeystroke;
typedef struct _GaminggearMacroKeystrokes GaminggearMacroKeystrokes;

enum {
	GAMINGGEAR_MACRO_KEYSTROKES_NUM = 512,
	GAMINGGEAR_MACRO_KEYSTROKE_PERIOD_MAX = G_MAXUINT16,
};

struct _GaminggearMacroKeystroke {
	guint8 key;
	guint8 action;
	guint16 period; /*!< Stored little endian. */
} __attribute__ ((packed));

typedef enum {
	GAMINGGEAR_MACRO_KEYSTROKE_KEY_BUTTON_LEFT = 0xf0,
	GAMINGGEAR_MACRO_KEYSTROKE_KEY_BUTTON_RIGHT = 0xf1,
	GAMINGGEAR_MACRO_KEYSTROKE_KEY_BUTTON_MIDDLE = 0xf2,
} GaminggearMacroKeystrokeKey;

typedef enum {
	GAMINGGEAR_MACRO_KEYSTROKE_ACTION_PRESS = 0,
	GAMINGGEAR_MACRO_KEYSTROKE_ACTION_RELEASE = 1
} GaminggearMacroKeystrokeAction;

/*! \brief Get period from GaminggearMacroKeystroke.
 *  \param keystroke A keystroke.
 *  \retval period
 *  \since 1.0
 */
static inline guint16 gaminggear_macro_keystroke_get_period(GaminggearMacroKeystroke const *keystroke) {
	return GUINT16_FROM_LE(keystroke->period);
}

/*! \brief Set period of GaminggearMacroKeystroke.
 *  \param keystroke A keystroke.
 *  \param new_value
 *  \since 1.0
 */
static inline void gaminggear_macro_keystroke_set_period(GaminggearMacroKeystroke *keystroke, guint16 new_value) {
	keystroke->period = GUINT16_TO_LE(new_value);
}

struct _GaminggearMacroKeystrokes {
	guint16 count; /*!< Stored little endian. */
	GaminggearMacroKeystroke keystrokes[GAMINGGEAR_MACRO_KEYSTROKES_NUM];
	guint8 loop;
} __attribute__ ((packed));

/*! \brief Get count from GaminggearMacroKeystrokes.
 *  \param keystrokes Keystrokes.
 *  \retval count
 *  \since 1.0
 */
static inline guint16 gaminggear_macro_keystrokes_get_count(GaminggearMacroKeystrokes const *keystrokes) {
	return GUINT16_FROM_LE(keystrokes->count);
}

/*! \brief Set count of GaminggearMacroKeystrokes.
 *  \param keystrokes Keystrokes.
 *  \param new_value
 *  \since 1.0
 */
static inline void gaminggear_macro_keystrokes_set_count(GaminggearMacroKeystrokes *keystrokes, guint16 new_value) {
	keystrokes->count = GUINT16_TO_LE(new_value);
}

/*! \brief Reset keystrokes.
 *  \param keystrokes Keystrokes.
 *  \since 1.0
 */
void gaminggear_macro_keystrokes_init(GaminggearMacroKeystrokes *keystrokes);

/*! \brief
 *  \param key_file
 *  \param macroset_name
 *  \param macro_name
 *  \param error
 *  \retval keystrokes
 *  \since 1.0
 */
GaminggearMacroKeystrokes *gaminggear_key_file_get_macro_keystrokes(GKeyFile *key_file,
		gchar const *macroset_name, gchar const *macro_name,
		GError **error);

/*! \brief Check if macro contains mouse events.
 *  \param keystrokes Keystrokes.
 *  \retval boolean \c TRUE if macro contains mouse events.
 *  \since 1.0
 */
gboolean gaminggear_macro_keystrokes_have_mouse_keystroke(GaminggearMacroKeystrokes const *keystrokes);

/*! \brief
 *  \retval keystrokes Keystrokes that have to be freed with gaminggear_macro_keystrokes_free().
 *  \since 1.0
 */
GaminggearMacroKeystrokes *gaminggear_macro_keystrokes_new(void);

/*! \brief
 *  \param keystrokes Keystrokes.
 *  \since 1.0
 */
void gaminggear_macro_keystrokes_free(GaminggearMacroKeystrokes *keystrokes);

/*! \brief
 *  \param from
 *  \param to
 *  \since 1.0
 */
void gaminggear_macro_keystrokes_copy(GaminggearMacroKeystrokes const *from, GaminggearMacroKeystrokes *to);

/*! \brief
 *  \param old
 *  \retval keystrokes Keystrokes that have to be freed with gaminggear_macro_keystrokes_free().
 *  \since 1.0
 */
GaminggearMacroKeystrokes *gaminggear_macro_keystrokes_dup(GaminggearMacroKeystrokes const *old);

/*! \brief
 *  \param keystrokes Keystrokes.
 *  \param keystroke Keystroke.
 *  \retval boolean If successful \c TRUE is returned.
 *          \c FALSE is returned if number of keystrokes is exceeded and keystroke was not added.
 *  \since 1.0
 */
gboolean gaminggear_macro_keystrokes_add(GaminggearMacroKeystrokes *keystrokes, GaminggearMacroKeystroke const *keystroke);

struct _GaminggearMacro {
	gchar *macroset, *macro;
	GaminggearMacroKeystrokes keystrokes;
};

/*! \brief Sets macroset name.
 *  \param macro
 *  \param new_name
 *  \since 1.0
 */
void gaminggear_macro_set_macroset_name(GaminggearMacro *macro, gchar const *new_name);

/*! \brief Sets macro name.
 *  \param macro
 *  \param new_name
 *  \since 1.0
 */
void gaminggear_macro_set_macro_name(GaminggearMacro *macro, gchar const *new_name);

/*! \brief Get complete name in format macroset/macro.
 *  \param macro
 *  \retval string That has to be freed with \c g_free().
 *  \since 1.0
 */
gchar *gaminggear_macro_get_name_joined(GaminggearMacro const *macro);

/*! \brief Get keystrokes of a macro.
 *  \param macro
 *  \retval keystrokes The returned struct is part of macro and should not be freed alone.
 *  \since 1.0
 */
GaminggearMacroKeystrokes *gaminggear_macro_get_keystrokes(GaminggearMacro *macro);

/*! \brief Add keystroke to macro.
 *  \param macro
 *  \param keystroke
 *  \retval boolean If successful \c TRUE is returned.
 *          \c FALSE is returned if number of keystrokes is exceeded and keystroke was not added.
 *  \since 1.0
 */
gboolean gaminggear_macro_add_keystroke(GaminggearMacro *macro, GaminggearMacroKeystroke const *keystroke);

/*! \brief Creates new macro.
 *
 *  Keystrokes can be \c NULL. In this case an empty macro is created.
 *
 *  \param macroset_name
 *  \param macro_name
 *  \param keystrokes
 *  \retval macro GaminggearMacro that has to be freed with \c gaminggear_macro_free().
 *  \since 1.0
 */
GaminggearMacro *gaminggear_macro_new(gchar const *macroset_name, gchar const *macro_name, GaminggearMacroKeystrokes const *keystrokes);

/*! \brief Duplicates a GaminggearMacro.
 *  \param gaminggear_macro
 *  \retval macro GaminggearMacro that has to be freed with \c gaminggear_macro_free().
 *  \since 1.0
*/
GaminggearMacro *gaminggear_macro_dup(GaminggearMacro const *gaminggear_macro);

/*! \brief Test if GaminggearMacro contains mouse events.
 *  \param gaminggear_macro
 *  \retval boolean \c TRUE if gaminggear_macro has mouse keystroke, \c FALSE else.
 *  \since 1.0
 */
gboolean gaminggear_macro_has_mouse_keystroke(GaminggearMacro const *gaminggear_macro);

/*! \brief Frees macro.
 *
 *  Frees the memory allocated for macro.
 *  \param macro A GaminggearMacro.
 *  \since 1.0
 */
void gaminggear_macro_free(GaminggearMacro *macro);

/*! \brief Stores macro in macros database.
 *
 *  Used to store macros generated by macro live recording.
 *
 *  \param gaminggear_macro The GaminggearMacro to be stored.
 *  \param error Return location for error or \c NULL.
 *  \retval boolean \c TRUE on success, \c FALSE on error with error set.
 *  \since 1.0
 */
gboolean gaminggear_macros_store_macro(GaminggearMacro const *gaminggear_macro, GError **error);

G_END_DECLS

#endif