libeek: add eek_xkb_layout_set_names_full_valist().
This commit is contained in:
@ -31,6 +31,7 @@
|
|||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/extensions/XKBgeom.h>
|
#include <X11/extensions/XKBgeom.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -613,38 +614,64 @@ eek_xkb_layout_set_names (EekXkbLayout *layout, XkbComponentNamesRec *names)
|
|||||||
/**
|
/**
|
||||||
* eek_xkb_layout_set_names_full:
|
* eek_xkb_layout_set_names_full:
|
||||||
* @layout: an #EekXkbLayout
|
* @layout: an #EekXkbLayout
|
||||||
* @keymap: keymap component name
|
* @Varargs: pairs of component name and value, terminated by -1.
|
||||||
* @keycodes: keycodes component name
|
|
||||||
* @types: types component name
|
|
||||||
* @compat: compat component name
|
|
||||||
* @symbols: symbols component name
|
|
||||||
* @geometry: geometry component name
|
|
||||||
*
|
*
|
||||||
* Set the XKB component names to @layout. This function is merely a
|
* Set the XKB component names to @layout. This function is merely a
|
||||||
* wrapper around eek_xkb_layout_set_names() to avoid passing a
|
* wrapper around eek_xkb_layout_set_names() to avoid passing a
|
||||||
* pointer of XkbComponentNamesRec, which is not currently available
|
* pointer of XkbComponentNamesRec, which is not currently available
|
||||||
* in the gobject-introspection repository.
|
* in the gobject-introspection repository.
|
||||||
*
|
*
|
||||||
|
* Available component names are: keymap, keycodes, types, compat,
|
||||||
|
* symbols, geometry.
|
||||||
|
*
|
||||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||||
* Since: 0.0.2
|
* Since: 0.0.2
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
eek_xkb_layout_set_names_full (EekXkbLayout *layout,
|
eek_xkb_layout_set_names_full (EekXkbLayout *layout,
|
||||||
const gchar *keymap,
|
...)
|
||||||
const gchar *keycodes,
|
{
|
||||||
const gchar *types,
|
va_list var_args;
|
||||||
const gchar *compat,
|
va_start (var_args, layout);
|
||||||
const gchar *symbols,
|
eek_xkb_layout_set_names_full_valist (layout, var_args);
|
||||||
const gchar *geometry)
|
va_end (var_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* eek_xkb_layout_set_names_full_valist:
|
||||||
|
* @layout: an #EekXkbLayout
|
||||||
|
* @var_args: <type>va_list</type> of pairs of component name and value.
|
||||||
|
*
|
||||||
|
* See eek_xkb_layout_set_names_full(), this version takes a
|
||||||
|
* <type>va_list</type> for language bindings to use.
|
||||||
|
*
|
||||||
|
* Since: 0.0.5
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
eek_xkb_layout_set_names_full_valist (EekXkbLayout *layout,
|
||||||
|
va_list var_args)
|
||||||
{
|
{
|
||||||
XkbComponentNamesRec names;
|
XkbComponentNamesRec names;
|
||||||
|
gchar *name, *value;
|
||||||
|
|
||||||
names.keymap = (char *)keymap;
|
memset (&names, 0, sizeof names);
|
||||||
names.keycodes = (char *)keycodes;
|
name = va_arg (var_args, gchar *);
|
||||||
names.types = (char *)types;
|
while (name != (gchar *)-1) {
|
||||||
names.compat = (char *)compat;
|
value = va_arg (var_args, gchar *);
|
||||||
names.symbols = (char *)symbols;
|
if (g_strcmp0 (name, "keymap") == 0)
|
||||||
names.geometry = (char *)geometry;
|
names.keymap = (char *)value;
|
||||||
|
else if (g_strcmp0 (name, "keycodes") == 0)
|
||||||
|
names.keycodes = (char *)value;
|
||||||
|
else if (g_strcmp0 (name, "types") == 0)
|
||||||
|
names.types = (char *)value;
|
||||||
|
else if (g_strcmp0 (name, "compat") == 0)
|
||||||
|
names.compat = (char *)value;
|
||||||
|
else if (g_strcmp0 (name, "symbols") == 0)
|
||||||
|
names.symbols = (char *)value;
|
||||||
|
else if (g_strcmp0 (name, "geometry") == 0)
|
||||||
|
names.geometry = (char *)value;
|
||||||
|
name = va_arg (var_args, gchar *);
|
||||||
|
}
|
||||||
return eek_xkb_layout_set_names (layout, &names);
|
return eek_xkb_layout_set_names (layout, &names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,12 +63,10 @@ gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
|||||||
|
|
||||||
gboolean eek_xkb_layout_set_names_full
|
gboolean eek_xkb_layout_set_names_full
|
||||||
(EekXkbLayout *layout,
|
(EekXkbLayout *layout,
|
||||||
const gchar *keymap,
|
...);
|
||||||
const gchar *keycodes,
|
gboolean eek_xkb_layout_set_names_full_valist
|
||||||
const gchar *types,
|
(EekXkbLayout *layout,
|
||||||
const gchar *compat,
|
va_list var_args);
|
||||||
const gchar *symbols,
|
|
||||||
const gchar *geometry);
|
|
||||||
|
|
||||||
gboolean eek_xkb_layout_set_keycodes
|
gboolean eek_xkb_layout_set_keycodes
|
||||||
(EekXkbLayout *layout,
|
(EekXkbLayout *layout,
|
||||||
|
|||||||
Reference in New Issue
Block a user