Added 'Resident' field to ensure that the handler is included in the
[AROS.git] / rom / devs / input / support.c
blobddd2d046c70970144b5b021e9fdf4174807d7c51
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
10 #include <proto/exec.h>
11 #include <exec/tasks.h>
12 #include <exec/lists.h>
13 #include <exec/memory.h>
15 #include "input_intern.h"
17 /***************************
18 ** GetEventsFromQueue() **
19 ***************************/
20 struct InputEvent *GetEventsFromQueue(struct inputbase *InputDevice)
22 struct InputEvent *ie;
24 ie = InputDevice->EventQueueHead;
26 /* No more events in the queue */
27 InputDevice->EventQueueHead = NULL;
28 InputDevice->EventQueueTail = NULL;
30 return (ie);
35 /******************
36 ** AddEQTail() **
37 ******************/
38 /* Adds a chian of InputEvents to the eventqueue */
39 VOID AddEQTail(struct InputEvent *ie, struct inputbase *InputDevice)
41 /* Experimental */
42 if (InputDevice->pub.id_Flags & IDF_SWAP_BUTTONS)
44 UWORD code;
46 switch (ie->ie_Class)
48 /* FIXME: add more event classes to which this is applicable */
49 case IECLASS_RAWMOUSE:
50 code = ie->ie_Code & ~IECODE_UP_PREFIX;
52 switch (code) {
53 case IECODE_LBUTTON:
54 code = IECODE_RBUTTON;
55 break;
56 case IECODE_RBUTTON:
57 code = IECODE_LBUTTON;
58 break;
61 ie->ie_Code = code | (ie->ie_Code & IECODE_UP_PREFIX);
65 if (!InputDevice->EventQueueHead) /* Empty queue ? */
67 InputDevice->EventQueueHead = ie;
69 else
71 InputDevice->EventQueueTail->ie_NextEvent = ie;
74 /* Get last event in eventchain to add */
75 while (ie->ie_NextEvent)
76 ie = ie->ie_NextEvent;
78 InputDevice->EventQueueTail = ie;
80 return;
83 /*********************
84 ** IsQualifierKey **
85 *********************/
86 BOOL IsQualifierKey(UWORD key)
88 BOOL result = FALSE;
90 key &= ~IECODE_UP_PREFIX;
92 if ((key >= 0x60) && (key <= 0x67))
94 result = TRUE;
97 return result;
100 /************************
101 ** IsKeyRepeatable() **
102 ************************/
103 BOOL IsRepeatableKey(UWORD key)
105 BOOL result = TRUE;
107 key &= ~IECODE_UP_PREFIX;
109 /* stegerg: It looks like this is really all so no need to
110 check the keymap->repeatable tables. I have checked this
111 on the Amiga. All keys except the qualifier keys are
112 treated as repeatable raw (!!!) keys. Here in input.device
113 we have only raw keys. For vanilla keys there's MapRawKey()
114 and this function thakes care of filtering out repeated
115 raw keys if the corresponding KeyMap->repeatable table says
116 that this key is not repeatable */
118 if (IsQualifierKey(key))
120 result = FALSE;
123 return result;