79 #ifndef CONF_HELPER_H_INCLUDED 80 #define CONF_HELPER_H_INCLUDED 90 #warning "GLOBAL_PATH not defined, assuming /usr/local/etc" 91 #define GLOBAL_PATH "/usr/local/etc" 96 #warning "GLOBAL_XPATH not defined, assuming /usr/local/etc/X11" 97 #define GLOBAL_XPATH "/usr/local/etc/X11" 98 #else // others whose distros don't consider 'X11' to be in '/usr/local' 99 #warning "GLOBAL_XPATH not defined, assuming /etc/X11" 100 #define GLOBAL_XPATH "/etc/X11" 101 #endif // __FreeBSD__, others 102 #endif // GLOBAL_XPATH 114 #define LOCAL_PATH "~/.local/share/" 115 #define CONFIG_PATH "~/.config/" 117 #define LOCAL_CONF_NAME "settings" 120 #define CH_OPEN_TIMEOUT 5000 126 #define CH_FLAGS_DEFAULT 0 127 #define CH_FLAGS_GLOBAL 0x1 128 #define CH_FLAGS_WRITE 0x2 130 #define CHPARSEXML_DEFAULT 0 131 #define CHPARSEXML_PAREN 1 132 #define CHPARSEXML_BRACKET 2 149 void CHRegisterArgs(int argc, char **argv); // call in 'main' 196 int CHGetResourceString(Display *pDisplay,
const char *szIdentifier,
char *szData,
int cbData);
276 const char *szIdentifier,
char *szData,
int cbData);
293 const char *szIdentifier,
const char *szData);
311 int CHGetConfFileInt(
void * hFile,
const char *szSection,
const char *szIdentifier);
327 int CHWriteConfFileInt(
void * hFile,
const char *szSection,
const char *szIdentifier,
int iData);
917 const char *
CHFindNextXMLTag(
const char *pTagContents,
int cbLength,
int nNestingFlags);
970 const char *
CHFindEndOfXMLSection(
const char *pTagContents,
int cbLength,
char cEndChar,
int bUseQuotes);
1036 #endif // __cplusplus 1039 #endif // CONF_HELPER_H_INCLUDED const char * CHGetHighlightForegroundColor(Display *pDisplay)
returns highlight foreground color
char * CHGetMimeDefaultApp(const char *szMimeType)
Get the default application for a particular MIME type.
char * szData
'char' typed pointer to data within string area
const CHXSettings * CHGetXSettings(Display *pDisplay)
returns a pointer to the cached X settings
int CHGetDoubleClickDistance(Display *pDisplay)
returns default double click distance (from X settings)
int iContentsIndex
0-based first array index for 'contents' for this entry; <= 0 for none
unsigned short sBlue
16-bit RGB value for Blue
int nDataOffset
BYTE offset to data (zero-byte-terminated) string (from beginning of array) for the entry data; <= 0 ...
int iContainer
0-based index for container; <= 0 for none.
const CHXSetting * CHGetXSetting(Display *pDisplay, const char *szSettingName)
returns a pointer to a specific X setting entry by name
XSETTINGS_DATA_COLOR clrData
The data as a color value.
void CHOnExit(void)
frees resources used by Configuration 'helper' functions
const char * CHFindEndOfXMLTag(const char *pTagContents, int cbLength)
Parses contents of an XML tag to find the end of it.
const char * CHGetActiveBackgroundColor(Display *pDisplay)
returns background color for active elements
const char * CHGetStaticBackgroundColor(Display *pDisplay)
returns background color for static elements
Array wrapper for CHXSetting cache.
CHXSetting aData[1]
An array of 'nSettings' CHXSetting structures. Binary and string data directly follows the array.
struct tagXSETTINGS_DATA_COLOR XSETTINGS_DATA_COLOR
Structure for storing configuration color information, XSettingsTypeColor.
void * CHOpenConfFile(const char *szAppName, int iFlags)
open configuration file for read/write, optionally creating it, based on application name
const char * CHFindEndOfXMLSection(const char *pTagContents, int cbLength, char cEndChar, int bUseQuotes)
Parses XML text for the end of a 'section', typically ending in '>' ')' or ']'.
int CHGetConfFileString(void *hFile, const char *szSection, const char *szIdentifier, char *szData, int cbData)
obtain a string from a configuration file
unsigned int uiSerial
serial number from last XSETTINGS query
const char * CHGetActiveTextColor(Display *pDisplay)
returns 'active' text color
void * pData
un-typed pointer to data within string area
int CHGetCursorBlinkTime(Display *pDisplay)
returns default cursor blink time (from X settings)
int iType
The setting type (XSettingsType enumeration)
const char * CHFindNextXMLTag(const char *pTagContents, int cbLength, int nNestingFlags)
Parses contents of a XML to find the next tag, skipping comments along the way.
const char * CHGetDisabledTextColor(Display *pDisplay)
returns 'disabled' (greyed) text color
int CHGetArgC(void)
retrieves the argument count stored by CHRegisterArgs()
struct tagCHXSettings CHXSettings
Array wrapper for CHXSetting cache.
int CHGetResourceString(Display *pDisplay, const char *szIdentifier, char *szData, int cbData)
Queries desktop resource strings (may become deprecated)
WB_INT64 llData
Reserved element, forces 64-bit size.
int CHWriteConfFileString(void *hFile, const char *szSection, const char *szIdentifier, const char *szData)
write a string to a configuration file
int nLabelOffset
BYTE offset to label (zero-byte-terminated) string (from beginning of array) for this entry; <= 0 for...
void CHCloseConfFile(void *hFile)
close configuration file opened by CHOpenConfFile(), but does NOT free memory resources
const char * CHGetTextColor(Display *pDisplay)
returns text color
const char * CHGetDialogTextColor(Display *pDisplay)
returns text color for dialog frame elements
int CHGetResourceInt(Display *pDisplay, const char *szIdentifier)
Queryies desktop resource integer values (from strings) (may become deprecated)
CHXMLEntry * CHParseXML(const char *pXMLData, int cbLength)
Parses contents of an XML tag, returning as WBAlloc'd string list similar to environment strings.
void CHDumpConfig(void)
dump config information using debug output functions
int iData
The data as an integer value.
const char * CHGetHighlightBackgroundColor(Display *pDisplay)
returns highlight background color
const char * CHGetDialogBackgroundColor(Display *pDisplay)
returns background color for dialog frame elements
const char * szName
pointer to the NAME string within memory that follows CHXSettings::aData
int CHGetDoubleClickTime(Display *pDisplay)
returns default double click time (from X settings)
The setting is an RGBA Color stored as XSETTINGS_DATA_COLOR.
int CHGetCursorBlink(Display *pDisplay)
returns default cursor blink 'enable' flag (from X settings)
int iLen
length (where applicable)
int CHWriteConfFileInt(void *hFile, const char *szSection, const char *szIdentifier, int iData)
write an integer value to a configuration file
unsigned short sAlpha
16-bit ALPHA value. If not used, it will be 0xffff
Display * pDisplay
identifies which display it belongs to (reserved)
Descriptor for parsed XML entry.
void CHSettingsRefresh(Display *pDisplay)
refresh the internally cached X settings
int CHGetConfFileInt(void *hFile, const char *szSection, const char *szIdentifier)
obtain an integer value from a configuration file
char * CHGetFileMimeType(const char *szFileName)
Get the MIME type for a particular file name or extension.
The setting is an integer.
unsigned short sGreen
16-bit RGB value for Green
const char * CHGetDisabledBackgroundColor(Display *pDisplay)
returns background color for disabled (greyed) elements
const char * CHGetToolTipTextColor(Display *pDisplay)
returns text color for 'tool tips'
const char * CHGetBackgroundColor(Display *pDisplay)
returns background color for non-static elements
int CHGetDragThreshold(Display *pDisplay)
returns default drag threshold (from X settings)
int iNextIndex
0-based index for next item at this level; <= 0 for none. 0 marks "end of list" for top level
const char *const * CHGetArgV(void)
retrieves the array of arguments stored by CHRegisterArgs()
void CHDebugDumpXML(CHXMLEntry *pEntry)
Parses contents of an XML tag, returning as WBAlloc'd string list similar to environment strings.
union tagCHXSetting::@7 uData
union of the data alias'
void CHDestroyConfFile(void *hFile)
destroy configuration file opened by CHOpenConfFile(), freeing memory resources (but not the files)
The setting is a 0-byte terminated ASCII string.
int nSettings
the total number of settings in aData
unsigned int uiSerial
serial # from last XSETTINGS [endian-ized]
struct tagCHXMLEntry CHXMLEntry
Descriptor for parsed XML entry.
char * CHGetDesktopFileInfo(const char *szDesktopFile, const char *szInfo)
Get the default application for a particular MIME type.
const char * CHGetBorderColor(Display *pDisplay)
returns border color
Structure for storing configuration color information, XSettingsTypeColor.
unsigned short sRed
16-bit RGB value for RED
XSettingsType
Enumeration for 'XSettingsType' which describes the type of setting being cached.
struct tagCHXSetting CHXSetting
Structure for storing settings information internally.
char * CHParseXMLTagContents(const char *pTagContents, int cbLength)
Parses contents of a single XML tag, returning as WBAlloc'd string list similar to environment string...
Structure for storing settings information internally.
const char * CHGetToolTipBackgroundColor(Display *pDisplay)
returns background color for 'tool tips'