csope/src/keys.h

63 lines
1.3 KiB
C
Raw Normal View History

2023-08-08 14:34:15 -04:00
#ifndef KEYS_H
#define KEYS_H
2023-08-15 04:56:04 -04:00
#include <ncurses.h>
2023-08-08 14:34:15 -04:00
/* Key macros */
/* These macros are not guaranteed to be defined,
* however we wish to test for these anyways while
* interpretting user commands.
* Input values are guaranteed to be postive,
* so setting them to -1 means the test always just silently fail,
* but compile when the they are not supported means of input.
*/
#define KEY_UNDEF_BASE 0
#ifndef KEY_DOWN
2023-08-13 05:21:52 -04:00
# define KEY_DOWN KEY_UNDEF_BASE - 1
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_UP
2023-08-13 05:21:52 -04:00
# define KEY_UP KEY_UNDEF_BASE - 2
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_LEFT
2023-08-13 05:21:52 -04:00
# define KEY_LEFT KEY_UNDEF_BASE - 3
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_RIGHT
2023-08-13 05:21:52 -04:00
# define KEY_RIGHT KEY_UNDEF_BASE - 4
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_HOME
2023-08-13 05:21:52 -04:00
# define KEY_HOME _KEY_UNDEF_BASE - 5
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_LL
2023-08-13 05:21:52 -04:00
# define KEY_LL KEY_UNDEF_BASE - 6
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_PPAGE
2023-08-13 05:21:52 -04:00
# define KEY_PPAGE KEY_UNDEF_BASE - 7
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_NPAGE
2023-08-13 05:21:52 -04:00
# define KEY_NPAGE KEY_UNDEF_BASE - 8
2023-08-08 14:34:15 -04:00
#endif
2023-08-10 08:36:16 -04:00
#ifndef KEY_ENTER
2023-08-13 05:21:52 -04:00
# define KEY_ENTER KEY_UNDEF_BASE - 9
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_CLEAR
2023-08-13 05:21:52 -04:00
# define KEY_CLEAR KEY_UNDEF_BASE - 10
2023-08-08 14:34:15 -04:00
#endif
#ifndef KEY_RESIZE
2023-08-13 05:21:52 -04:00
# define KEY_RESIZE KEY_UNDEF_BASE - 11
2023-08-08 14:34:15 -04:00
#endif
2023-08-11 17:31:25 -04:00
#ifndef KEY_END
2023-08-13 05:21:52 -04:00
# define KEY_END KEY_UNDEF_BASE - 12
2023-08-11 17:31:25 -04:00
#endif
2023-08-08 14:34:15 -04:00
2023-08-09 07:49:11 -04:00
/* Always define these keys */
2023-08-08 14:34:15 -04:00
#ifndef ESC
2023-08-13 05:21:52 -04:00
# define ESC '\033' /* escape character */
2023-08-08 14:34:15 -04:00
#endif
2023-08-09 07:49:11 -04:00
#ifndef DEL
2023-08-13 05:21:52 -04:00
# define DEL '\177' /* delete character */
2023-08-09 07:49:11 -04:00
#endif
2023-08-08 14:34:15 -04:00
#endif /* KEYS_H*/