]> Pileus Git - ~andy/gtk/blob - gdk/x11/xsettings-common.h
Make gdkx.h the only installed header from gdk/x11. All structures in
[~andy/gtk] / gdk / x11 / xsettings-common.h
1 /*
2  * Copyright © 2001 Red Hat, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of Red Hat not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  Red Hat makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as is"
12  * without express or implied warranty.
13  *
14  * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
16  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  * Author:  Owen Taylor, Red Hat, Inc.
22  */
23 #ifndef XSETTINGS_COMMON_H
24 #define XSETTINGS_COMMON_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 /* Renames for GDK inclusion */
31
32 #define xsettings_byte_order           _gdk_xsettings_byte_order
33 #define xsettings_client_destroy       _gdk_xsettings_client_destroy
34 #define xsettings_client_get_setting   _gdk_xsettings_client_get_setting
35 #define xsettings_client_new           _gdk_xsettings_client_new
36 #define xsettings_client_process_event _gdk_xsettings_client_process_event
37 #define xsettings_list_copy            _gdk_xsettings_list_copy
38 #define xsettings_list_delete          _gdk_xsettings_list_delete
39 #define xsettings_list_free            _gdk_xsettings_list_free
40 #define xsettings_list_insert          _gdk_xsettings_list_insert
41 #define xsettings_list_lookup          _gdk_xsettings_list_lookup
42 #define xsettings_setting_copy         _gdk_xsettings_setting_copy
43 #define xsettings_setting_equal        _gdk_xsettings_setting_equal
44 #define xsettings_setting_free         _gdk_xsettings_setting_free
45
46
47 typedef struct _XSettingsBuffer  XSettingsBuffer;
48 typedef struct _XSettingsColor   XSettingsColor;
49 typedef struct _XSettingsList    XSettingsList;
50 typedef struct _XSettingsSetting XSettingsSetting;
51
52 /* Types of settings possible. Enum values correspond to
53  * protocol values.
54  */
55 typedef enum 
56 {
57   XSETTINGS_TYPE_INT     = 0,
58   XSETTINGS_TYPE_STRING  = 1,
59   XSETTINGS_TYPE_COLOR   = 2
60 } XSettingsType;
61
62 typedef enum
63 {
64   XSETTINGS_SUCCESS,
65   XSETTINGS_NO_MEM,
66   XSETTINGS_ACCESS,
67   XSETTINGS_FAILED,
68   XSETTINGS_NO_ENTRY,
69   XSETTINGS_DUPLICATE_ENTRY
70 } XSettingsResult;
71
72 struct _XSettingsBuffer
73 {
74   char byte_order;
75   size_t len;
76   unsigned char *data;
77   unsigned char *pos;
78 };
79
80 struct _XSettingsColor
81 {
82   unsigned short red, green, blue, alpha;
83 };
84
85 struct _XSettingsList
86 {
87   XSettingsSetting *setting;
88   XSettingsList *next;
89 };
90
91 struct _XSettingsSetting
92 {
93   char *name;
94   XSettingsType type;
95   
96   union {
97     int v_int;
98     char *v_string;
99     XSettingsColor v_color;
100   } data;
101
102   unsigned long last_change_serial;
103 };
104
105 XSettingsSetting *xsettings_setting_copy  (XSettingsSetting *setting);
106 void              xsettings_setting_free  (XSettingsSetting *setting);
107 int               xsettings_setting_equal (XSettingsSetting *setting_a,
108                                            XSettingsSetting *setting_b);
109
110 void              xsettings_list_free   (XSettingsList     *list);
111 XSettingsList    *xsettings_list_copy   (XSettingsList     *list);
112 XSettingsResult   xsettings_list_insert (XSettingsList    **list,
113                                          XSettingsSetting  *setting);
114 XSettingsSetting *xsettings_list_lookup (XSettingsList     *list,
115                                          const char        *name);
116 XSettingsResult   xsettings_list_delete (XSettingsList    **list,
117                                          const char        *name);
118
119 char xsettings_byte_order (void);
120
121 #define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126
127 #endif /* XSETTINGS_COMMON_H */