| 1 | /* |
|---|
| 2 | * xdo library header |
|---|
| 3 | * - include this if you have code that uses xdo |
|---|
| 4 | * |
|---|
| 5 | * $Id: xdo.h 1947 2008-06-16 03:41:25Z jordansissel $ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #include <X11/Xlib.h> |
|---|
| 9 | |
|---|
| 10 | #define SEARCH_VISIBLEONLY (1L << 0) |
|---|
| 11 | #define SEARCH_TITLE (1L << 1) |
|---|
| 12 | #define SEARCH_CLASS (1L << 2) |
|---|
| 13 | #define SEARCH_NAME (1L << 3) |
|---|
| 14 | |
|---|
| 15 | #define SEARCH_IGNORE_TRANSIENTS (1L << 4) |
|---|
| 16 | #define SEARCH_IGNORE_WINDOW_INPUTONLY (1L << 5) |
|---|
| 17 | |
|---|
| 18 | #define SIZE_USEHINTS (1L << 0) |
|---|
| 19 | |
|---|
| 20 | /* Map keysym name to actual ascii */ |
|---|
| 21 | typedef struct keysymcharmap { |
|---|
| 22 | const char *keysym; |
|---|
| 23 | char key; |
|---|
| 24 | } keysymcharmap_t; |
|---|
| 25 | |
|---|
| 26 | /* map character to keycode */ |
|---|
| 27 | typedef struct charcodemap { |
|---|
| 28 | char key; |
|---|
| 29 | int code; |
|---|
| 30 | int shift; |
|---|
| 31 | } charcodemap_t; |
|---|
| 32 | |
|---|
| 33 | typedef struct xdo { |
|---|
| 34 | Display *xdpy; |
|---|
| 35 | char *display_name; |
|---|
| 36 | charcodemap_t *charcodes; |
|---|
| 37 | int keycode_high; /* highest and lowest keycodes */ |
|---|
| 38 | int keycode_low; /* used by this X server */ |
|---|
| 39 | |
|---|
| 40 | int close_display_when_freed; |
|---|
| 41 | } xdo_t; |
|---|
| 42 | |
|---|
| 43 | xdo_t* xdo_new(char *display); |
|---|
| 44 | xdo_t* xdo_new_with_opened_display(Display *xdpy, const char *display, |
|---|
| 45 | int close_display_when_freed); |
|---|
| 46 | void xdo_free(xdo_t *xdo); |
|---|
| 47 | |
|---|
| 48 | int xdo_mousemove(xdo_t *xdo, int x, int y); |
|---|
| 49 | int xdo_mousemove_relative(xdo_t *xdo, int x, int y); |
|---|
| 50 | int xdo_mousedown(xdo_t *xdo, int button); |
|---|
| 51 | int xdo_mouseup(xdo_t *xdo, int button); |
|---|
| 52 | int xdo_mouselocation(xdo_t *xdo, int *x, int *y, int *screen_num); |
|---|
| 53 | |
|---|
| 54 | int xdo_click(xdo_t *xdo, int button); |
|---|
| 55 | |
|---|
| 56 | int xdo_type(xdo_t *xdo, char *string); |
|---|
| 57 | int xdo_keysequence(xdo_t *xdo, char *keysequence); |
|---|
| 58 | int xdo_keysequence_up(xdo_t *xdo, char *keysequence); |
|---|
| 59 | int xdo_keysequence_down(xdo_t *xdo, char *keysequence); |
|---|
| 60 | |
|---|
| 61 | int xdo_window_move(xdo_t *xdo, Window wid, int x, int y); |
|---|
| 62 | int xdo_window_setsize(xdo_t *xdo, Window wid, int w, int h, int flags); |
|---|
| 63 | int xdo_window_focus(xdo_t *xdo, Window wid); |
|---|
| 64 | int xdo_window_raise(xdo_t *xdo, Window wid); |
|---|
| 65 | int xdo_window_get_focus(xdo_t *xdo, Window *window_ret); |
|---|
| 66 | int xdo_window_activate(xdo_t *xdo, Window wid); |
|---|
| 67 | |
|---|
| 68 | int xdo_window_map(xdo_t *xdo, Window wid); |
|---|
| 69 | int xdo_window_unmap(xdo_t *xdo, Window wid); |
|---|
| 70 | |
|---|
| 71 | /* pager-like behaviors */ |
|---|
| 72 | int xdo_window_get_active(xdo_t *xdo, Window *window_ret); |
|---|
| 73 | int xdo_set_number_of_desktops(xdo_t *xdo, long ndesktops); |
|---|
| 74 | int xdo_get_number_of_desktops(xdo_t *xdo, long *ndesktops); |
|---|
| 75 | int xdo_set_current_desktop(xdo_t *xdo, long desktop); |
|---|
| 76 | int xdo_get_current_desktop(xdo_t *xdo, long *desktop); |
|---|
| 77 | int xdo_set_desktop_for_window(xdo_t *xdo, Window wid, long desktop); |
|---|
| 78 | int xdo_get_desktop_for_window(xdo_t *xdo, Window wid, long *desktop); |
|---|
| 79 | |
|---|
| 80 | /* Returns: windowlist and nwindows */ |
|---|
| 81 | int xdo_window_list_by_regex(xdo_t *xdo, char *regex, int flags, |
|---|
| 82 | Window **windowlist, int *nwindows); |
|---|