-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf_queue.h
More file actions
32 lines (28 loc) · 1.97 KB
/
f_queue.h
File metadata and controls
32 lines (28 loc) · 1.97 KB
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
/** @file */
#ifndef F_QUEUE_H_INCLUDED
#define F_QUEUE_H_INCLUDED
/** The core, most significant structure of the program. <b>f_queue</b> is a doubly linked list that if needed shifts itself into cyclic doubly linked list.
<b>f_queue</b> resembles queue-alike structure.
Each <b>f_queue</b> node describes a function call that needs to be performed when playing the saved recording.
@warning There are three types of function descriptions:
- Type 1: corresponding to cursor's position
- Type 2: corresponding to registered keystrokes (including mouse device)
- Type 3: corresponding to setting the registered duration in between mouse's movements and keystrokes
@warning Each node has up to two function arguments. */
struct f_queue {
short f_type; ///< Describes one of three available function types to be registered (thanks to this, we know which function call should be executed during playback phase)
int f_args[2]; ///< Describes up to two function arguments to be inserted into function call during playback phase
struct f_queue *next, *prev; ///< Pointers to the next and previous <b>f_type</b> nodes
};
/** Main structure which is filled during recording.
* Contains data organized in proper order representing corresponding function calls:
* - which keys were pressed
* - sleeps' durations
* - cursor's positions
* In order to make the queue <b>as short as possible</b>, and hence save memory, when idle during recording process:
* - the sleep's duration is summed up with previous one into one larger value, repeated until keypress/mouse movement occured
* - cursos's position is added if and only if the cursor had moved since previous cursor position's registration
* - keypresses are assumed to be <b>instantaneous</b>, hence prolonged keypresses are <b>neglected</b> (assumed as one keypress)
* Structure is filled by record() and then used for replay of the recording by play_recording().
*/
#endif // F_QUEUE_H_INCLUDED