summaryrefslogtreecommitdiff
path: root/tests/test-webcam-button.c
blob: 1fe39a23ff4226a132004180d9326ef3521c4db0 (plain)
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
/* 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);
  return 0;
}