All XCB demos compile and work after the Great Renaming.
[free-sw/xcb/demo] / dpms.c
1 /*
2  * Copyright (C) 2001-2005 Bart Massey and Jamey Sharp.
3  * All Rights Reserved.  See the file COPYING in this directory
4  * for licensing information.
5  */
6
7 #include <X11/XCB/xcb.h>
8 #include <X11/XCB/dpms.h>
9 #include <assert.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12
13 int main(int argc, char **argv)
14 {
15         xcb_connection_t *c = xcb_connect(0, 0);
16         xcb_dpms_get_version_cookie_t vc;
17         xcb_dpms_get_version_reply_t *ver;
18         xcb_dpms_capable_cookie_t cc;
19         xcb_dpms_capable_reply_t *cap;
20         xcb_dpms_get_timeouts_cookie_t tc;
21         xcb_dpms_get_timeouts_reply_t *time;
22
23         xcb_prefetch_extension_data(c, &xcb_dpms_id);
24
25         vc = xcb_dpms_get_version(c, 1, 1);
26         cc = xcb_dpms_capable(c);
27         tc = xcb_dpms_get_timeouts(c);
28
29         ver = xcb_dpms_get_version_reply(c, vc, 0);
30         cap = xcb_dpms_capable_reply(c, cc, 0);
31         time = xcb_dpms_get_timeouts_reply(c, tc, 0);
32
33         assert(ver);
34         assert(ver->server_major_version == 1);
35         assert(ver->server_minor_version == 1);
36         free(ver);
37
38         assert(cap);
39         assert(cap->capable);
40         free(cap);
41
42         assert(time);
43         printf("Standby: %d\n" "Suspend: %d\n" "Off: %d\n",
44                 time->standby_timeout, time->suspend_timeout, time->off_timeout);
45         free(time);
46
47         xcb_disconnect(c);
48
49         exit(0);
50         /*NOTREACHED*/
51 }