<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>edelib: edelib/XSettingsCommon.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">edelib  <span id="projectnumber">2.0.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">edelib/XSettingsCommon.h</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * $Id: XSettingsCommon.h 2839 2009-09-28 11:36:20Z karijes $</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * Common stuff for XSETTINGS protocol</span> <a name="l00005"></a>00005 <span class="comment"> * Based on implementation from Owen Tylor, copyright (c) 2001 Red Hat, inc.</span> <a name="l00006"></a>00006 <span class="comment"> * Copyright (c) 2005-2007 edelib authors</span> <a name="l00007"></a>00007 <span class="comment"> *</span> <a name="l00008"></a>00008 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00009"></a>00009 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span> <a name="l00010"></a>00010 <span class="comment"> * License as published by the Free Software Foundation; either</span> <a name="l00011"></a>00011 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span> <a name="l00012"></a>00012 <span class="comment"> *</span> <a name="l00013"></a>00013 <span class="comment"> * This library is distributed in the hope that it will be useful,</span> <a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00016"></a>00016 <span class="comment"> * Lesser General Public License for more details.</span> <a name="l00017"></a>00017 <span class="comment"> *</span> <a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU Lesser General Public License</span> <a name="l00019"></a>00019 <span class="comment"> * along with this library. If not, see <http://www.gnu.org/licenses/>.</span> <a name="l00020"></a>00020 <span class="comment"> */</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef __EDELIB_XSETTINGSCOMMON_H__</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define __EDELIB_XSETTINGSCOMMON_H__</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include "edelib-global.h"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include <X11/Xlib.h></span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#define XSETTINGS_PAD(n, p) ((n + p - 1) & (~(p - 1)))</span> <a name="l00029"></a>00029 <span class="preprocessor"></span> <a name="l00030"></a>00030 EDELIB_NS_BEGIN <a name="l00031"></a>00031 <a name="l00036"></a><a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1">00036</a> <span class="keyword">enum</span> <a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1" title="Types used for XSETTINGS.">XSettingsType</a> { <a name="l00037"></a><a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a097a02d26e8a80b978d7e93871e99f5c">00037</a> <a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a097a02d26e8a80b978d7e93871e99f5c" title="int type">XSETTINGS_TYPE_INT</a> = 0, <a name="l00038"></a><a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a6334092bb938b343daab078c3f02aa2b">00038</a> <a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a6334092bb938b343daab078c3f02aa2b" title="string (char*) type">XSETTINGS_TYPE_STRING</a>, <a name="l00039"></a><a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a7975645d29db788ef91db4c454db3b48">00039</a> <a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1a7975645d29db788ef91db4c454db3b48" title="RGBA type.">XSETTINGS_TYPE_COLOR</a> <a name="l00040"></a>00040 }; <a name="l00041"></a>00041 <a name="l00046"></a><a class="code" href="structedelib_1_1XSettingsColor.html">00046</a> <span class="keyword">struct </span><a class="code" href="structedelib_1_1XSettingsColor.html" title="Color data for XSETTINGS.">XSettingsColor</a> { <a name="l00048"></a><a class="code" href="structedelib_1_1XSettingsColor.html#ade5171ee009d0e897f977e5d476feb5e">00048</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structedelib_1_1XSettingsColor.html#ade5171ee009d0e897f977e5d476feb5e">red</a>; <a name="l00050"></a><a class="code" href="structedelib_1_1XSettingsColor.html#a0dee4ece48d6a6eb6ab21fa87687369f">00050</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structedelib_1_1XSettingsColor.html#a0dee4ece48d6a6eb6ab21fa87687369f">green</a>; <a name="l00052"></a><a class="code" href="structedelib_1_1XSettingsColor.html#a979e7337089fc93f096aef4f8608fef5">00052</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structedelib_1_1XSettingsColor.html#a979e7337089fc93f096aef4f8608fef5">blue</a>; <a name="l00054"></a><a class="code" href="structedelib_1_1XSettingsColor.html#ab2e4bc5aa9a14784485b74a0d615c111">00054</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structedelib_1_1XSettingsColor.html#ab2e4bc5aa9a14784485b74a0d615c111">alpha</a>; <a name="l00055"></a>00055 }; <a name="l00056"></a>00056 <a name="l00061"></a><a class="code" href="structedelib_1_1XSettingsSetting.html">00061</a> <span class="keyword">struct </span><a class="code" href="structedelib_1_1XSettingsSetting.html" title="Structure for tracking XSETTINGS values.">XSettingsSetting</a> { <a name="l00063"></a><a class="code" href="structedelib_1_1XSettingsSetting.html#a5ac083a645d964373f022d03df4849c8">00063</a> <span class="keywordtype">char</span>* <a class="code" href="structedelib_1_1XSettingsSetting.html#a5ac083a645d964373f022d03df4849c8">name</a>; <a name="l00065"></a><a class="code" href="structedelib_1_1XSettingsSetting.html#a7b0ad305446733828cdb449ad19f6f02">00065</a> <a class="code" href="namespaceedelib.html#ab8bbe81bca89b1e6aa014317095b4dd1" title="Types used for XSETTINGS.">XSettingsType</a> <a class="code" href="structedelib_1_1XSettingsSetting.html#a7b0ad305446733828cdb449ad19f6f02">type</a>; <a name="l00066"></a>00066 <a name="l00068"></a>00068 <span class="keyword">union </span>{ <a name="l00069"></a>00069 <span class="keywordtype">int</span> v_int; <a name="l00070"></a>00070 <span class="keywordtype">char</span>* v_string; <a name="l00071"></a>00071 <a class="code" href="structedelib_1_1XSettingsColor.html" title="Color data for XSETTINGS.">XSettingsColor</a> v_color; <a name="l00072"></a>00072 } data; <a name="l00073"></a>00073 <a name="l00075"></a><a class="code" href="structedelib_1_1XSettingsSetting.html#a9fe2cba384bd75bc3f806a462d7a8200">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="structedelib_1_1XSettingsSetting.html#a9fe2cba384bd75bc3f806a462d7a8200">last_change_serial</a>; <a name="l00076"></a>00076 }; <a name="l00077"></a>00077 <a name="l00082"></a><a class="code" href="structedelib_1_1XSettingsList.html">00082</a> <span class="keyword">struct </span><a class="code" href="structedelib_1_1XSettingsList.html" title="List internaly used by XSETTINGS classes.">XSettingsList</a> { <a name="l00084"></a><a class="code" href="structedelib_1_1XSettingsList.html#af091096526309a2f977c776ef348f81f">00084</a> <a class="code" href="structedelib_1_1XSettingsSetting.html" title="Structure for tracking XSETTINGS values.">XSettingsSetting</a>* <a class="code" href="structedelib_1_1XSettingsList.html#af091096526309a2f977c776ef348f81f">setting</a>; <a name="l00086"></a><a class="code" href="structedelib_1_1XSettingsList.html#a3391fe1326d45fab6c31e629b4526f58">00086</a> <a class="code" href="structedelib_1_1XSettingsList.html" title="List internaly used by XSETTINGS classes.">XSettingsList</a>* <a class="code" href="structedelib_1_1XSettingsList.html#a3391fe1326d45fab6c31e629b4526f58">next</a>; <a name="l00087"></a>00087 }; <a name="l00088"></a>00088 <a name="l00122"></a><a class="code" href="structedelib_1_1XSettingsData.html">00122</a> <span class="keyword">struct </span><a class="code" href="structedelib_1_1XSettingsData.html" title="Main data shared between client and manager.">XSettingsData</a> { <a name="l00124"></a><a class="code" href="structedelib_1_1XSettingsData.html#a854f9eb314f72feecf68ba03c6f0e5d5">00124</a> Display* <a class="code" href="structedelib_1_1XSettingsData.html#a854f9eb314f72feecf68ba03c6f0e5d5">display</a>; <a name="l00126"></a><a class="code" href="structedelib_1_1XSettingsData.html#a3109b0889cec9f0de874a2bdc1f84372">00126</a> <span class="keywordtype">int</span> <a class="code" href="structedelib_1_1XSettingsData.html#a3109b0889cec9f0de874a2bdc1f84372">screen</a>; <a name="l00127"></a>00127 <a name="l00129"></a><a class="code" href="structedelib_1_1XSettingsData.html#a04a14fa3172dc39fd86bdef8a3ff50cd">00129</a> <a class="code" href="classedelib_1_1Window.html" title="Window class.">Window</a> <a class="code" href="structedelib_1_1XSettingsData.html#a04a14fa3172dc39fd86bdef8a3ff50cd">manager_win</a>; <a name="l00130"></a>00130 <a name="l00132"></a><a class="code" href="structedelib_1_1XSettingsData.html#a55dc77899667156adb6e362c12c03cd5">00132</a> Atom <a class="code" href="structedelib_1_1XSettingsData.html#a55dc77899667156adb6e362c12c03cd5">selection_atom</a>; <a name="l00133"></a>00133 <a name="l00135"></a><a class="code" href="structedelib_1_1XSettingsData.html#ac7d542d73a6a3866b8201765c6484075">00135</a> Atom <a class="code" href="structedelib_1_1XSettingsData.html#ac7d542d73a6a3866b8201765c6484075">manager_atom</a>; <a name="l00136"></a>00136 <a name="l00138"></a><a class="code" href="structedelib_1_1XSettingsData.html#ae3214b39dc4762149c4b7a023ce66c09">00138</a> Atom <a class="code" href="structedelib_1_1XSettingsData.html#ae3214b39dc4762149c4b7a023ce66c09">xsettings_atom</a>; <a name="l00139"></a>00139 <a name="l00141"></a><a class="code" href="structedelib_1_1XSettingsData.html#abb51bc01c6724ac265616561d2a3d110">00141</a> <a class="code" href="structedelib_1_1XSettingsList.html" title="List internaly used by XSETTINGS classes.">XSettingsList</a>* <a class="code" href="structedelib_1_1XSettingsData.html#abb51bc01c6724ac265616561d2a3d110">settings</a>; <a name="l00142"></a>00142 <a name="l00144"></a><a class="code" href="structedelib_1_1XSettingsData.html#a1e3162f089d71a92c383b398715e0c92">00144</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="structedelib_1_1XSettingsData.html#a1e3162f089d71a92c383b398715e0c92">serial</a>; <a name="l00145"></a>00145 }; <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="preprocessor">#ifndef SKIP_DOCS</span> <a name="l00148"></a>00148 <span class="preprocessor"></span><span class="keyword">struct </span>XSettingsBuffer { <a name="l00149"></a>00149 <span class="keywordtype">char</span> byte_order; <a name="l00150"></a>00150 <span class="keywordtype">int</span> len; <a name="l00151"></a>00151 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* data; <a name="l00152"></a>00152 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* pos; <a name="l00153"></a>00153 }; <a name="l00154"></a>00154 <span class="preprocessor">#endif</span> <a name="l00155"></a>00155 <span class="preprocessor"></span> <a name="l00159"></a>00159 EDELIB_API <span class="keywordtype">bool</span> xsettings_list_add(XSettingsList** list, XSettingsSetting* setting); <a name="l00160"></a>00160 <a name="l00164"></a>00164 EDELIB_API <span class="keywordtype">bool</span> xsettings_list_remove(XSettingsList** list, <span class="keyword">const</span> <span class="keywordtype">char</span>* name); <a name="l00165"></a>00165 <a name="l00169"></a>00169 EDELIB_API XSettingsSetting* xsettings_list_find(XSettingsList* list, <span class="keyword">const</span> <span class="keywordtype">char</span>* name); <a name="l00170"></a>00170 <a name="l00174"></a>00174 EDELIB_API <span class="keywordtype">void</span> xsettings_list_free(XSettingsList* list); <a name="l00175"></a>00175 <a name="l00176"></a>00176 <a name="l00177"></a>00177 <a name="l00181"></a>00181 EDELIB_API XSettingsSetting* xsettings_setting_copy(XSettingsSetting* setting); <a name="l00182"></a>00182 <a name="l00186"></a>00186 EDELIB_API <span class="keywordtype">void</span> xsettings_setting_free(XSettingsSetting* setting); <a name="l00187"></a>00187 <a name="l00191"></a>00191 EDELIB_API <span class="keywordtype">bool</span> xsettings_setting_equal(XSettingsSetting* s1, XSettingsSetting* s2); <a name="l00192"></a>00192 <a name="l00196"></a>00196 EDELIB_API <span class="keywordtype">int</span> xsettings_setting_len(<span class="keyword">const</span> XSettingsSetting* setting); <a name="l00197"></a>00197 <a name="l00201"></a>00201 EDELIB_API <span class="keywordtype">char</span> xsettings_byte_order(<span class="keywordtype">void</span>); <a name="l00202"></a>00202 <a name="l00203"></a>00203 <a name="l00208"></a>00208 EDELIB_API XSettingsList* xsettings_decode(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* data, <span class="comment">/*size_t*/</span> <span class="keywordtype">int</span> len, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>* serial); <a name="l00209"></a>00209 <a name="l00213"></a>00213 EDELIB_API <span class="keywordtype">void</span> xsettings_encode(<span class="keyword">const</span> XSettingsSetting* setting, XSettingsBuffer* buffer); <a name="l00214"></a>00214 <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="preprocessor">#ifndef SKIP_DOCS</span> <a name="l00217"></a>00217 <span class="preprocessor"></span><span class="keywordtype">void</span> xsettings_manager_notify(XSettingsData* data); <a name="l00218"></a>00218 <span class="keywordtype">void</span> xsettings_manager_set_setting(XSettingsData* data, XSettingsSetting* setting); <a name="l00219"></a>00219 <span class="keywordtype">void</span> xsettings_manager_delete_setting(XSettingsData* data, <span class="keyword">const</span> <span class="keywordtype">char</span>* name); <a name="l00220"></a>00220 <span class="preprocessor">#endif</span> <a name="l00221"></a>00221 <span class="preprocessor"></span> <a name="l00222"></a>00222 EDELIB_NS_END <a name="l00223"></a>00223 <span class="preprocessor">#endif</span> </pre></div></div><!-- contents --> <hr class="footer"/><address class="footer"><small> Generated on Tue Jun 5 2012 17:49:02 for edelib by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.7.6.1 </small></address> </body> </html>