2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
10 #include <proto/exec.h>
11 #include <exec/tasks.h>
12 #include <exec/lists.h>
13 #include <exec/memory.h>
14 #include <devices/rawkeycodes.h>
16 #include "input_intern.h"
18 /***************************
19 ** GetEventsFromQueue() **
20 ***************************/
21 struct InputEvent
*GetEventsFromQueue(struct inputbase
*InputDevice
)
23 struct InputEvent
*ie
;
25 ie
= InputDevice
->EventQueueHead
;
27 /* No more events in the queue */
28 InputDevice
->EventQueueHead
= NULL
;
29 InputDevice
->EventQueueTail
= NULL
;
39 /* Adds a chian of InputEvents to the eventqueue */
40 VOID
AddEQTail(struct InputEvent
*ie
, struct inputbase
*InputDevice
)
44 /* Perform any necessary modifications to event */
48 /* Add previous codes and qualifiers to the event for dead key
50 ie
->ie_Prev1DownCode
= InputDevice
->Prev1DownCode
;
51 ie
->ie_Prev1DownQual
= InputDevice
->Prev1DownQual
;
52 ie
->ie_Prev2DownCode
= InputDevice
->Prev2DownCode
;
53 ie
->ie_Prev2DownQual
= InputDevice
->Prev2DownQual
;
55 /* Cache/rotate old codes and qualifiers for next event */
56 if ((ie
->ie_Code
& IECODE_UP_PREFIX
) == 0
57 && !(ie
->ie_Code
>= RAWKEY_LSHIFT
58 && ie
->ie_Code
<= RAWKEY_RAMIGA
))
60 InputDevice
->Prev2DownCode
= InputDevice
->Prev1DownCode
;
61 InputDevice
->Prev2DownQual
= InputDevice
->Prev1DownQual
;
62 InputDevice
->Prev1DownCode
= (UBYTE
) ie
->ie_Code
;
63 InputDevice
->Prev1DownQual
= (UBYTE
) ie
->ie_Qualifier
;
67 /* FIXME: add more event classes to which this is applicable */
68 case IECLASS_RAWMOUSE
:
70 if (InputDevice
->pub
.id_Flags
& IDF_SWAP_BUTTONS
)
72 code
= ie
->ie_Code
& ~IECODE_UP_PREFIX
;
77 code
= IECODE_RBUTTON
;
80 code
= IECODE_LBUTTON
;
83 ie
->ie_Code
= code
| (ie
->ie_Code
& IECODE_UP_PREFIX
);
87 if (!InputDevice
->EventQueueHead
) /* Empty queue? */
89 InputDevice
->EventQueueHead
= ie
;
93 InputDevice
->EventQueueTail
->ie_NextEvent
= ie
;
96 /* Get last event in eventchain to add */
97 while (ie
->ie_NextEvent
)
98 ie
= ie
->ie_NextEvent
;
100 InputDevice
->EventQueueTail
= ie
;
105 /*********************
107 *********************/
108 BOOL
IsQualifierKey(UWORD key
)
112 key
&= ~IECODE_UP_PREFIX
;
114 if ((key
>= 0x60) && (key
<= 0x67))
122 /************************
123 ** IsKeyRepeatable() **
124 ************************/
125 BOOL
IsRepeatableKey(UWORD key
)
129 key
&= ~IECODE_UP_PREFIX
;
131 /* stegerg: It looks like this is really all so no need to
132 check the keymap->repeatable tables. I have checked this
133 on the Amiga. All keys except the qualifier keys are
134 treated as repeatable raw (!!!) keys. Here in input.device
135 we have only raw keys. For vanilla keys there's MapRawKey()
136 and this function takes care of filtering out repeated
137 raw keys if the corresponding KeyMap->repeatable table says
138 that this key is not repeatable */
140 if (IsQualifierKey(key
))