keybinder

keybinder

Functions

Description

Functions

KeybinderHandler ()

void
(*KeybinderHandler) (const char *keystring,
                     void *user_data);

keybinder_init ()

void
keybinder_init (void);

Initialize the keybinder library.

This function must be called after initializing GTK, before calling any other function in the library. Can only be called once.


keybinder_set_use_cooked_accelerators ()

void
keybinder_set_use_cooked_accelerators (gboolean use_cooked);

"Cooked" accelerators use symbols produced by using modifiers such as shift or altgr, for example if "!" is produced by "Shift+1".

If cooked accelerators are enabled, use "<Ctrl>exclam" to bind "Ctrl+!" If disabled, use "<Ctrl><Shift>1" to bind "Ctrl+Shift+1". These two examples are not equal on all keymaps.

The cooked accelerator keyvalue and modifiers are provided by the function gdk_keymap_translate_keyboard_state()

Cooked accelerators are useful if you receive keystrokes from GTK to bind, but raw accelerators can be useful if you or the user inputs accelerators as text.

Default: Enabled. Should be set before binding anything.

Parameters

use_cooked

if FALSE disable cooked accelerators

 

keybinder_bind ()

gboolean
keybinder_bind (const char *keystring,
                KeybinderHandler handler,
                void *user_data);

Grab a key combination globally and register a callback to be called each time the key combination is pressed.

This function is excluded from introspected bindings and is replaced by keybinder_bind_full.

[skip]

Parameters

keystring

an accelerator description (gtk_accelerator_parse() format)

 

handler

callback function

 

user_data

data to pass to handler

 

Returns

TRUE if the accelerator could be grabbed


keybinder_bind_full ()

gboolean
keybinder_bind_full (const char *keystring,
                     KeybinderHandler handler,
                     void *user_data,
                     GDestroyNotify notify);

Grab a key combination globally and register a callback to be called each time the key combination is pressed.

[rename-to keybinder_bind]

Parameters

keystring

an accelerator description (gtk_accelerator_parse() format)

 

handler

callback function.

[scope notified]

user_data

data to pass to handler .

[closure][allow-none]

notify

called when handler is unregistered.

[allow-none]

Returns

TRUE if the accelerator could be grabbed

Since: 0.3.0


keybinder_unbind ()

void
keybinder_unbind (const char *keystring,
                  KeybinderHandler handler);

Unregister a previously bound callback for this keystring.

NOTE: multiple callbacks per keystring are not properly supported. You might as well use keybinder_unbind_all().

This function is excluded from introspected bindings and is replaced by keybinder_unbind_all().

[skip]

Parameters

keystring

an accelerator description (gtk_accelerator_parse() format)

 

handler

callback function

 

keybinder_unbind_all ()

void
keybinder_unbind_all (const char *keystring);

Unregister all previously bound callbacks for this keystring.

[rename-to keybinder_unbind]

Parameters

keystring

an accelerator description (gtk_accelerator_parse() format)

 

Since: 0.3.0


keybinder_get_current_event_time ()

guint32
keybinder_get_current_event_time (void);

Returns

the current event timestamp


keybinder_supported ()

gboolean
keybinder_supported (void);

Returns

TRUE if keybindings are supported

Types and Values