X11workbench Toolkit  1.0
Desktop Settings utilities

Desktop Settings Utilities, to query desktop-defined settings like fonts, colors, mouse click times, etc. More...

Data Structures

struct  tagXSETTINGS_DATA_COLOR
 Structure for storing configuration color information, XSettingsTypeColor. More...
 
struct  tagCHXSetting
 Structure for storing settings information internally. More...
 
struct  tagCHXSettings
 Array wrapper for CHXSetting cache. More...
 
struct  tagCHXMLEntry
 Descriptor for parsed XML entry. More...
 

Typedefs

typedef struct tagXSETTINGS_DATA_COLOR XSETTINGS_DATA_COLOR
 Structure for storing configuration color information, XSettingsTypeColor. More...
 
typedef struct tagCHXSetting CHXSetting
 Structure for storing settings information internally. More...
 
typedef struct tagCHXSettings CHXSettings
 Array wrapper for CHXSetting cache. More...
 

Enumerations

enum  XSettingsType {
  XSettingsTypeInteger = 0,
  XSettingsTypeString = 1,
  XSettingsTypeColor = 2
}
 Enumeration for 'XSettingsType' which describes the type of setting being cached. More...
 

Functions

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...
 
void CHSettingsRefresh (Display *pDisplay)
 refresh the internally cached X settings More...
 
const CHXSettingsCHGetXSettings (Display *pDisplay)
 returns a pointer to the cached X settings More...
 
const CHXSettingCHGetXSetting (Display *pDisplay, const char *szSettingName)
 returns a pointer to a specific X setting entry by name 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...
 
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...
 
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...
 
void CHDumpConfig (void)
 dump config information using debug output functions More...
 

Detailed Description

Desktop Settings Utilities, to query desktop-defined settings like fonts, colors, mouse click times, etc.

Typedef Documentation

◆ CHXSetting

Structure for storing settings information internally.

This structure is used internally by the Configuration 'helper' functions to cache configuration information obtained from the Window Manager or from the (deprecated) system configuration.

typedef struct tagCHXSetting
{
const char *szName; // pointer to the NAME string within memory that follows CHXSettings::aData
int iType; // The setting type (\ref XSettingsType enumeration)
int iLen; // length (where applicable)
unsigned int uiSerial; // serial # from last XSETTINGS [endian-ized]
union
{
int iData; // The data as an integer value
WB_INT64 llData; // Reserved element, forces 64-bit size
XSETTINGS_DATA_COLOR clrData; // The data as a color value
void *pData; // un-typed pointer to data within string area
char *szData; // 'char' typed pointer to data within string area
} uData; // union of the data alias'

◆ CHXSettings

Array wrapper for CHXSetting cache.

This structure wraps the array of CHXSetting structures and any variable length data that it might reference. It is the internal format for the settings array and can be retrieved by calling CHGetXSettings()

typedef struct tagCHXSettings
{
Display *pDisplay; // identifies which display it belongs to (reserved)
int nSettings; // the total number of settings in aData
unsigned int uiSerial; // serial number from last XSETTINGS query
CHXSetting aData[1]; // An array of 'nSettings' \ref CHXSetting structures. Binary and string data directly follows the array.

◆ XSETTINGS_DATA_COLOR

Structure for storing configuration color information, XSettingsTypeColor.

This structure is part of the X11 Window Manager specification, and is defined here for use by the X11Workbench toolkit.

typedef struct tagXSETTINGS_DATA_COLOR // also used internally by XSettings
{
unsigned short sRed; // 16-bit RGB value for RED
unsigned short sBlue; // 16-bit RGB value for Blue
unsigned short sGreen; // 16-bit RGB value for Green
unsigned short sAlpha; // 16-bit ALPHA value. If not used, it will be 0xffff

Enumeration Type Documentation

◆ XSettingsType

Enumeration for 'XSettingsType' which describes the type of setting being cached.

Enumerator
XSettingsTypeInteger 

The setting is an integer.

XSettingsTypeString 

The setting is a 0-byte terminated ASCII string.

XSettingsTypeColor 

The setting is an RGBA Color stored as XSETTINGS_DATA_COLOR.

Definition at line 350 of file conf_help.h.

Function Documentation

◆ CHDumpConfig()

void CHDumpConfig ( void  )

dump config information using debug output functions

Debug function to dump config information using the debug output functions

Header File: conf_help.h

Definition at line 3444 of file conf_help.c.

◆ CHGetActiveBackgroundColor()

const char* CHGetActiveBackgroundColor ( Display *  pDisplay)

returns background color for active elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'active' background color as a string

Returns const pointer to the background color as a string, default "#0000c0" or "#00000000c0c0" Active background is for windows and items that currently have the focus

Header File: conf_help.h

Definition at line 3323 of file conf_help.c.

◆ CHGetActiveTextColor()

const char* CHGetActiveTextColor ( Display *  pDisplay)

returns 'active' text color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'active' text color as a string

Returns const pointer to the text color as a string, default "#ffffff" or "#ffffffffffff" Active text color is the text color in an element that has the input focus.

Header File: conf_help.h

Definition at line 3366 of file conf_help.c.

◆ CHGetBackgroundColor()

const char* CHGetBackgroundColor ( Display *  pDisplay)

returns background color for non-static elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'edit' background color as a string

Returns const pointer to the background color as a string, default "#ffffff" or "#ffffffffffff" 'Regular' background color is for windows and controls that display selectable and/or editable content

Header File: conf_help.h

Definition at line 3341 of file conf_help.c.

◆ CHGetBorderColor()

const char* CHGetBorderColor ( Display *  pDisplay)

returns border color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the border color as a string

Returns const pointer to the border color as a string, default "#000000" or "#000000000000"

Header File: conf_help.h

Definition at line 3279 of file conf_help.c.

◆ CHGetCursorBlink()

int CHGetCursorBlink ( Display *  pDisplay)

returns default cursor blink 'enable' flag (from X settings)

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
default cursor blink 'enable' flag (non-zero to enable blink)

Returns the default cursor blink 'enable' flag, zero to disable, non-zero to enable.

Header File: conf_help.h

Definition at line 2319 of file conf_help.c.

◆ CHGetCursorBlinkTime()

int CHGetCursorBlinkTime ( Display *  pDisplay)

returns default cursor blink time (from X settings)

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
default cursor blink time in milliseconds

Returns the default cursor blink time in milliseconds

Header File: conf_help.h

Definition at line 2358 of file conf_help.c.

◆ CHGetDesktopFileInfo()

char* CHGetDesktopFileInfo ( const char *  szDesktopFile,
const char *  szInfo 
)

Get the default application for a particular MIME type.

Parameters
szDesktopFileA const pointer to a character string containing the desktop file name
szInfoA const pointer to a character string containing the tag for the desired information
Returns
'WBAlloc'd pointer to a zero-byte terminated character string containing the desired information

This function will return NULL on error, or a WBAlloc'd pointer to a string. Caller must free any non-NULL pointer returned by this function, using WBFree()

Header File: conf_help.h

Definition at line 3158 of file conf_help.c.

◆ CHGetDialogBackgroundColor()

const char* CHGetDialogBackgroundColor ( Display *  pDisplay)

returns background color for dialog frame elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'dialog' background color as a string

Returns const pointer to the background color as a string, default "#edeceb" or "#ededececebeb" [consider e0e0e0] Dialog background is for dialog frames and most dialog box controls

Header File: conf_help.h

Definition at line 3308 of file conf_help.c.

◆ CHGetDialogTextColor()

const char* CHGetDialogTextColor ( Display *  pDisplay)

returns text color for dialog frame elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'dialog' text color as a string

Returns const pointer to the text color as a string, default "#000000" or "#000000000000" Dialog text color is for dialog frames, labels, and other static elements in a dialog box/frame

Header File: conf_help.h

Definition at line 3352 of file conf_help.c.

◆ CHGetDisabledBackgroundColor()

const char* CHGetDisabledBackgroundColor ( Display *  pDisplay)

returns background color for disabled (greyed) elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'disabled' background color as a string

Returns const pointer to the background color as a string, default "#0000c0" or "#00000000c0c0" Disabled background is for windows and items that are disabled (greyed)

Header File: conf_help.h

Definition at line 3336 of file conf_help.c.

◆ CHGetDisabledTextColor()

const char* CHGetDisabledTextColor ( Display *  pDisplay)

returns 'disabled' (greyed) text color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'disabled' text color as a string

Returns const pointer to the text color as a string, default "#808080" or "#808080808080" Disabled text color is the text color in an element that has been disabled (greyed)

Header File: conf_help.h

Definition at line 3378 of file conf_help.c.

◆ CHGetDoubleClickDistance()

int CHGetDoubleClickDistance ( Display *  pDisplay)

returns default double click distance (from X settings)

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
default double-click 'slop' distance in pixels

Returns double-click 'slop' distance in pixels

Header File: conf_help.h

Definition at line 2241 of file conf_help.c.

◆ CHGetDoubleClickTime()

int CHGetDoubleClickTime ( Display *  pDisplay)

returns default double click time (from X settings)

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
default double-click time in milliseconds

Returns default double-click time in milliseconds

Header File: conf_help.h

Definition at line 2202 of file conf_help.c.

◆ CHGetDragThreshold()

int CHGetDragThreshold ( Display *  pDisplay)

returns default drag threshold (from X settings)

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
default drag threshold in pixels

Returns default drag threshold in pixels

Header File: conf_help.h

Definition at line 2280 of file conf_help.c.

◆ CHGetFileMimeType()

char* CHGetFileMimeType ( const char *  szFileName)

Get the MIME type for a particular file name or extension.

Parameters
szFileNameA const pointer to a string containing the filename or '.ext' for which to obtain the MIME type
Returns
'WBAlloc'd pointer to a zero-byte terminated character string containing the MIME type

This function will return NULL on error, or a WBAlloc'd pointer to a string. Caller must free any non-NULL pointer returned by this function, using WBFree()

Header File: conf_help.h

Definition at line 3088 of file conf_help.c.

◆ CHGetHighlightBackgroundColor()

const char* CHGetHighlightBackgroundColor ( Display *  pDisplay)

returns highlight background color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the highlight background color as a string

Returns const pointer to the highlight background color as a string, default "#0000a0" or "#00000000a0a0" [consider a0a0a0] Highlight colors include selected text, or selected items from a list.

Header File: conf_help.h

Definition at line 3425 of file conf_help.c.

◆ CHGetHighlightForegroundColor()

const char* CHGetHighlightForegroundColor ( Display *  pDisplay)

returns highlight foreground color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the highlight foreground color as a string

Returns const pointer to the highlight foreground color as a string, default "#f0f0f0" or "#f0f0f0f0f0f0" Highlight colors include selected text, or selected items from a list.

Header File: conf_help.h

Definition at line 3409 of file conf_help.c.

◆ CHGetMimeDefaultApp()

char* CHGetMimeDefaultApp ( const char *  szMimeType)

Get the default application for a particular MIME type.

Parameters
szMimeTypeA const pointer to a character string containing the MIME type
Returns
'WBAlloc'd pointer to a zero-byte terminated character string containing the default application name

In the case of a '.desktop' file name being returned, use CHGetDesktopFileInfo() to obtain the actual path name and other information associated with the application.

This function will return NULL on error, or a WBAlloc'd pointer to a string. Caller must free any non-NULL pointer returned by this function, using WBFree()

Header File: conf_help.h

Definition at line 3110 of file conf_help.c.

◆ CHGetResourceInt()

int CHGetResourceInt ( Display *  pDisplay,
const char *  szIdentifier 
)

Queryies desktop resource integer values (from strings) (may become deprecated)

Parameters
pDisplayThe Display pointer (NULL for default)
szIdentifierThe item to query
Returns
the queried integer value, or 0 if error or no matching identifier

This queries integer values from the 'Old' resource manager. This function is deprecated. Some window managers may still supporte it, however, so it's worth keeping for now.

Header File: conf_help.h

Definition at line 604 of file conf_help.c.

◆ CHGetResourceString()

int CHGetResourceString ( Display *  pDisplay,
const char *  szIdentifier,
char *  szData,
int  cbData 
)

Queries desktop resource strings (may become deprecated)

Parameters
pDisplayDisplay pointer (NULL for default)
szIdentifierThe item to query
szDataOutput buffer
cbDataSize of the output buffer in bytes
Returns
length of string (excluding zero byte) or -1 if error or no matching identifier

This queries string values from the 'Old' resource manager. This function is deprecated. Some window managers may still supporte it, however, so it's worth keeping for now.

Header File: conf_help.h

Definition at line 474 of file conf_help.c.

◆ CHGetStaticBackgroundColor()

const char* CHGetStaticBackgroundColor ( Display *  pDisplay)

returns background color for static elements

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'static' background color as a string

Returns const pointer to the background color as a string, default "#edeceb" or "#ededececebeb" Static background is for menus, toolbars, labels, and so forth

Header File: conf_help.h

Definition at line 3288 of file conf_help.c.

◆ CHGetTextColor()

const char* CHGetTextColor ( Display *  pDisplay)

returns text color

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the text color as a string

Returns const pointer to the text color as a string, default "#000000" or "#000000000000" This is the default text/foreground color for everything that doesn't have a special color definition.

Header File: conf_help.h

Definition at line 3399 of file conf_help.c.

◆ CHGetToolTipBackgroundColor()

const char* CHGetToolTipBackgroundColor ( Display *  pDisplay)

returns background color for 'tool tips'

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'tool tip' background color as a string

Returns const pointer to the background color as a string, default "#f8f880" or "#f8f8f8f88080"

Header File: conf_help.h

Definition at line 3299 of file conf_help.c.

◆ CHGetToolTipTextColor()

const char* CHGetToolTipTextColor ( Display *  pDisplay)

returns text color for 'tool tips'

Parameters
pDisplayThe Display pointer (NULL for default)
Returns
const pointer to the 'tool tip' text color as a string

Returns const pointer to the text color as a string, default "#000000" or "#000000000000"

Header File: conf_help.h

Definition at line 3390 of file conf_help.c.

◆ CHGetXSetting()

const CHXSetting* CHGetXSetting ( Display *  pDisplay,
const char *  szSettingName 
)

returns a pointer to a specific X setting entry by name

Parameters
pDisplayThe Display pointer (NULL for default)
szSettingNameThe name of the setting as a 0-byte terminated string
Returns
A const pointer to the cached CHXSetting structure

Use this function to query a specific CHXSetting structure via the setting name

Header File: conf_help.h

Definition at line 1746 of file conf_help.c.

◆ CHGetXSettings()

const CHXSettings* CHGetXSettings ( Display *  pDisplay)

returns a pointer to the cached X settings

Parameters
pDisplayThe Display pointer (NULL for default)

Returns a (const) pointer to the CHXSettings structure that wraps the cached X settings

Header File: conf_help.h

◆ CHSettingsRefresh()

void CHSettingsRefresh ( Display *  pDisplay)

refresh the internally cached X settings

Parameters
pDisplayThe Display pointer (NULL for default)

This function will refresh the internally cached X settings using various methods to query the system's parameter storage, some deprecated, some in accordance with the latest window manager specs.

Header File: conf_help.h

Definition at line 1798 of file conf_help.c.