added a Makefile to use it as a C library. no python dependencies. added 2 example...
[rofl0r-libxauto.git] / src / xaut_types.h
blobbfa79738886f32cf6325dc04224028ab91ca189f
1 /***************************************************************************
2 * Copyright (C) 2009 by Chris Parker *
3 * chrsprkr3@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the Python License version 2.5 or later. *
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. *
11 ***************************************************************************/
14 $URL$
15 $Author$
16 $Date$
17 $Rev$
20 #ifndef XAUT_TYPES_H_
21 #define XAUT_TYPES_H_
22 #include <regex.h>
24 /**
25 * Structure of global values.
26 * <ul>
27 * <li>display is a pointer to the current display.</li>
28 * <li>dsp_width is a constant value of the display width.</li>
29 * <li>dsp_height is a constant value of the display height.</li>
31 * <li>mouse_move_delay is how long to wait between at each pixel movement in milliseconds.
32 * 0 means move the mouse instantly. 10 is the default, and moves the mouse fairly
33 * rapidly. 100 is the maximum, and moves the mouse very slowly.</li>
34 * <li>mouse_down_delay is how long the mouse button stays down when "clicked" in milliseconds</li>
35 * <li>mouse_click_delay is the number of milliseconds delay between clicks in a multi-click event</li>
36 * <li>key_down_delay is how long a key stays down in milliseconds when "pressed"</li>
37 * <li>key_click_delay is the number of milliseconds between keystrokes when multiple keys are sent</li>
38 * <li>interpret_meta_symbols is a boolean indication of whether to interpret
39 * key meta symbols like !#^+{}.</li>
40 * <li>window_switch_command the keystroke command combination used to
41 * switch windows (defaults to !{Tab})</li>
43 * <li>verbose output status messages</li>
44 * <li>extra_verbose output LOTS of messages</li>
45 * </ul>
47 typedef struct {
48 // These remain constant while program in use
49 Display *display;
50 int dsp_width;
51 int dsp_height;
53 //These can be changed by the user
54 unsigned short mouse_move_delay;
55 unsigned short mouse_down_delay;
56 unsigned short mouse_click_delay;
57 unsigned short key_down_delay;
58 unsigned short key_click_delay;
59 BOOL interpret_meta_symbols;
60 unsigned short log_level;
61 } xautpy_defaults_t;
63 /**
64 * A structure of ascii codes which can be sent directly.
65 * This is basically anything that can be typed at the keyboard
66 * without using any strange Vulcan neck pinch key stroke combos.
67 * For example "a" can be sent, while the Unicode symbol for the
68 * British pound sign cannot (at least not on EN_US keyboards).
70 * If it is necessary to use a Vulcan neck pinch key combo to put the
71 * character in a document, then that key combo should be simulated
72 * using {KEY_SYMBOL} methodology.
74 typedef struct {
75 char ascii;
76 KeyCode code;
77 BOOL shifted;
78 } xautpy_ascii_t;
80 /**
81 * A structure which contains information about an extracted meta key.
82 * The intention is that the meta key will be between braces. The
83 * count will be between the braces, after a space. So for example the
84 * meta entry {Tab 3} means three tabs. Note that the name is case
85 * sensitive.
87 typedef struct {
88 char *name;
89 KeyCode keycode;
90 KeySym keysym;
91 BOOL shifted;
92 unsigned short count;
93 } xautpy_meta_t;
95 /**
96 * Contains the parameters for recursive window searches.
97 * Used only internally. Makes it easier to have
98 * some values remain constant through a recursive
99 * function.<ul>
100 * <li>current - the current window we are looking at</li>
101 * <li>buffer_size - the number of elements the buffer can hold</li>
102 * <li>found - the nuber of elements found</li>
103 * <li>buffer - a buffer of windows which meet our search criteria</li>
105 typedef struct {
106 Window current;
107 unsigned int buffer_size;
108 unsigned int found;
109 char *title;
110 regex_t **regx;
111 Window *buffer;
112 } _window_search;
114 //Used internally so that I don't have a bunch of "1000"s around
115 static const int MILLI_MULTIPLIER = 1000;
117 // Globals - not published
118 xautpy_defaults_t *defaults;
119 xautpy_ascii_t *ascii_codes;
121 // Codes for meta keys
122 KeySym SHIFT_L;
123 KeySym CONTROL_L;
124 KeySym ALT_L;
125 KeySym META_L;
127 #endif /* XAUT_TYPES_H_ */