diff options
Diffstat (limited to 'libxklavier/xklavier_config.h')
-rw-r--r-- | libxklavier/xklavier_config.h | 519 |
1 files changed, 0 insertions, 519 deletions
diff --git a/libxklavier/xklavier_config.h b/libxklavier/xklavier_config.h deleted file mode 100644 index e172acc..0000000 --- a/libxklavier/xklavier_config.h +++ /dev/null @@ -1,519 +0,0 @@ -/** - * @file xklavier_config.h - */ - -#ifndef __XKLAVIER_CONFIG_H__ -#define __XKLAVIER_CONFIG_H__ - -#include <glib-object.h> -#include <libxklavier/xklavier.h> - -/** - * Maximum name length, including '\'0' character - */ -#define XKL_MAX_CI_NAME_LENGTH 32 - -/** - * Maximum short description length, including '\\0' character. - * Important: this length is in bytes, so for unicode (UTF-8 encoding in - * XML file) the actual maximum length can be smaller. - */ -#define XKL_MAX_CI_SHORT_DESC_LENGTH 10 - -/** - * Maximum description length, including '\\0' character. - * Important: this length is in bytes, so for unicode (UTF-8 encoding in - * XML file) the actual maximum length can be smaller. - */ -#define XKL_MAX_CI_DESC_LENGTH 192 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - - typedef struct _XklConfigRegistry XklConfigRegistry; - typedef struct _XklConfigRegistryPrivate XklConfigRegistryPrivate; - typedef struct _XklConfigRegistryClass XklConfigRegistryClass; - - typedef struct _XklConfigItem XklConfigItem; - typedef struct _XklConfigItemClass XklConfigItemClass; - - typedef struct _XklConfigRec XklConfigRec; - typedef struct _XklConfigRecClass XklConfigRecClass; - -#define XKL_TYPE_CONFIG_REGISTRY (xkl_config_registry_get_type ()) -#define XKL_CONFIG_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_REGISTRY, XklConfigRegistry)) -#define XKL_CONFIG_REGISTRY_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_CONFIG_REGISTRY, XklConfigRegistryClass)) -#define XKL_IS_CONFIG_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_REGISTRY)) -#define XKL_IS_CONFIG_REGISTRY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_REGISTRY)) -#define XKL_CONFIG_REGISTRY_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_REGISTRY, XklConfigRegistryClass)) - -#define XKL_TYPE_CONFIG_ITEM (xkl_config_item_get_type ()) -#define XKL_CONFIG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_ITEM, XklConfigItem)) -#define XKL_CONFIG_ITEM_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_CONFIG_ITEM, XklConfigItemClass)) -#define XKL_IS_CONFIG_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_ITEM)) -#define XKL_IS_CONFIG_ITEM_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_ITEM)) -#define XKL_CONFIG_ITEM_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_ITEM, XklConfigItemClass)) - -#define XKL_TYPE_CONFIG_REC (xkl_config_rec_get_type ()) -#define XKL_CONFIG_REC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XKL_TYPE_CONFIG_REC, XklConfigRec)) -#define XKL_CONFIG_REC_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), XKL_CONFIG_REC, XklConfigRecClass)) -#define XKL_IS_CONFIG_REC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XKL_TYPE_CONFIG_REC)) -#define XKL_IS_CONFIG_REC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), XKL_TYPE_CONFIG_REC)) -#define XKL_CONFIG_REC_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), XKL_TYPE_CONFIG_REC, XklConfigRecClass)) - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -/** - * The configuration manager. Corresponds to XML element "configItem". - */ - struct _XklConfigRegistry { -/** - * The superclass object - */ - GObject parent; - - XklConfigRegistryPrivate *priv; - }; - -/** - * The XklConfigRegistry class, derived from GObject - */ - struct _XklConfigRegistryClass { - /** - * The superclass - */ - GObjectClass parent_class; - }; -/** - * Get type info for XConfig - * @return GType for XConfig - */ - extern GType xkl_config_registry_get_type(void); - -/** - * Create new XklConfig - * @return new instance - */ - extern XklConfigRegistry - * xkl_config_registry_get_instance(XklEngine * engine); - - - -/** - * The configuration item. Corresponds to XML element "configItem". - */ - struct _XklConfigItem { -/** - * The superclass object - */ - GObject parent; -/** - * The configuration item name. Corresponds to XML element "name". - */ - gchar name[XKL_MAX_CI_NAME_LENGTH]; - -/** - * The configuration item short description. Corresponds to XML element "shortDescription". - */ - gchar short_description[XKL_MAX_CI_DESC_LENGTH]; - -/** - * The configuration item description. Corresponds to XML element "description". - */ - gchar description[XKL_MAX_CI_DESC_LENGTH]; - }; - -/** - * The XklConfigItem class, derived from GObject - */ - struct _XklConfigItemClass { - /** - * The superclass - */ - GObjectClass parent_class; - }; -/** - * Get type info for XklConfigItem - * @return GType for XklConfigItem - */ - extern GType xkl_config_item_get_type(void); - -/** - * Create new XklConfigItem - * @return new instance - */ - extern XklConfigItem *xkl_config_item_new(void); - -/** - * Basic configuration params - */ - struct _XklConfigRec { -/** - * The superclass object - */ - GObject parent; -/** - * The keyboard model - */ - gchar *model; -/** - * The array of keyboard layouts - */ - gchar **layouts; -/** - * The array of keyboard layout variants (if any) - */ - gchar **variants; -/** - * The array of keyboard layout options - */ - gchar **options; - }; - -/** - * The XklConfigRec class, derived from GObject - */ - struct _XklConfigRecClass { - /** - * The superclass - */ - GObjectClass parent_class; - }; - -/** - * Get type info for XConfigRec - * @return GType for XConfigRec - */ - extern GType xkl_config_rec_get_type(void); - -/** - * Create new XklConfigRec - * @return new instance - */ - extern XklConfigRec *xkl_config_rec_new(void); - -/** - * @defgroup xklconfiginitterm XKB configuration handling initialization and termination - * @{ - */ - -/** - * Loads XML configuration registry - * @param file_name file name to load - * @return true on success - */ - extern gboolean - xkl_config_registry_load_from_file(XklConfigRegistry * config, - const gchar * file_name); - -/** - * Loads XML configuration registry - * @return true on success - */ - extern gboolean xkl_config_registry_load(XklConfigRegistry * - config); - -/** - * Frees XML configuration registry - */ - extern void xkl_config_registry_free(XklConfigRegistry * config); -/** @} */ - -/** - * @defgroup enum XKB configuration elements enumeration functions - * @{ - */ - -/** - * Callback type used for enumerating keyboard models, layouts, variants, options - * @param item is the item from registry - * @param data is anything which can be stored into the pointer - */ - typedef void (*ConfigItemProcessFunc) (const XklConfigItem * item, - gpointer data); - -/** - * Callback type used for enumerating keyboard option groups - * @param item is the item from registry - * @param allow_multiple_selection is a flag whether this group allows multiple selection - * @param data is anything which can be stored into the pointer - */ - typedef void (*GroupProcessFunc) (const XklConfigItem * item, - gboolean - allow_multiple_selection, - gpointer data); -/** - * Enumerates keyboard models from the XML configuration registry - * @param func is a callback to call for every model - * @param data is anything which can be stored into the pointer - */ - extern void xkl_config_registry_enum_models(XklConfigRegistry * - config, - ConfigItemProcessFunc - func, gpointer data); - -/** - * Enumerates keyboard layouts from the XML configuration registry - * @param func is a callback to call for every layout - * @param data is anything which can be stored into the pointer - */ - extern void xkl_config_registry_enum_layouts(XklConfigRegistry * - config, - ConfigItemProcessFunc - func, gpointer data); - -/** - * Enumerates keyboard layout variants from the XML configuration registry - * @param layout_name is the layout name for which variants will be listed - * @param func is a callback to call for every layout variant - * @param data is anything which can be stored into the pointer - */ - extern void - xkl_config_registry_enum_layout_variants(XklConfigRegistry * - config, - const gchar * - layout_name, - ConfigItemProcessFunc - func, gpointer data); - -/** - * Enumerates keyboard option groups from the XML configuration registry - * @param func is a callback to call for every option group - * @param data is anything which can be stored into the pointer - */ - extern void - xkl_config_registry_enum_option_groups(XklConfigRegistry * - config, - GroupProcessFunc func, - gpointer data); - -/** - * Enumerates keyboard options from the XML configuration registry - * @param option_group_name is the option group name for which variants - * will be listed - * @param func is a callback to call for every option - * @param data is anything which can be stored into the pointer - */ - extern void xkl_config_registry_enum_options(XklConfigRegistry * - config, - const gchar * - option_group_name, - ConfigItemProcessFunc - func, gpointer data); - -/** @} */ - -/** - * @defgroup lookup XKB configuration element lookup functions - * @{ - */ - -/** - * Loads a keyboard model information from the XML configuration registry. - * @param item is a pointer to a XklConfigItem containing the name of the - * keyboard model. On successfull return, the descriptions are filled. - * @return TRUE if appropriate element was found and loaded - */ - extern gboolean xkl_config_registry_find_model(XklConfigRegistry * - config, - XklConfigItem * - item); - -/** - * Loads a keyboard layout information from the XML configuration registry. - * @param item is a pointer to a XklConfigItem containing the name of the - * keyboard layout. On successfull return, the descriptions are filled. - * @return TRUE if appropriate element was found and loaded - */ - extern gboolean xkl_config_registry_find_layout(XklConfigRegistry * - config, - XklConfigItem * - item); - -/** - * Loads a keyboard layout variant information from the XML configuration - * registry. - * @param layout_name is a name of the parent layout - * @param item is a pointer to a XklConfigItem containing the name of the - * keyboard layout variant. On successfull return, the descriptions are filled. - * @return TRUE if appropriate element was found and loaded - */ - extern gboolean xkl_config_registry_find_variant(XklConfigRegistry - * config, - const char - *layout_name, - XklConfigItem * - item); - -/** - * Loads a keyboard option group information from the XML configuration - * registry. - * @param item is a pointer to a XklConfigItem containing the name of the - * keyboard option group. On successfull return, the descriptions are filled. - * @param allow_multiple_selection is a pointer to some gboolean variable to fill - * the corresponding attribute of XML element "group". - * @return TRUE if appropriate element was found and loaded - */ - extern gboolean - xkl_config_registry_find_option_group(XklConfigRegistry * - config, - XklConfigItem * item, - gboolean * - allow_multiple_selection); - -/** - * Loads a keyboard option information from the XML configuration - * registry. - * @param option_group_name is a name of the option group - * @param item is a pointer to a XklConfigItem containing the name of the - * keyboard option. On successfull return, the descriptions are filled. - * @return TRUE if appropriate element was found and loaded - */ - extern gboolean xkl_config_registry_find_option(XklConfigRegistry * - config, - const gchar * - option_group_name, - XklConfigItem * - item); -/** @} */ - -/** - * @defgroup activation XKB configuration activation - * @{ - */ - -/** - * Activates some XKB configuration - * @param data is a valid XKB configuration - * description. Can be NULL - * @return TRUE on success - * @see XklSetKeyAsSwitcher - * At the moment, accepts only _ONE_ layout. Later probably I'll improve this.. - */ - extern gboolean xkl_config_rec_activate(const XklConfigRec * data, - XklEngine * engine); - -/** - * Loads the current XKB configuration (from X server) - * @param data is a buffer for XKB configuration - * @return TRUE on success - */ - extern gboolean xkl_config_rec_get_from_server(XklConfigRec * data, - XklEngine * engine); - -/** - * Loads the current XKB configuration (from backup) - * @param data is a buffer for XKB configuration - * @return TRUE on success - * @see XklBackupNamesProp - */ - extern gboolean xkl_config_rec_get_from_backup(XklConfigRec * data, - XklEngine * engine); - -/** - * Writes some XKB configuration into XKM/XKB file - * @param file_name is a name of the file to create - * @param data is a valid XKB configuration - * description. Can be NULL - * @param binary is a flag indicating whether the output file should be binary - * @return TRUE on success - */ - extern gboolean xkl_config_rec_write_to_file(XklEngine * engine, - const gchar * - file_name, - const XklConfigRec * - data, - const gboolean - binary); - -/** @} */ - -/** - * @defgroup props Saving and restoring XKB configuration into X root window properties - * Generalizes XkbRF_GetNamesProp and XkbRF_SetNamesProp. - * @{ - */ - -/** - * Gets the XKB configuration from any root window property - * @param rules_atom_name is an atom name of the root window property to read - * @param rules_file_out is a pointer to hold the file name - * @param config_out is a buffer to hold the result - - * all records are allocated using standard malloc - * @return TRUE on success - */ - extern gboolean - xkl_config_rec_get_from_root_window_property(XklConfigRec * - config_out, - Atom - rules_atom_name, - gchar ** - rules_file_out, - XklEngine * - engine); - -/** - * Saves the XKB configuration into any root window property - * @param rules_atom_name is an atom name of the root window property to write - * @param rules_file is a rules file name - * @param config is a configuration to save - * @return TRUE on success - */ - extern gboolean xkl_config_rec_set_to_root_window_property(const - XklConfigRec - * - config, - Atom - rules_atom_name, - gchar * - rules_file, - XklEngine - * - engine); - -/** - * Backups current XKB configuration into some property - - * if this property is not defined yet. - * @return TRUE on success - */ - extern gboolean xkl_backup_names_prop(XklEngine * engine); - -/** - * Restores XKB from the property saved by xkl_backup_names_prop - * @return TRUE on success - * @see xkl_backup_names_prop - */ - extern gboolean xkl_restore_names_prop(XklEngine * engine); - -/** @} */ - -/** - * @defgroup xklconfig XklConfigRec management utilities - * Little utilities for managing XklConfigRec. - * @{ - */ - -/** - * Resets the record (equal to Destroy and Init) - * @param data is a record to reset - */ - extern void xkl_config_rec_reset(XklConfigRec * data); - -/** - * Compares the records - * @param data1 is a record to compare - * @param data2 is another record - * @return TRUE if records are same - */ - extern gboolean xkl_config_rec_equals(XklConfigRec * data1, - XklConfigRec * data2); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif |