Code sync
[apps/native/starter.git] / test / set_theme.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 <string.h>
20
21 #include <X11/Xlib.h>
22 #include <X11/Xatom.h>
23 #include <X11/Xutil.h>
24
25 void set_elm_theme(void)
26 {
27         char *theme;
28         Display *d;
29         Atom a_e17;
30         Atom a_UTF8;
31         XTextProperty xtp;
32
33         theme = "beat:kessler";
34
35         d = XOpenDisplay(NULL);
36         if (d == NULL)
37                 return;
38
39         a_e17 = XInternAtom(d, "ENLIGHTENMENT_THEME", False);
40         if (a_e17 == None)
41                 goto exit;
42
43         a_UTF8 = XInternAtom(d, "UTF8_STRING", False);
44         if (a_UTF8 == None)
45                 goto exit;
46
47         xtp.value = (unsigned char *)theme;
48         xtp.format = 8;
49         xtp.encoding = a_UTF8;
50         xtp.nitems = strlen(theme);
51
52         XSetTextProperty(d, DefaultRootWindow(d), &xtp, a_e17);
53
54  exit:
55         XCloseDisplay(d);
56 }
57
58 int main(int argc, char *argv[])
59 {
60         set_elm_theme();
61         return 0;
62 }