_XSETTINGS_SETTINGS Format

The _XSETTINGS_SETTINGS property is of form 8 and type _XSETTINGS_SETTINGS. The contents are a

 1	CARD8    byte-order
 3               unused
 4      CARD32   SERIAL
 4      CARD32   N_SETTINGS
    

Followed by N_SETTINGS settings records, which have a header:

 1      SETTING_TYPE  type
 1                    unused
 2      n             name-len
 n      STRING8       name
 P                    unused, p=pad(n)
 4      CARD32        last-change-serial
    

Where SETTING_TYPE is

 0  XSettingsTypeInteger
 1  XSettingsTypeString
 2  XSettingsTypeColor
    

followed by the body. If TYPE = XSettingsTypeString the body is:

 4      n             value-len
 n      STRING8       value
 P                    unused, p=pad(n)
    

If TYPE == XSettingsTypeInteger, then the body is:

 4      INT32         value
    

If TYPE == XSettingsTypeColor, then the body is:

 2      CARD16        red
 2      CARD16        green
 2      CARD16        blue
 2      CARD16        alpha
    

If the setting does not need the alpha field, it should be set to 65535.

Setting names must be confined to the ascii characters:

 'A'-'Z' 'a'-'z' '0'-'9' '_' and '/'
    

With the additional restrictions that '/' cannot appear in the leading or trailing position, that two occurences of '/' cannot be consecutive, and that the first character of the name, and and the first character after a slash cannot be one of '0'-'9'. Names may not be empty.

So,

 "GTK/colors/background0"
 "_background"
 "_111"
    

are legitimate names, while

 "/"
 "_background/"
 "GTK//colors"
 ""
    

Are not legitimate names.

The names, types, contents, and default values of standard settings will be separately agreed upon.

Names beginning with 'Net/' and case variants of that string are reserved and must not be used without prior agreement.

The 'serial' field and and the 'last-change-serial' field of the each settings record can be used to tell which settings have changed since the last time a client retrieved the _XSETTINGS_SETTINGS property. Each time the client retrieves the contents of the _XSETTINGS_SETTINGS property it should store the contents of the 'serial' field. When it next retrieves the property, any settings whose 'last-change-serial' is greater than the stored value.

(Careful clients will make provisions for wrap-around of the serial field. This is, however, not expected to happen in practice.)