summaryrefslogtreecommitdiff
path: root/src/wm-tester/focus-window.c
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 23:52:01 -0300
committerPerberos <[email protected]>2011-12-01 23:52:01 -0300
commit28a029a4990d2a84f9d6a0b890eba812ea503998 (patch)
tree7a69477d0dd6bf351801fa9698d95224e4fe47b6 /src/wm-tester/focus-window.c
downloadmarco-28a029a4990d2a84f9d6a0b890eba812ea503998.tar.bz2
marco-28a029a4990d2a84f9d6a0b890eba812ea503998.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'src/wm-tester/focus-window.c')
-rw-r--r--src/wm-tester/focus-window.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/wm-tester/focus-window.c b/src/wm-tester/focus-window.c
new file mode 100644
index 00000000..dc33bd25
--- /dev/null
+++ b/src/wm-tester/focus-window.c
@@ -0,0 +1,37 @@
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char **argv)
+{
+ Display *d;
+ Window w;
+ const char *w_str;
+ char *end;
+
+ if (argc != 2)
+ {
+ fprintf (stderr, "Usage: focus-window WINDOWID\n");
+ exit (1);
+ }
+
+ d = XOpenDisplay (NULL);
+
+ w_str = argv[1];
+ end = NULL;
+
+ w = strtoul (w_str, &end, 16);
+ if (end == w_str)
+ {
+ fprintf (stderr, "Usage: focus-window WINDOWID\n");
+ exit (1);
+ }
+
+ printf ("Setting input focus to 0x%lx\n", w);
+ XSetInputFocus (d, w, RevertToPointerRoot, CurrentTime);
+ XFlush (d);
+
+ return 0;
+}
+