X11workbench Toolkit  1.0
conf_help.c File Reference

'configuration helper' implementation file for the X11 Work Bench Toolkit API More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <X11/Xlib.h>
#include "conf_help.h"
#include "file_help.h"
#include "window_helper.h"
#include "draw_text.h"

Go to the source code of this file.

Macros

#define DEFAULT_DOUBLE_CLICK_TIME   250 /* msec */
 
#define DEFAULT_DOUBLE_CLICK_DISTANCE   5 /* pixels */
 
#define DEFAULT_DRAG_THRESHOLD   9 /* pixels */
 
#define DEFAULT_CURSOR_BLINK   (!0) /* boolean */
 
#define DEFAULT_CURSOR_BLINK_TIME   1200 /* msec */
 
#define LOAD_COLOR0(X, Y)   if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) > 0) { }
 
#define LOAD_COLOR(X, Y, Z)   if(CHGetResourceString(WBGetDefaultDisplay(), X, Y, sizeof(Y)) <= 0){ WB_WARN_PRINT("%s - WARNING: can't find color %s, using default value %s\n", __FUNCTION__, X, Z); strcpy(Y,Z); }
 

Typedefs

typedef struct _CONF_FILE_ CONF_FILE
 

Functions

static void __settings_cleanup (void)
 
static __inline__ void trim_ends (const char **ppLeft, const char **ppRight)
 
static __inline__ char * DoMakePath (char *pSrc, const char *szPath, const char *szName, const char *szExt)
 
void CHRegisterArgs (int argc, char **argv)
 registers arguments from the command line for later use More...
 
void CHOnExit (void)
 frees resources used by Configuration 'helper' functions More...
 
int CHGetResourceString_Old (Display *pDisplay, const char *szIdentifier, char *szData, int cbData)
 
static const char * TranslateColorRequest (const char *szIdentifier)
 
int CHGetResourceString (Display *pDisplay, const char *szIdentifier, char *szData, int cbData)
 Queries desktop resource strings (may become deprecated) More...
 
int CHGetResourceInt (Display *pDisplay, const char *szIdentifier)
 Queryies desktop resource integer values (from strings) (may become deprecated) More...
 
int CHGetArgC ()
 retrieves the argument count stored by CHRegisterArgs() More...
 
const char *const * CHGetArgV ()
 retrieves the array of arguments stored by CHRegisterArgs() More...
 
void * CHOpenConfFile (const char *szAppName, int iFlags)
 open configuration file for read/write, optionally creating it, based on application name More...
 
void CHCloseConfFile (void *pFile)
 close configuration file opened by CHOpenConfFile(), but does NOT free memory resources More...
 
void CHDestroyConfFile (void *pFile)
 destroy configuration file opened by CHOpenConfFile(), freeing memory resources (but not the files) More...
 
static void __get_line_strip_comments__ (const char **ppStart, const char **ppEnd)
 
static void __find_section__ (void *hFile, const char *szSection, const char **ppSection, const char **ppEndSection)
 
static int __enum_conf_file_sections__ (void *hFile, char *szData, int cbData)
 
int CHGetConfFileString (void *hFile, const char *szSection, const char *szIdentifier, char *szData, int cbData)
 obtain a string from a configuration file More...
 
int CHWriteConfFileString (void *hFile, const char *szSection, const char *szIdentifier, const char *szData)
 write a string to a configuration file More...
 
int CHGetConfFileInt (void *hFile, const char *szSection, const char *szIdentifier)
 obtain an integer value from a configuration file More...
 
int CHWriteConfFileInt (void *hFile, const char *szSection, const char *szIdentifier, int iData)
 write an integer value to a configuration file More...
 
struct __XSETTINGS_HEADER__ __attribute__ ((__packed__))
 
const CHXSettingCHGetXSetting (Display *pDisplay, const char *szSettingName)
 returns a pointer to a specific X setting entry by name More...
 
void CHSettingsRefresh (Display *pDisplay)
 refresh the internally cached X settings More...
 
int CHGetDoubleClickTime (Display *pDisplay)
 returns default double click time (from X settings) More...
 
int CHGetDoubleClickDistance (Display *pDisplay)
 returns default double click distance (from X settings) More...
 
int CHGetDragThreshold (Display *pDisplay)
 returns default drag threshold (from X settings) More...
 
int CHGetCursorBlink (Display *pDisplay)
 returns default cursor blink 'enable' flag (from X settings) More...
 
int CHGetCursorBlinkTime (Display *pDisplay)
 returns default cursor blink time (from X settings) More...
 
static const char * InternalParseXML (CHXMLEntry **ppOrigin, int *pcbOrigin, CHXMLEntry **ppCur, char **ppData, int *pcbData, char **ppCurData, const char *ppXMLData, const char *pXMLDataEnd)
 Parses contents of an XML tag, returning as WBAlloc'd string list similar to environment strings. More...
 
CHXMLEntryCHParseXML (const char *pXMLData, int cbLength)
 Parses contents of an XML tag, returning as WBAlloc'd string list similar to environment strings. More...
 
char * CHParseXMLTagContents (const char *pTagContents, int cbLength)
 Parses contents of a single XML tag, returning as WBAlloc'd string list similar to environment strings. More...
 
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. More...
 
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 ']'. More...
 
const char * CHFindEndOfXMLTag (const char *pTagContents, int cbLength)
 Parses contents of an XML tag to find the end of it. More...
 
char * CHGetFileMimeType (const char *szFileName)
 Get the MIME type for a particular file name or extension. More...
 
char * CHGetMimeDefaultApp (const char *szMimeType)
 Get the default application for a particular MIME type. More...
 
char * CHGetDesktopFileInfo (const char *szDesktopFile, const char *szInfo)
 Get the default application for a particular MIME type. More...
 
const char * CHGetBorderColor (Display *pDisplay)
 returns border color More...
 
const char * CHGetStaticBackgroundColor (Display *pDisplay)
 returns background color for static elements More...
 
const char * CHGetToolTipBackgroundColor (Display *pDisplay)
 returns background color for 'tool tips' More...
 
const char * CHGetDialogBackgroundColor (Display *pDisplay)
 returns background color for dialog frame elements More...
 
const char * CHGetActiveBackgroundColor (Display *pDisplay)
 returns background color for active elements More...
 
const char * CHGetDisabledBackgroundColor (Display *pDisplay)
 returns background color for disabled (greyed) elements More...
 
const char * CHGetBackgroundColor (Display *pDisplay)
 returns background color for non-static elements More...
 
const char * CHGetDialogTextColor (Display *pDisplay)
 returns text color for dialog frame elements More...
 
const char * CHGetActiveTextColor (Display *pDisplay)
 returns 'active' text color More...
 
const char * CHGetDisabledTextColor (Display *pDisplay)
 returns 'disabled' (greyed) text color More...
 
const char * CHGetToolTipTextColor (Display *pDisplay)
 returns text color for 'tool tips' More...
 
const char * CHGetTextColor (Display *pDisplay)
 returns text color More...
 
const char * CHGetHighlightForegroundColor (Display *pDisplay)
 returns highlight foreground color More...
 
const char * CHGetHighlightBackgroundColor (Display *pDisplay)
 returns highlight background color More...
 
void CHDumpConfig ()
 dump config information using debug output functions More...
 

Variables

static const char *const * argv_copy = NULL
 
static int argc_copy = 0
 
static CHXSettingspXSettings = NULL
 
char cByteOrder
 
char cUnused [3]
 
unsigned int uiSerial
 
unsigned int nSettings
 
 XSETTINGS_DATA_INT
 
unsigned int cbLength
 
char szData [4]
 

Detailed Description

'configuration helper' implementation file for the X11 Work Bench Toolkit API

X11 Work Bench Toolkit Toolkit API

Definition in file conf_help.c.