forked from wmutils/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpfw.c
More file actions
40 lines (30 loc) · 649 Bytes
/
pfw.c
File metadata and controls
40 lines (30 loc) · 649 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* See LICENSE file for copyright and license details. */
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include "util.h"
static xcb_connection_t *conn;
static xcb_window_t focus_window(void);
static xcb_window_t
focus_window(void)
{
xcb_window_t w = 0;
xcb_get_input_focus_cookie_t c;
xcb_get_input_focus_reply_t *r;
c = xcb_get_input_focus(conn);
r = xcb_get_input_focus_reply(conn, c, NULL);
if (r == NULL)
errx(1, "xcb_get_input_focus");
w = r->focus;
free(r);
return w;
}
int
main(int argc, char **argv)
{
init_xcb(&conn);
printf("0x%08x\n", focus_window());
kill_xcb(&conn);
return 0;
}