edelib 2.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
edelib::XSettingsSetting::name
char * name
Definition: XSettingsCommon.h:63
edelib::XSettingsData::selection_atom
Atom selection_atom
Definition: XSettingsCommon.h:132
edelib::XSettingsColor::alpha
unsigned short alpha
Definition: XSettingsCommon.h:54
edelib::XSettingsData::manager_atom
Atom manager_atom
Definition: XSettingsCommon.h:135
edelib::XSETTINGS_TYPE_STRING
string (char*) type
Definition: XSettingsCommon.h:38
edelib::XSettingsList
List internaly used by XSETTINGS classes.
Definition: XSettingsCommon.h:82
edelib::XSettingsData::screen
int screen
Definition: XSettingsCommon.h:126
edelib::XSETTINGS_TYPE_INT
int type
Definition: XSettingsCommon.h:37
edelib::Window
Window class.
Definition: Window.h:73
edelib::XSettingsData::settings
XSettingsList * settings
Definition: XSettingsCommon.h:141
edelib::XSETTINGS_TYPE_COLOR
RGBA type.
Definition: XSettingsCommon.h:39
edelib::XSettingsList::next
XSettingsList * next
Definition: XSettingsCommon.h:86
edelib::XSettingsData
Main data shared between client and manager.
Definition: XSettingsCommon.h:122
edelib::XSettingsSetting::last_change_serial
unsigned long last_change_serial
Definition: XSettingsCommon.h:75
edelib::XSettingsData::serial
unsigned long serial
Definition: XSettingsCommon.h:144
edelib::XSettingsType
XSettingsType
Types used for XSETTINGS.
Definition: XSettingsCommon.h:36
edelib::XSettingsSetting
Structure for tracking XSETTINGS values.
Definition: XSettingsCommon.h:61
edelib::XSettingsList::setting
XSettingsSetting * setting
Definition: XSettingsCommon.h:84
edelib::XSettingsColor::blue
unsigned short blue
Definition: XSettingsCommon.h:52
edelib::XSettingsSetting::type
XSettingsType type
Definition: XSettingsCommon.h:65
edelib::XSettingsColor::red
unsigned short red
Definition: XSettingsCommon.h:48
edelib::XSettingsColor
Color data for XSETTINGS.
Definition: XSettingsCommon.h:46
edelib::XSettingsData::manager_win
Window manager_win
Definition: XSettingsCommon.h:129
edelib::XSettingsColor::green
unsigned short green
Definition: XSettingsCommon.h:50
edelib::XSettingsData::xsettings_atom
Atom xsettings_atom
Definition: XSettingsCommon.h:138
edelib::XSettingsData::display
Display * display
Definition: XSettingsCommon.h:124