edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

XSettingsCommon.h
1 /*
2 * $Id: XSettingsCommon.h 2839 2009-09-28 11:36:20Z karijes $
3 *
4 * Common stuff for XSETTINGS protocol
5 * Based on implementation from Owen Tylor, copyright (c) 2001 Red Hat, inc.
6 * Copyright (c) 2005-2007 edelib authors
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef __EDELIB_XSETTINGSCOMMON_H__
23 #define __EDELIB_XSETTINGSCOMMON_H__
24
25 #include "edelib-global.h"
26 #include <X11/Xlib.h>
27
28 #define XSETTINGS_PAD(n, p) ((n + p - 1) & (~(p - 1)))
29
30 EDELIB_NS_BEGIN
31
36 enum XSettingsType {
37 XSETTINGS_TYPE_INT = 0,
38 XSETTINGS_TYPE_STRING,
39 XSETTINGS_TYPE_COLOR
40 };
41
46 struct XSettingsColor {
48 unsigned short red;
50 unsigned short green;
52 unsigned short blue;
54 unsigned short alpha;
55 };
56
61 struct XSettingsSetting {
63 char* name;
65 XSettingsType type;
66
68 union {
69 int v_int;
70 char* v_string;
71 XSettingsColor v_color;
72 } data;
73
75 unsigned long last_change_serial;
76 };
77
82 struct XSettingsList {
84 XSettingsSetting* setting;
86 XSettingsList* next;
87 };
88
122 struct XSettingsData {
124 Display* display;
126 int screen;
127
129 Window manager_win;
130
132 Atom selection_atom;
133
135 Atom manager_atom;
136
138 Atom xsettings_atom;
139
141 XSettingsList* settings;
142
144 unsigned long serial;
145 };
146
147 #ifndef SKIP_DOCS
148 struct XSettingsBuffer {
149 char byte_order;
150 int len;
151 unsigned char* data;
152 unsigned char* pos;
153 };
154 #endif
155
159 EDELIB_API bool xsettings_list_add(XSettingsList** list, XSettingsSetting* setting);
160
164 EDELIB_API bool xsettings_list_remove(XSettingsList** list, const char* name);
165
169 EDELIB_API XSettingsSetting* xsettings_list_find(XSettingsList* list, const char* name);
170
174 EDELIB_API void xsettings_list_free(XSettingsList* list);
175
176
177
181 EDELIB_API XSettingsSetting* xsettings_setting_copy(XSettingsSetting* setting);
182
186 EDELIB_API void xsettings_setting_free(XSettingsSetting* setting);
187
191 EDELIB_API bool xsettings_setting_equal(XSettingsSetting* s1, XSettingsSetting* s2);
192
196 EDELIB_API int xsettings_setting_len(const XSettingsSetting* setting);
197
201 EDELIB_API char xsettings_byte_order(void);
202
203
208 EDELIB_API XSettingsList* xsettings_decode(unsigned char* data, /*size_t*/ int len, unsigned long* serial);
209
213 EDELIB_API void xsettings_encode(const XSettingsSetting* setting, XSettingsBuffer* buffer);
214
215
216 #ifndef SKIP_DOCS
217 void xsettings_manager_notify(XSettingsData* data);
218 void xsettings_manager_set_setting(XSettingsData* data, XSettingsSetting* setting);
219 void xsettings_manager_delete_setting(XSettingsData* data, const char* name);
220 #endif
221
222 EDELIB_NS_END
223 #endif