1 #ifndef DEVICES_INPUTEVENT_H
    2 #define DEVICES_INPUTEVENT_H
    3 
    4 /*
    5 	input.device event definitions
    6 
    7 	Copyright © 2002 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #ifndef DEVICES_TIMER_H
   11 # include <devices/timer.h>
   12 #endif
   13 
   14 #ifndef UTILITY_HOOKS_H
   15 # include <utility/hooks.h>
   16 #endif
   17 
   18 #ifndef UTILITY_TAGITEM_H
   19 # include <utility/tagitem.h>
   20 #endif
   21 
   22 #pragma pack(2)
   23 
   24 
   25 #define IECLASS_NULL            0x00
   26 #define IECLASS_RAWKEY          0x01
   27 #define IECLASS_RAWMOUSE        0x02
   28 #define IECLASS_EVENT           0x03
   29 #define IECLASS_POINTERPOS      0x04
   30 
   31 #define IECLASS_TIMER           0x06
   32 #define IECLASS_GADGETDOWN      0x07
   33 #define IECLASS_GADGETUP        0x08
   34 #define IECLASS_REQUESTER       0x09
   35 #define IECLASS_MENULIST        0x0A
   36 #define IECLASS_CLOSEWINDOW     0x0B
   37 #define IECLASS_SIZEWINDOW      0x0C
   38 #define IECLASS_REFRESHWINDOW   0x0D
   39 #define IECLASS_NEWPREFS        0x0E
   40 #define IECLASS_DISKREMOVED     0x0F
   41 #define IECLASS_DISKINSERTED    0x10
   42 #define IECLASS_ACTIVEWINDOW    0x11
   43 #define IECLASS_INACTIVEWINDOW  0x12
   44 #define IECLASS_NEWPOINTERPOS   0x13
   45 #define IECLASS_MENUHELP        0x14
   46 #define IECLASS_CHANGEWINDOW    0x15
   47 #ifndef IECLASS_NEWMOUSE
   48 #define IECLASS_NEWMOUSE        0x16
   49 #endif /* IECLASS_NEWMOUSE */
   50 #define IECLASS_MAX             0x16
   51 
   52 
   53 #define IESUBCLASS_COMPATIBLE   0x00
   54 #define IESUBCLASS_PIXEL        0x01
   55 #define IESUBCLASS_TABLET       0x02
   56 #define IESUBCLASS_NEWTABLET    0x03
   57 #define IESUBCLASS_TOUCHPAD     0x04
   58 
   59 struct IEPointerPixel
   60 {
   61 	struct Screen *iepp_Screen;
   62 	struct
   63 	{
   64 		WORD X;
   65 		WORD Y;
   66 	}              iepp_Position;
   67 };
   68 
   69 struct IEPointerTablet
   70 {
   71 	struct
   72 	{
   73 		UWORD X;
   74 		UWORD Y;
   75 	}            iept_Range;
   76 	struct
   77 	{
   78 		UWORD X;
   79 		UWORD Y;
   80 	}            iept_Value;
   81 
   82 	WORD         iept_Pressure;
   83 };
   84 
   85 
   86 struct IENewTablet
   87 {
   88 	struct Hook *ient_CallBack;
   89 
   90 	UWORD ient_ScaledX, ient_ScaledY;
   91 	UWORD ient_ScaledXFraction, ient_ScaledYFraction;
   92 
   93 	ULONG ient_TabletX, ient_TabletY;
   94 
   95 	ULONG ient_RangeX, ient_RangeY;
   96 
   97 	struct TagItem *ient_TagList;
   98 };
   99 
  100 
  101 #define IECODE_UP_PREFIX        0x80
  102 #define IECODE_KEY_CODE_FIRST   0x00
  103 #define IECODE_KEY_CODE_LAST    0x77
  104 #define IECODE_COMM_CODE_FIRST  0x78
  105 #define IECODE_COMM_CODE_LAST   0x7F
  106 
  107 #define IECODE_C0_FIRST         0x00
  108 #define IECODE_C0_LAST          0x1F
  109 #define IECODE_ASCII_FIRST      0x20
  110 #define IECODE_ASCII_LAST       0x7E
  111 #define IECODE_ASCII_DEL        0x7F
  112 #define IECODE_C1_FIRST         0x80
  113 #define IECODE_C1_LAST          0x9F
  114 #define IECODE_LATIN1_FIRST     0xA0
  115 #define IECODE_LATIN1_LAST      0xFF
  116 
  117 #define IECODE_LBUTTON          0x68
  118 #define IECODE_RBUTTON          0x69
  119 #define IECODE_MBUTTON          0x6A
  120 #define IECODE_NOBUTTON         0xFF
  121 
  122 #define IECODE_NEWACTIVE        0x01
  123 #define IECODE_NEWSIZE          0x02
  124 #define IECODE_REFRESH          0x03
  125 
  126 #define IECODE_REQSET           0x01
  127 #define IECODE_REQCLEAR         0x00
  128 
  129 
  130 #define IEQUALIFIER_LSHIFT          0x0001
  131 #define IEQUALIFIER_RSHIFT          0x0002
  132 #define IEQUALIFIER_CAPSLOCK        0x0004
  133 #define IEQUALIFIER_CONTROL         0x0008
  134 #define IEQUALIFIER_LALT            0x0010
  135 #define IEQUALIFIER_RALT            0x0020
  136 #define IEQUALIFIER_LCOMMAND        0x0040
  137 #define IEQUALIFIER_RCOMMAND        0x0080
  138 #define IEQUALIFIER_NUMERICPAD      0x0100
  139 #define IEQUALIFIER_REPEAT          0x0200
  140 #define IEQUALIFIER_INTERRUPT       0x0400
  141 #define IEQUALIFIER_MULTIBROADCAST  0x0800
  142 #define IEQUALIFIER_MIDBUTTON       0x1000
  143 #define IEQUALIFIER_RBUTTON         0x2000
  144 #define IEQUALIFIER_LEFTBUTTON      0x4000
  145 #define IEQUALIFIER_RELATIVEMOUSE   0x8000
  146 
  147 #define IEQUALIFIERB_LSHIFT         0
  148 #define IEQUALIFIERB_RSHIFT         1
  149 #define IEQUALIFIERB_CAPSLOCK       2
  150 #define IEQUALIFIERB_CONTROL        3
  151 #define IEQUALIFIERB_LALT           4
  152 #define IEQUALIFIERB_RALT           5
  153 #define IEQUALIFIERB_LCOMMAND       6
  154 #define IEQUALIFIERB_RCOMMAND       7
  155 #define IEQUALIFIERB_NUMERICPAD     8
  156 #define IEQUALIFIERB_REPEAT         9
  157 #define IEQUALIFIERB_INTERRUPT      10
  158 #define IEQUALIFIERB_MULTIBROADCAST 11
  159 #define IEQUALIFIERB_MIDBUTTON      12
  160 #define IEQUALIFIERB_RBUTTON        13
  161 #define IEQUALIFIERB_LEFTBUTTON     14
  162 #define IEQUALIFIERB_RELATIVEMOUSE  15
  163 
  164 /*
  165  * NewMouse events.
  166  */
  167 #ifndef NM_WHEEL_UP
  168 #define NM_WHEEL_UP      0x7a
  169 #endif
  170 #ifndef NM_WHEEL_DOWN
  171 #define NM_WHEEL_DOWN    0x7b
  172 #endif
  173 #ifndef NM_WHEEL_LEFT
  174 #define NM_WHEEL_LEFT    0x7c
  175 #endif
  176 #ifndef NM_WHEEL_RIGHT
  177 #define NM_WHEEL_RIGHT   0x7d
  178 #endif
  179 #ifndef NM_BUTTON_FOURTH
  180 #define NM_BUTTON_FOURTH 0x7e
  181 #endif
  182 
  183 struct InputEvent
  184 {
  185 	struct  InputEvent *ie_NextEvent;
  186 	UBYTE               ie_Class;
  187 	UBYTE               ie_SubClass;
  188 	UWORD               ie_Code;
  189 	UWORD               ie_Qualifier;
  190 
  191 	union
  192 	{
  193 		struct
  194 		{
  195 			WORD  ie_x;
  196 			WORD  ie_y;
  197 		}    ie_xy;
  198 
  199 		APTR ie_addr;
  200 
  201 
  202 		struct
  203 		{
  204 			UBYTE ie_prev1DownCode;
  205 			UBYTE ie_prev1DownQual;
  206 			UBYTE ie_prev2DownCode;
  207 			UBYTE ie_prev2DownQual;
  208 		}    ie_dead;
  209 
  210 
  211 	}                   ie_position;
  212 
  213 	struct TimeVal      ie_TimeStamp;
  214 };
  215 
  216 #define ie_X              ie_position.ie_xy.ie_x
  217 #define ie_Y              ie_position.ie_xy.ie_y
  218 #define ie_EventAddress   ie_position.ie_addr
  219 #define ie_Prev1DownCode  ie_position.ie_dead.ie_prev1DownCode
  220 #define ie_Prev1DownQual  ie_position.ie_dead.ie_prev1DownQual
  221 #define ie_Prev2DownCode  ie_position.ie_dead.ie_prev2DownCode
  222 #define ie_Prev2DownQual  ie_position.ie_dead.ie_prev2DownQual
  223 
  224 #pragma pack()
  225 
  226 #endif /* DEVICES_INPUTEVENT_H */