2 e573cb09 2020-09-27 op * Copyright (c) 2020 Omar Polo <op@omarpolo.com>
4 e573cb09 2020-09-27 op * Permission to use, copy, modify, and distribute this software for any
5 e573cb09 2020-09-27 op * purpose with or without fee is hereby granted, provided that the above
6 e573cb09 2020-09-27 op * copyright notice and this permission notice appear in all copies.
8 e573cb09 2020-09-27 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 e573cb09 2020-09-27 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 e573cb09 2020-09-27 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 e573cb09 2020-09-27 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 e573cb09 2020-09-27 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 e573cb09 2020-09-27 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 e573cb09 2020-09-27 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 e573cb09 2020-09-27 op #ifndef STAR_PLATINUM_H
18 e573cb09 2020-09-27 op #define STAR_PLATINUM_H
20 e573cb09 2020-09-27 op /* XXX: why I need to define this to get XK_space/...?
21 e573cb09 2020-09-27 op * is this a bad idea? there is another way? */
22 e573cb09 2020-09-27 op #define XK_LATIN1
23 e573cb09 2020-09-27 op #define XK_MISCELLANY
25 e573cb09 2020-09-27 op #include <X11/Xlib.h>
27 e573cb09 2020-09-27 op #include <err.h>
28 e573cb09 2020-09-27 op #include <stdlib.h>
30 13cc0916 2020-09-30 op void yyerror(const char*, ...);
33 e573cb09 2020-09-27 op unsigned int modifier;
37 e573cb09 2020-09-27 op struct action {
38 e573cb09 2020-09-27 op #define ASPECIAL 1
39 e573cb09 2020-09-27 op #define AFAKE 2
40 e0041ee5 2020-10-01 op #define AEXEC 3
43 e0041ee5 2020-10-01 op #define ATOGGLE 1
44 e0041ee5 2020-10-01 op #define AACTIVATE 2
45 e0041ee5 2020-10-01 op #define ADEACTIVATE 3
46 e0041ee5 2020-10-01 op #define AIGNORE 4
48 e573cb09 2020-09-27 op struct key send_key;
53 2eb11d8e 2020-10-04 op void do_action(struct action, Window, XKeyEvent*);
54 e0041ee5 2020-10-01 op void free_action(struct action);
56 e573cb09 2020-09-27 op struct match {
57 9f53ba9b 2020-09-29 op #define MANY 1
58 9f53ba9b 2020-09-29 op #define MCLASS 2
61 e573cb09 2020-09-27 op struct match *next;
64 e573cb09 2020-09-27 op struct match *new_match(int, char*);
65 e573cb09 2020-09-27 op void recfree_match(struct match*);
66 e573cb09 2020-09-27 op int match_window(struct match*, Window);
69 e573cb09 2020-09-27 op struct key key;
70 e573cb09 2020-09-27 op struct action action;
71 e573cb09 2020-09-27 op struct rule *next;
74 e573cb09 2020-09-27 op struct rule *new_rule(struct key, struct action);
75 e573cb09 2020-09-27 op void recfree_rule(struct rule*);
76 e573cb09 2020-09-27 op int rule_matched(struct rule*, struct key);
78 e573cb09 2020-09-27 op struct group {
79 e573cb09 2020-09-27 op struct match *matches;
80 e573cb09 2020-09-27 op struct rule *rules;
81 e573cb09 2020-09-27 op struct group *next;
84 e573cb09 2020-09-27 op extern struct group *config;
86 e573cb09 2020-09-27 op struct group *new_group(struct match*, struct rule*);
87 e573cb09 2020-09-27 op void recfree_group(struct group*);
88 e573cb09 2020-09-27 op void process_event(struct group*, XKeyEvent*);
89 e573cb09 2020-09-27 op int group_match(struct group*, Window);
91 e573cb09 2020-09-27 op /* xlib-related */
92 fe0dcf4e 2020-09-29 op int error_handler(Display*, XErrorEvent*);
93 c85d4bf3 2020-10-08 op void grabkey(struct key, Window);
94 c21d6eaf 2020-10-08 op void grab_matching_keys(Window);
95 c21d6eaf 2020-10-08 op int grabkey_matching_windows();
96 e573cb09 2020-09-27 op KeySym keycode_to_keysym(unsigned int);
97 e573cb09 2020-09-27 op Window focused_window();
98 2eb11d8e 2020-10-04 op void send_fake(Window, struct key, XKeyEvent*);
99 e573cb09 2020-09-27 op int window_match_class(Window, const char*);
101 e573cb09 2020-09-27 op /* debugging */
102 e573cb09 2020-09-27 op void printkey(struct key);
103 e573cb09 2020-09-27 op void printaction(struct action);
104 e573cb09 2020-09-27 op void printmatch(struct match*);
105 e573cb09 2020-09-27 op void printrule(struct rule*);
106 e573cb09 2020-09-27 op void printgroup(struct group*);
108 e573cb09 2020-09-27 op #endif /* STAR_PLATINUM_H */