File: test-webcam-button.c

package info (click to toggle)
cheese 44.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,312 kB
  • sloc: ansic: 6,621; xml: 293; sh: 183; python: 55; makefile: 21
file content (25 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (8)
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;
}