diff options
author | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-06-21 10:58:26 +0200 |
---|---|---|
committer | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-06-21 10:58:26 +0200 |
commit | b6752fc4a010ced8a3969d6962c1f46e2e697020 (patch) | |
tree | 11917453a15ddd5de3dcc9dc5591a2c5ccf2b645 /tools | |
parent | de0114556cef148c396552d1c189b476ea0c8aab (diff) | |
download | cheese-b6752fc4a010ced8a3969d6962c1f46e2e697020.tar.gz |
tools: add little program to emit fake webcam button events
Diffstat (limited to 'tools')
-rw-r--r-- | tools/test-webcam-button.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/test-webcam-button.c b/tools/test-webcam-button.c new file mode 100644 index 00000000..b055c03d --- /dev/null +++ b/tools/test-webcam-button.c @@ -0,0 +1,21 @@ +/* emit foo webcam button event */ +/* gcc -o test-webcam-button test-webcam-button.c -lX11 -lXtst */ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/extensions/XTest.h> +#include <X11/XF86keysym.h> + +int main (void) +{ + Display *dpy; + dpy = XOpenDisplay (NULL); + + printf ("Emitting fake Webcam button press in 2 seconds...\n"); + printf ("Focus Cheese window to make it receive the event\n"); + + XTestFakeKeyEvent (dpy, XKeysymToKeycode(dpy, XF86XK_WebCam), True, 2000); + XTestFakeKeyEvent (dpy, XKeysymToKeycode(dpy, XF86XK_WebCam), False, CurrentTime); + + XCloseDisplay (dpy); +} |