Code sync
[apps/native/starter.git] / test / get_entry.c
1  /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *     http://www.tizenopensource.org/license
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17
18
19 #include <stdio.h>
20 #include <X11/Xlib.h>
21 #include <X11/Xatom.h>
22 #include <X11/Xutil.h>
23
24 int main(int argc, char *argv[])
25 {
26         unsigned char *prop_ret;
27         Atom type_ret;
28         unsigned long bytes_after, num_ret;
29         int format_ret;
30         unsigned int i;
31         int num;
32
33         Display *d;
34         Atom a_ac;
35         Atom a_ap;
36         Status r;
37
38         d = XOpenDisplay(NULL);
39         if (d == NULL) {
40                 printf("Display open error\n");
41                 return 1;
42         }
43
44         a_ac = XInternAtom(d, "ENLIGHTENMENT_AUTOCAPITAL_ALLOW", False);
45         if (a_ac == None) {
46                 printf("XInternAtom error\n");
47                 goto exit;
48         }
49
50         r = XGetWindowProperty(d, DefaultRootWindow(d), a_ac, 0, 0x7fffffff,
51                                False, XA_CARDINAL, &type_ret, &format_ret,
52                                &num_ret, &bytes_after, &prop_ret);
53         if (r != Success) {
54                 printf("XGetWindowProperty error\n");
55                 goto exit;
56         }
57
58         if (type_ret == XA_CARDINAL && format_ret == 32 && num_ret > 0
59             && prop_ret) {
60                 printf("Auto capital: %lu\n", ((unsigned long *)prop_ret)[0]);
61         }
62         if (prop_ret)
63                 XFree(prop_ret);
64
65         a_ap = XInternAtom(d, "ENLIGHTENMENT_AUTOPERIOD_ALLOW", False);
66         if (a_ap == None) {
67                 printf("XInternAtom error\n");
68                 goto exit;
69         }
70
71         r = XGetWindowProperty(d, DefaultRootWindow(d), a_ap, 0, 0x7fffffff,
72                                False, XA_CARDINAL, &type_ret, &format_ret,
73                                &num_ret, &bytes_after, &prop_ret);
74         if (r != Success) {
75                 printf("XGetWindowProperty error\n");
76                 goto exit;
77         }
78
79         if (type_ret == XA_CARDINAL && format_ret == 32 && num_ret > 0
80             && prop_ret) {
81                 printf("Auto period: %lu\n", ((unsigned long *)prop_ret)[0]);
82         }
83         if (prop_ret)
84                 XFree(prop_ret);
85
86  exit:
87         XCloseDisplay(d);
88         return 0;
89 }