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
#![allow(non_camel_case_types)]

extern crate libc;
extern crate x11;

use x11::xlib::*;
use libc::{wchar_t, useconds_t};

pub const CURRENTWINDOW: XID = 0;

/* automatically generated by rust-bindgen */

#[repr(C)]
#[derive(Copy)]
pub struct Struct_charcodemap {
    pub key: wchar_t,
    pub code: KeyCode,
    pub symbol: KeySym,
    pub group: ::libc::c_int,
    pub modmask: ::libc::c_int,
    pub needs_binding: ::libc::c_int,
}
impl ::std::clone::Clone for Struct_charcodemap {
    fn clone(&self) -> Self { *self }
}
impl ::std::default::Default for Struct_charcodemap {
    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type charcodemap_t = Struct_charcodemap;
pub type Enum_Unnamed1 = ::libc::c_uint;
pub const XDO_FEATURE_XTEST: ::libc::c_uint = 0;
pub type XDO_FEATURES = Enum_Unnamed1;
#[repr(C)]
#[derive(Copy)]
pub struct Struct_xdo {
    pub xdpy: *mut Display,
    pub display_name: *mut ::libc::c_char,
    pub charcodes: *mut charcodemap_t,
    pub charcodes_len: ::libc::c_int,
    pub keycode_high: ::libc::c_int,
    pub keycode_low: ::libc::c_int,
    pub keysyms_per_keycode: ::libc::c_int,
    pub close_display_when_freed: ::libc::c_int,
    pub quiet: ::libc::c_int,
    pub debug: ::libc::c_int,
    pub features_mask: ::libc::c_int,
}
impl ::std::clone::Clone for Struct_xdo {
    fn clone(&self) -> Self { *self }
}
impl ::std::default::Default for Struct_xdo {
    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type Enum_Unnamed2 = ::libc::c_uint;
pub const SEARCH_ANY: libc::c_uint = 0;
pub const SEARCH_ALL: libc::c_uint = 1;
pub type xdo_t = Struct_xdo;
#[repr(C)]
#[derive(Copy)]
pub struct Struct_xdo_search {
    pub title: *const ::libc::c_char,
    pub winclass: *const ::libc::c_char,
    pub winclassname: *const ::libc::c_char,
    pub winname: *const ::libc::c_char,
    pub pid: ::libc::c_int,
    pub max_depth: ::libc::c_long,
    pub only_visible: ::libc::c_int,
    pub screen: ::libc::c_int,
    pub require: Enum_Unnamed2,
    pub searchmask: ::libc::c_uint,
    pub desktop: ::libc::c_long,
    pub limit: ::libc::c_uint,
}
impl ::std::clone::Clone for Struct_xdo_search {
    fn clone(&self) -> Self { *self }
}
impl ::std::default::Default for Struct_xdo_search {
    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type xdo_search_t = Struct_xdo_search;
extern "C" {
    pub fn xdo_new(display: *const ::libc::c_char) -> *mut xdo_t;
    pub fn xdo_new_with_opened_display(xdpy: *mut Display,
                                       display: *const ::libc::c_char,
                                       close_display_when_freed:
                                           ::libc::c_int) -> *mut xdo_t;
    pub fn xdo_version() -> *const ::libc::c_char;
    pub fn xdo_free(xdo: *mut xdo_t) -> ();
    pub fn xdo_move_mouse(xdo: *const xdo_t, x: ::libc::c_int,
                          y: ::libc::c_int, screen: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_move_mouse_relative_to_window(xdo: *const xdo_t,
                                             window: Window, x: ::libc::c_int,
                                             y: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_move_mouse_relative(xdo: *const xdo_t, x: ::libc::c_int,
                                   y: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_mouse_down(xdo: *const xdo_t, window: Window,
                          button: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_mouse_up(xdo: *const xdo_t, window: Window,
                        button: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_get_mouse_location(xdo: *const xdo_t, x: *mut ::libc::c_int,
                                  y: *mut ::libc::c_int,
                                  screen_num: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_get_window_at_mouse(xdo: *const xdo_t, window_ret: *mut Window)
     -> ::libc::c_int;
    pub fn xdo_get_mouse_location2(xdo: *const xdo_t,
                                   x_ret: *mut ::libc::c_int,
                                   y_ret: *mut ::libc::c_int,
                                   screen_num_ret: *mut ::libc::c_int,
                                   window_ret: *mut Window) -> ::libc::c_int;
    pub fn xdo_wait_for_mouse_move_from(xdo: *const xdo_t,
                                        origin_x: ::libc::c_int,
                                        origin_y: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_wait_for_mouse_move_to(xdo: *const xdo_t,
                                      dest_x: ::libc::c_int,
                                      dest_y: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_click_window(xdo: *const xdo_t, window: Window,
                            button: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_click_window_multiple(xdo: *const xdo_t, window: Window,
                                     button: ::libc::c_int,
                                     repeat: ::libc::c_int, delay: useconds_t)
     -> ::libc::c_int;
    pub fn xdo_enter_text_window(xdo: *const xdo_t, window: Window,
                                 string: *const ::libc::c_char,
                                 delay: useconds_t) -> ::libc::c_int;
    pub fn xdo_send_keysequence_window(xdo: *const xdo_t, window: Window,
                                       keysequence: *const ::libc::c_char,
                                       delay: useconds_t) -> ::libc::c_int;
    pub fn xdo_send_keysequence_window_up(xdo: *const xdo_t, window: Window,
                                          keysequence: *const ::libc::c_char,
                                          delay: useconds_t) -> ::libc::c_int;
    pub fn xdo_send_keysequence_window_down(xdo: *const xdo_t, window: Window,
                                            keysequence:
                                                *const ::libc::c_char,
                                            delay: useconds_t)
     -> ::libc::c_int;
    pub fn xdo_send_keysequence_window_list_do(xdo: *const xdo_t,
                                               window: Window,
                                               keys: *mut charcodemap_t,
                                               nkeys: ::libc::c_int,
                                               pressed: ::libc::c_int,
                                               modifier: *mut ::libc::c_int,
                                               delay: useconds_t)
     -> ::libc::c_int;
    pub fn xdo_get_active_keys_to_keycode_list(xdo: *const xdo_t,
                                               keys: *mut *mut charcodemap_t,
                                               nkeys: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_wait_for_window_map_state(xdo: *const xdo_t, wid: Window,
                                         map_state: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_wait_for_window_size(xdo: *const xdo_t, window: Window,
                                    width: ::libc::c_uint,
                                    height: ::libc::c_uint,
                                    flags: ::libc::c_int,
                                    to_or_from: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_move_window(xdo: *const xdo_t, wid: Window, x: ::libc::c_int,
                           y: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_translate_window_with_sizehint(xdo: *const xdo_t,
                                              window: Window,
                                              width: ::libc::c_uint,
                                              height: ::libc::c_uint,
                                              width_ret: *mut ::libc::c_uint,
                                              height_ret: *mut ::libc::c_uint)
     -> ::libc::c_int;
    pub fn xdo_set_window_size(xdo: *const xdo_t, wid: Window,
                               w: ::libc::c_int, h: ::libc::c_int,
                               flags: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_set_window_property(xdo: *const xdo_t, wid: Window,
                                   property: *const ::libc::c_char,
                                   value: *const ::libc::c_char)
     -> ::libc::c_int;
    pub fn xdo_set_window_class(xdo: *const xdo_t, wid: Window,
                                name: *const ::libc::c_char,
                                _class: *const ::libc::c_char)
     -> ::libc::c_int;
    pub fn xdo_set_window_urgency(xdo: *const xdo_t, wid: Window,
                                  urgency: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_set_window_override_redirect(xdo: *const xdo_t, wid: Window,
                                            override_redirect: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_focus_window(xdo: *const xdo_t, wid: Window) -> ::libc::c_int;
    pub fn xdo_raise_window(xdo: *const xdo_t, wid: Window) -> ::libc::c_int;
    pub fn xdo_get_focused_window(xdo: *const xdo_t, window_ret: *mut Window)
     -> ::libc::c_int;
    pub fn xdo_wait_for_window_focus(xdo: *const xdo_t, window: Window,
                                     want_focus: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_get_pid_window(xdo: *const xdo_t, window: Window)
     -> ::libc::c_int;
    pub fn xdo_get_focused_window_sane(xdo: *const xdo_t,
                                       window_ret: *mut Window)
     -> ::libc::c_int;
    pub fn xdo_activate_window(xdo: *const xdo_t, wid: Window)
     -> ::libc::c_int;
    pub fn xdo_wait_for_window_active(xdo: *const xdo_t, window: Window,
                                      active: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_map_window(xdo: *const xdo_t, wid: Window) -> ::libc::c_int;
    pub fn xdo_unmap_window(xdo: *const xdo_t, wid: Window) -> ::libc::c_int;
    pub fn xdo_minimize_window(xdo: *const xdo_t, wid: Window)
     -> ::libc::c_int;
    pub fn xdo_reparent_window(xdo: *const xdo_t, wid_source: Window,
                               wid_target: Window) -> ::libc::c_int;
    pub fn xdo_get_window_location(xdo: *const xdo_t, wid: Window,
                                   x_ret: *mut ::libc::c_int,
                                   y_ret: *mut ::libc::c_int,
                                   screen_ret: *mut *mut Screen)
     -> ::libc::c_int;
    pub fn xdo_get_window_size(xdo: *const xdo_t, wid: Window,
                               width_ret: *mut ::libc::c_uint,
                               height_ret: *mut ::libc::c_uint)
     -> ::libc::c_int;
    pub fn xdo_get_active_window(xdo: *const xdo_t, window_ret: *mut Window)
     -> ::libc::c_int;
    pub fn xdo_select_window_with_click(xdo: *const xdo_t,
                                        window_ret: *mut Window)
     -> ::libc::c_int;
    pub fn xdo_set_number_of_desktops(xdo: *const xdo_t,
                                      ndesktops: ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_get_number_of_desktops(xdo: *const xdo_t,
                                      ndesktops: *mut ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_set_current_desktop(xdo: *const xdo_t, desktop: ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_get_current_desktop(xdo: *const xdo_t,
                                   desktop: *mut ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_set_desktop_for_window(xdo: *const xdo_t, wid: Window,
                                      desktop: ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_get_desktop_for_window(xdo: *const xdo_t, wid: Window,
                                      desktop: *mut ::libc::c_long)
     -> ::libc::c_int;
    pub fn xdo_search_windows(xdo: *const xdo_t, search: *const xdo_search_t,
                              windowlist_ret: *mut *mut Window,
                              nwindows_ret: *mut ::libc::c_uint)
     -> ::libc::c_int;
    pub fn xdo_get_window_property_by_atom(xdo: *const xdo_t, window: Window,
                                           atom: Atom,
                                           nitems: *mut ::libc::c_long,
                                           _type: *mut Atom,
                                           size: *mut ::libc::c_int)
     -> *mut ::libc::c_uchar;
    pub fn xdo_get_window_property(xdo: *const xdo_t, window: Window,
                                   property: *const ::libc::c_char,
                                   value: *mut *mut ::libc::c_uchar,
                                   nitems: *mut ::libc::c_long,
                                   _type: *mut Atom, size: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_get_input_state(xdo: *const xdo_t) -> ::libc::c_uint;
    pub fn xdo_get_symbol_map() -> *mut *const ::libc::c_char;
    pub fn xdo_get_active_modifiers(xdo: *const xdo_t,
                                    keys: *mut *mut charcodemap_t,
                                    nkeys: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_clear_active_modifiers(xdo: *const xdo_t, window: Window,
                                      active_mods: *mut charcodemap_t,
                                      active_mods_n: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_set_active_modifiers(xdo: *const xdo_t, window: Window,
                                    active_mods: *mut charcodemap_t,
                                    active_mods_n: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_get_desktop_viewport(xdo: *const xdo_t,
                                    x_ret: *mut ::libc::c_int,
                                    y_ret: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_set_desktop_viewport(xdo: *const xdo_t, x: ::libc::c_int,
                                    y: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_kill_window(xdo: *const xdo_t, window: Window)
     -> ::libc::c_int;
    pub fn xdo_find_window_client(xdo: *const xdo_t, window: Window,
                                  window_ret: *mut Window,
                                  direction: ::libc::c_int) -> ::libc::c_int;
    pub fn xdo_get_window_name(xdo: *const xdo_t, window: Window,
                               name_ret: *mut *mut ::libc::c_uchar,
                               name_len_ret: *mut ::libc::c_int,
                               name_type: *mut ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_disable_feature(xdo: *mut xdo_t, feature: ::libc::c_int) -> ();
    pub fn xdo_enable_feature(xdo: *mut xdo_t, feature: ::libc::c_int) -> ();
    pub fn xdo_has_feature(xdo: *mut xdo_t, feature: ::libc::c_int)
     -> ::libc::c_int;
    pub fn xdo_get_viewport_dimensions(xdo: *mut xdo_t,
                                       width: *mut ::libc::c_uint,
                                       height: *mut ::libc::c_uint,
                                       screen: ::libc::c_int)
     -> ::libc::c_int;
}