pnmixer
Volume mixer for the system tray
Data Structures | Typedefs | Functions
hotkey.h File Reference

Header for hotkey.c. More...

#include <gdk/gdkx.h>
Include dependency graph for hotkey.h:

Go to the source code of this file.

Data Structures

struct  hotkey
 

Typedefs

typedef struct hotkey Hotkey
 

Functions

Hotkeyhotkey_new (guint code, GdkModifierType mods)
 
void hotkey_free (Hotkey *key)
 
gboolean hotkey_matches (Hotkey *hotkey, guint code, GdkModifierType mods)
 
void hotkey_ungrab (Hotkey *hotkey)
 
gboolean hotkey_grab (Hotkey *hotkey)
 
gchar * hotkey_code_to_accel (guint code, GdkModifierType mods)
 
void hotkey_accel_to_code (const gchar *accel, gint *code, GdkModifierType *mods)
 

Detailed Description

Header for hotkey.c.

Header for hotkey.c.

Definition in file hotkey.h.

Typedef Documentation

◆ Hotkey

typedef struct hotkey Hotkey

Definition at line 32 of file hotkey.h.

Function Documentation

◆ hotkey_accel_to_code()

void hotkey_accel_to_code ( const gchar *  accel,
gint *  code,
GdkModifierType *  mods 
)

Translate a Gtk Accelerator string to a key code and mods.

Parameters
accelthe accelerator string to parse.
codethe key code returned after parsing.
modsthe key modifiers after parsing.

Definition at line 230 of file hotkey.c.

◆ hotkey_code_to_accel()

gchar* hotkey_code_to_accel ( guint  code,
GdkModifierType  mods 
)

Translate a key into a Gtk Accelerator string.

Parameters
codethe key code to process.
modsthe key modifiers to process.
Returns
the accelerator string, must be freed.

Definition at line 208 of file hotkey.c.

◆ hotkey_free()

void hotkey_free ( Hotkey hotkey)

Ungrab a key and free any resources.

Parameters
hotkeya Hotkey instance.

Definition at line 160 of file hotkey.c.

◆ hotkey_grab()

gboolean hotkey_grab ( Hotkey hotkey)

Grab a key manually. Should be paired with a hotkey_ungrab() call.

Parameters
hotkeya Hotkey instance.
Returns
TRUE on success, FALSE on error.

Definition at line 92 of file hotkey.c.

◆ hotkey_matches()

gboolean hotkey_matches ( Hotkey hotkey,
guint  code,
GdkModifierType  mods 
)

Checks if the keycode we got (minus modifiers like numlock/capslock) matches the hotkey. Thus numlock + o will match o.

Parameters
hotkeya Hotkey instance.
codethe key code to compare against.
modsthe key modifiers to compare against.
Returns
TRUE if there is a match, FALSE otherwise.

Definition at line 138 of file hotkey.c.

◆ hotkey_new()

Hotkey* hotkey_new ( guint  code,
GdkModifierType  mods 
)

Creates a new hotkey and grab it.

Parameters
codethe key's code.
modsthe key's modifiers.
Returns
the newly created Hotkey instance.

Definition at line 179 of file hotkey.c.

◆ hotkey_ungrab()

void hotkey_ungrab ( Hotkey hotkey)

Ungrab a key manually. Should be paired with a hotkey_grab() call.

Parameters
hotkeya Hotkey instance.
Returns
TRUE on success, FALSE on error.

Definition at line 68 of file hotkey.c.