2 * Copyright (c) 2007 Daniel Borca All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 test_keys (Display
*dpy
, int num
, KTUPLE keys
[])
34 void (*old_sig_handler
) (int) = signal(SIGCHLD
, xhk_sig_handler
);
37 XErrorHandler old_eks_handler
= XSetErrorHandler(xhk_eks_handler
);
41 XNextEvent(dpy
, &evt
);
42 xhk_run(dpy
, &evt
, num
, keys
);
45 XSetErrorHandler(old_eks_handler
);
48 signal(SIGCHLD
, old_sig_handler
);
54 main (int argc
, char **argv
)
63 display
= XOpenDisplay(NULL
);
64 if (display
== NULL
) {
65 fprintf(stderr
, "cannot open display\n");
69 n
= xhk_parse(argc
, argv
, &keys
);
71 fprintf(stderr
, "no keys\n");
75 rv
= xhk_grab(display
, n
, keys
);
77 printf("cannot grab keys\n");
81 test_keys(display
, n
, keys
);
87 XCloseDisplay(display
);
94 XCloseDisplay(display
);