XSettingsCommon.h
/*
* $Id: XSettingsCommon.h 2839 2009-09-28 11:36:20Z karijes $
*
* Common stuff for XSETTINGS protocol
* Based on implementation from Owen Tylor, copyright (c) 2001 Red Hat, inc.
* Copyright (c) 2005-2007 edelib authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __EDELIB_XSETTINGSCOMMON_H__
#define __EDELIB_XSETTINGSCOMMON_H__
#include "edelib-global.h"
#include <X11/Xlib.h>
#define XSETTINGS_PAD(n, p) ((n + p - 1) & (~(p - 1)))
EDELIB_NS_BEGIN
enum XSettingsType {
XSETTINGS_TYPE_INT = 0,
XSETTINGS_TYPE_STRING,
XSETTINGS_TYPE_COLOR
};
struct XSettingsColor {
unsigned short red;
unsigned short green;
unsigned short blue;
unsigned short alpha;
};
struct XSettingsSetting {
char* name;
XSettingsType type;
union {
int v_int;
char* v_string;
XSettingsColor v_color;
} data;
unsigned long last_change_serial;
};
struct XSettingsList {
XSettingsSetting* setting;
XSettingsList* next;
};
struct XSettingsData {
Display* display;
int screen;
Window manager_win;
Atom selection_atom;
Atom manager_atom;
Atom xsettings_atom;
XSettingsList* settings;
unsigned long serial;
};
#ifndef SKIP_DOCS
struct XSettingsBuffer {
char byte_order;
int len;
unsigned char* data;
unsigned char* pos;
};
#endif
EDELIB_API bool xsettings_list_add(XSettingsList** list, XSettingsSetting* setting);
EDELIB_API bool xsettings_list_remove(XSettingsList** list, const char* name);
EDELIB_API XSettingsSetting* xsettings_list_find(XSettingsList* list, const char* name);
EDELIB_API void xsettings_list_free(XSettingsList* list);
EDELIB_API XSettingsSetting* xsettings_setting_copy(XSettingsSetting* setting);
EDELIB_API void xsettings_setting_free(XSettingsSetting* setting);
EDELIB_API bool xsettings_setting_equal(XSettingsSetting* s1, XSettingsSetting* s2);
EDELIB_API int xsettings_setting_len(const XSettingsSetting* setting);
EDELIB_API char xsettings_byte_order(void);
EDELIB_API XSettingsList* xsettings_decode(unsigned char* data, /*size_t*/ int len, unsigned long* serial);
EDELIB_API void xsettings_encode(const XSettingsSetting* setting, XSettingsBuffer* buffer);
#ifndef SKIP_DOCS
void xsettings_manager_notify(XSettingsData* data);
void xsettings_manager_set_setting(XSettingsData* data, XSettingsSetting* setting);
void xsettings_manager_delete_setting(XSettingsData* data, const char* name);
#endif
EDELIB_NS_END
#endif
edelib::XSettingsSetting::name
char * name
Definition: XSettingsCommon.h:63
edelib::xsettings_setting_free
void xsettings_setting_free(XSettingsSetting *setting)
edelib::xsettings_list_remove
bool xsettings_list_remove(XSettingsList **list, const char *name)
edelib::xsettings_list_find
XSettingsSetting * xsettings_list_find(XSettingsList *list, const char *name)
edelib::list
Linked list class.
Definition: List.h:160
edelib::xsettings_list_free
void xsettings_list_free(XSettingsList *list)
edelib::XSettingsData::selection_atom
Atom selection_atom
Definition: XSettingsCommon.h:132
edelib::XSettingsColor::alpha
unsigned short alpha
Definition: XSettingsCommon.h:54
edelib::xsettings_setting_equal
bool xsettings_setting_equal(XSettingsSetting *s1, XSettingsSetting *s2)
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::xsettings_encode
void xsettings_encode(const XSettingsSetting *setting, XSettingsBuffer *buffer)
edelib::xsettings_setting_len
int xsettings_setting_len(const XSettingsSetting *setting)
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::xsettings_byte_order
char xsettings_byte_order(void)
edelib::XSettingsType
XSettingsType
Types used for XSETTINGS.
Definition: XSettingsCommon.h:36
edelib::XSettingsSetting
Structure for tracking XSETTINGS values.
Definition: XSettingsCommon.h:61
edelib::xsettings_decode
XSettingsList * xsettings_decode(unsigned char *data, int len, unsigned long *serial)
edelib::XSettingsList::setting
XSettingsSetting * setting
Definition: XSettingsCommon.h:84
edelib::XSettingsColor::blue
unsigned short blue
Definition: XSettingsCommon.h:52
edelib::xsettings_setting_copy
XSettingsSetting * xsettings_setting_copy(XSettingsSetting *setting)
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::xsettings_list_add
bool xsettings_list_add(XSettingsList **list, XSettingsSetting *setting)
edelib::XSettingsData::display
Display * display
Definition: XSettingsCommon.h:124