1 /*
2  * $Id: keydefs.h 766 2007-10-23 23:59:00Z hubert@u.washington.edu $
3  *
4  * ========================================================================
5  * Copyright 2006-2007 University of Washington
6  * Copyright 2013-2021 Eduardo Chappa
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * ========================================================================
15  */
16 
17 #ifndef PICO_KEYDEFS_INCLUDED
18 #define PICO_KEYDEFS_INCLUDED
19 
20 /*
21  * Key value definitions for pico/pine
22  */
23 
24 
25 /*
26  * Char conversion constants
27  * Make these different values than c-client's U8G_ERROR constants, though I don't
28  * think that is necessary.
29  * These values are not possible as regular UCS-4 values.
30  */
31 
32 #undef CTRL
33 #define CTRL		0x1000000
34 #define FUNC		0x2000000
35 
36 #define KEY_BASE	0x40000000
37 #define CCONV_NEEDMORE	(KEY_BASE+1)	/* need more octets */
38 #define CCONV_BADCHAR	(KEY_BASE+2)	/* can tell it's bad conversion */
39 #define CCONV_EOF	(KEY_BASE+3)
40 
41 /*
42  * defs for keypad and function keys...
43  */
44 #define KEY_UP		(KEY_BASE+0x100)
45 #define KEY_DOWN	(KEY_BASE+0x101)
46 #define KEY_RIGHT	(KEY_BASE+0x102)
47 #define KEY_LEFT	(KEY_BASE+0x103)
48 #define KEY_PGUP	(KEY_BASE+0x104)
49 #define KEY_PGDN	(KEY_BASE+0x105)
50 #define KEY_HOME	(KEY_BASE+0x106)
51 #define KEY_END		(KEY_BASE+0x107)
52 #define KEY_DEL		(KEY_BASE+0x108)
53 #define BADESC		(KEY_BASE+0x109)
54 #define KEY_MOUSE	(KEY_BASE+0x10a)
55 #define KEY_SCRLUPL	(KEY_BASE+0x10b)
56 #define KEY_SCRLDNL	(KEY_BASE+0x10c)
57 #define KEY_SCRLTO	(KEY_BASE+0x10d)
58 #define KEY_XTERM_MOUSE	(KEY_BASE+0x10e)
59 #define KEY_DOUBLE_ESC	(KEY_BASE+0x10f)
60 #define KEY_SWALLOW_Z	(KEY_BASE+0x110)
61 #define KEY_SWAL_UP	(KEY_BASE+0x111)	/* These four have to be in the same order */
62 #define KEY_SWAL_DOWN	(KEY_BASE+0x112)	/* as KEY_UP, KEY_DOWN, ...                */
63 #define KEY_SWAL_RIGHT	(KEY_BASE+0x113)
64 #define KEY_SWAL_LEFT	(KEY_BASE+0x114)
65 #define KEY_KERMIT	(KEY_BASE+0x115)
66 #define KEY_JUNK	(KEY_BASE+0x116)
67 #define KEY_RESIZE	(KEY_BASE+0x117)
68 #define CTRL_KEY_UP	(KEY_BASE+0x118)
69 #define CTRL_KEY_DOWN	(KEY_BASE+0x119)
70 #define CTRL_KEY_RIGHT	(KEY_BASE+0x11a)
71 #define CTRL_KEY_LEFT	(KEY_BASE+0x11b)
72 
73 /*
74  * Don't think we are using the fact that this is zero anywhere,
75  * but just in case we'll leave it.
76  */
77 #define NO_OP_COMMAND	0x0	/* no-op for short timeouts      */
78 
79 #define NO_OP_IDLE	(KEY_BASE+0x120)	/* no-op for >25 second timeouts */
80 #define READY_TO_READ	(KEY_BASE+0x121)
81 #define BAIL_OUT	(KEY_BASE+0x122)
82 #define PANIC_NOW	(KEY_BASE+0x123)
83 #define READ_INTR	(KEY_BASE+0x124)
84 #define NODATA		(KEY_BASE+0x125)
85 #define KEY_UTF8	(KEY_BASE+0x126)
86 #define KEY_UNKNOWN	(KEY_BASE+0x127)
87 
88 /*
89  * defines for function keys
90  */
91 #define F1      (KEY_BASE+FUNC+0)      /* Function key one              */
92 #define F2      (KEY_BASE+FUNC+1)      /* Function key two              */
93 #define F3      (KEY_BASE+FUNC+2)      /* Function key three            */
94 #define F4      (KEY_BASE+FUNC+3)      /* Function key four             */
95 #define F5      (KEY_BASE+FUNC+4)      /* Function key five             */
96 #define F6      (KEY_BASE+FUNC+5)      /* Function key six              */
97 #define F7      (KEY_BASE+FUNC+6)      /* Function key seven            */
98 #define F8      (KEY_BASE+FUNC+7)      /* Function key eight            */
99 #define F9      (KEY_BASE+FUNC+8)      /* Function key nine             */
100 #define F10     (KEY_BASE+FUNC+9)      /* Function key ten              */
101 #define F11     (KEY_BASE+FUNC+0xa)    /* Function key eleven           */
102 #define F12     (KEY_BASE+FUNC+0xb)    /* Function key twelve           */
103 
104 /* 1st tier pine function keys */
105 #define PF1	F1
106 #define PF2	F2
107 #define PF3	F3
108 #define PF4	F4
109 #define PF5	F5
110 #define PF6	F6
111 #define PF7	F7
112 #define PF8	F8
113 #define PF9	F9
114 #define PF10	F10
115 #define PF11	F11
116 #define PF12	F12
117 
118 #define PF2OPF(x)	(x + 0x10)
119 #define PF2OOPF(x)	(x + 0x20)
120 #define PF2OOOPF(x)	(x + 0x30)
121 
122 /* 2nd tier pine function keys */
123 #define OPF1	PF2OPF(PF1)
124 #define OPF2	PF2OPF(PF2)
125 #define OPF3	PF2OPF(PF3)
126 #define OPF4	PF2OPF(PF4)
127 #define OPF5	PF2OPF(PF5)
128 #define OPF6	PF2OPF(PF6)
129 #define OPF7	PF2OPF(PF7)
130 #define OPF8	PF2OPF(PF8)
131 #define OPF9	PF2OPF(PF9)
132 #define OPF10	PF2OPF(PF10)
133 #define OPF11	PF2OPF(PF11)
134 #define OPF12	PF2OPF(PF12)
135 
136 /* 3rd tier pine function keys */
137 #define OOPF1	PF2OOPF(PF1)
138 #define OOPF2	PF2OOPF(PF2)
139 #define OOPF3	PF2OOPF(PF3)
140 #define OOPF4	PF2OOPF(PF4)
141 #define OOPF5	PF2OOPF(PF5)
142 #define OOPF6	PF2OOPF(PF6)
143 #define OOPF7	PF2OOPF(PF7)
144 #define OOPF8	PF2OOPF(PF8)
145 #define OOPF9	PF2OOPF(PF9)
146 #define OOPF10	PF2OOPF(PF10)
147 #define OOPF11	PF2OOPF(PF11)
148 #define OOPF12	PF2OOPF(PF12)
149 
150 /* 4th tier pine function keys */
151 #define OOOPF1	PF2OOOPF(PF1)
152 #define OOOPF2	PF2OOOPF(PF2)
153 #define OOOPF3	PF2OOOPF(PF3)
154 #define OOOPF4	PF2OOOPF(PF4)
155 #define OOOPF5	PF2OOOPF(PF5)
156 #define OOOPF6	PF2OOOPF(PF6)
157 #define OOOPF7	PF2OOOPF(PF7)
158 #define OOOPF8	PF2OOOPF(PF8)
159 #define OOOPF9	PF2OOOPF(PF9)
160 #define OOOPF10	PF2OOOPF(PF10)
161 #define OOOPF11	PF2OOOPF(PF11)
162 #define OOOPF12	PF2OOOPF(PF12)
163 
164 #endif	/* PICO_KEYDEFS_INCLUDED */
165