File: main.c

package info (click to toggle)
keybinder 0.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,488 kB
  • ctags: 158
  • sloc: sh: 10,224; ansic: 520; makefile: 105; python: 10
file content (31 lines) | stat: -rw-r--r-- 622 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* main.c
 * Created in 2010 by Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
 *
 * This work is placed in the public domain.
 */

#include <stdio.h>

#include <gtk/gtk.h>
#include <keybinder.h>

#define EXAMPLE_KEY "<Ctrl>A"

void handler (const char *keystring, void *user_data) {
  printf("Handle %s (%p)!\n", keystring, user_data);
  keybinder_unbind(keystring, handler);
  gtk_main_quit();
}

int main (int argc, char *argv[])
{
  gtk_init(&argc, &argv);

  keybinder_init();
  keybinder_bind(EXAMPLE_KEY, handler, NULL);
  printf("Press " EXAMPLE_KEY " to activate keybinding and quit\n");

  gtk_main();
  return 0;
}