MCPcopy Create free account
hub / github.com/NetHack/NetHack / ConvertKey

Function ConvertKey

sys/amiga/amiwind.c:179–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177 */
178
179int
180ConvertKey(struct IntuiMessage *message)
181{
182 static struct InputEvent theEvent;
183 static char numpad[] = "bjnh.lyku";
184 static char ctrl_numpad[] = "\x02\x0A\x0E\x08.\x0C\x19\x0B\x15";
185 static char shift_numpad[] = "BJNH.LYKU";
186
187 unsigned char buffer[10];
188 struct Window *w = message->IDCMPWindow;
189 int length;
190 ULONG qualifier;
191 char numeric_pad, shift, control, alt;
192
193 if (amii_wins[WIN_MAP])
194 w = amii_wins[WIN_MAP]->win;
195 qualifier = message->Qualifier;
196
197 control = (qualifier & IEQUALIFIER_CONTROL) != 0;
198 shift = (qualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)) != 0;
199 alt = (qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_RALT)) != 0;
200
201 /* Allow ALT to function as a META key ... */
202 /* But make it switchable - alt is needed for some non-US keymaps */
203 if (sysflags.altmeta)
204 qualifier &= ~(IEQUALIFIER_LALT | IEQUALIFIER_RALT);
205 numeric_pad = (qualifier & IEQUALIFIER_NUMERICPAD) != 0;
206
207 /*
208 * Shortcut for HELP and arrow keys. I suppose this is allowed.
209 * The defines are in intuition/intuition.h, and the keys don't
210 * serve 'text' input, normally. Also, parsing their escape
211 * sequences is such a mess...
212 */
213
214 switch (message->Code) {
215 case RAWHELP:
216 if (alt) {
217 EditColor();
218 return (-1);
219 }
220#ifdef CLIPPING
221 else if (WINVERS_AMIV && control) {
222 EditClipping();
223
224 CO = (w->Width - w->BorderLeft - w->BorderRight) / mxsize;
225 LI = (w->Height - w->BorderTop - w->BorderBottom) / mysize;
226 clipxmax = CO + clipx;
227 clipymax = LI + clipy;
228 if (CO < COLNO || LI < ROWNO) {
229 clipping = TRUE;
230 amii_cliparound(u.ux, u.uy);
231 } else {
232 clipping = FALSE;
233 clipx = clipy = 0;
234 }
235 BufferQueueChar('R' - 64);
236 return (-1);

Callers 2

DoMenuScrollFunction · 0.85
ProcessMessageFunction · 0.85

Calls 5

EditColorFunction · 0.85
dispmap_sanityFunction · 0.85
amii_cliparoundFunction · 0.85
doredrawFunction · 0.85
flush_screenFunction · 0.85

Tested by

no test coverage detected