source: abuse/tags/pd/macabuse/imlib/keys.c @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 905 bytes
Line 
1#include "keys.hpp"
2#include <string.h>
3#include <ctype.h>
4
5char *jk_key_names[]= {"Up","Down","Left","Right",
6                    "Left Ctrl","Right Ctrl","Left Alt","Right Alt",
7                    "Left Shift","Right Shift","Caps Lock","Num Lock",
8                    "Home","End","Del","F1","F2","F3","F4","F5","F6",
9                    "F7","F8","F9","F10","Insert","PageUp","PageDown","Command"};
10
11
12void key_name(int key, char *buffer)
13{
14  static char sing[2];
15 if (key>255 && key<=JK_MAX_KEY)
16    strcpy(buffer,jk_key_names[key-256]);
17  else if (key==JK_BACKSPACE)
18    strcpy(buffer,"Backspace");
19  else if (key==JK_TAB)
20    strcpy(buffer,"Tab");
21  else if (key==JK_ENTER)
22    strcpy(buffer,"Enter");
23  else if (key==JK_ESC)
24    strcpy(buffer,"Esc");
25  else if (key==JK_SPACE)
26    strcpy(buffer,"Space");
27  else if (isprint(key))
28  {
29    buffer[0]=key;
30    buffer[1]=0;
31  } else buffer[0]=0;
32}
33
34
35
36
Note: See TracBrowser for help on using the repository browser.