Annotation of kernel/bsd/dev/ppc/drvUSBCMD/kbd/Events.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:        File:           Events.h
                     27:  
                     28:        Contains:       Event Manager Interfaces.
                     29:  
                     30:        Version:        Mac OS 8
                     31:  
                     32:        DRI:            Rich Wilkes
                     33:  
                     34:        Copyright:      � 1985-1998 by Apple Computer, Inc., all rights reserved
                     35:  
                     36:        Warning:        *** APPLE INTERNAL USE ONLY ***
                     37:                                This file may contain unreleased API's
                     38:  
                     39:        BuildInfo:      Built by:                       Naga Pappireddi
                     40:                                With Interfacer:        3.0d9 (PowerPC native)
                     41:                                From:                           Events.i
                     42:                                        Revision:               69
                     43:                                        Dated:                  9/23/98
                     44:                                        Last change by: NG
                     45:                                        Last comment:   More Syncing with Carbon; add GetGlobalMouse
                     46:  
                     47:        Bugs:           Report bugs to Radar component "System Interfaces", "Latest"
                     48:                                List the version information (from above) in the Problem Description.
                     49:  
                     50: */
                     51: #include "../OSUtils.h"
                     52: #ifndef __EVENTS__
                     53: #define __EVENTS__
                     54: 
                     55: /*naga
                     56: #ifndef __OSUTILS__
                     57: #include "../OSUtils.h"
                     58: #endif
                     59: #ifndef __QUICKDRAW__
                     60: #include <Quickdraw.h>
                     61: #endif
                     62: #ifndef __MACTYPES__
                     63: #include <MacTypes.h>
                     64: #endif
                     65: 
                     66: #if !TARGET_OS_MAC
                     67: #ifndef __ENDIAN__
                     68: #include <Endian.h>
                     69: #endif
                     70: #endif*/ /* !TARGET_OS_MAC */
                     71: 
                     72: 
                     73: 
                     74: #if PRAGMA_ONCE
                     75: #pragma once
                     76: #endif
                     77: 
                     78: #ifdef __cplusplus
                     79: extern "C" {
                     80: #endif
                     81: 
                     82: #if PRAGMA_IMPORT
                     83: #pragma import on
                     84: #endif
                     85: 
                     86: #if PRAGMA_STRUCT_ALIGN
                     87:        #pragma options align=mac68k
                     88: #elif PRAGMA_STRUCT_PACKPUSH
                     89:        #pragma pack(push, 2)
                     90: #elif PRAGMA_STRUCT_PACK
                     91:        #pragma pack(2)
                     92: #endif
                     93: 
                     94: typedef UInt16                                                         EventKind;
                     95: typedef UInt16                                                         EventMask;
                     96: 
                     97: enum {
                     98:        nullEvent                                       = 0,
                     99:        mouseDown                                       = 1,
                    100:        mouseUp                                         = 2,
                    101:        keyDown                                         = 3,
                    102:        keyUp                                           = 4,
                    103:        autoKey                                         = 5,
                    104:        updateEvt                                       = 6,
                    105:        diskEvt                                         = 7,
                    106:        activateEvt                                     = 8,
                    107:        osEvt                                           = 15,
                    108:        kHighLevelEvent                         = 23
                    109: };
                    110: 
                    111: 
                    112: enum {
                    113:        mDownMask                                       = 1 << mouseDown,                               /* mouse button pressed*/
                    114:        mUpMask                                         = 1 << mouseUp,                                 /* mouse button released*/
                    115:        keyDownMask                                     = 1 << keyDown,                                 /* key pressed*/
                    116:        keyUpMask                                       = 1 << keyUp,                                   /* key released*/
                    117:        autoKeyMask                                     = 1 << autoKey,                                 /* key repeatedly held down*/
                    118:        updateMask                                      = 1 << updateEvt,                               /* window needs updating*/
                    119:        diskMask                                        = 1 << diskEvt,                                 /* disk inserted*/
                    120:        activMask                                       = 1 << activateEvt,                             /* activate/deactivate window*/
                    121:        highLevelEventMask                      = 0x0400,                                               /* high-level events (includes AppleEvents)*/
                    122:        osMask                                          = 1 << osEvt,                                   /* operating system events (suspend, resume)*/
                    123:        everyEvent                                      = 0xFFFF                                                /* all of the above*/
                    124: };
                    125: 
                    126: 
                    127: enum {
                    128:        charCodeMask                            = 0x000000FF,
                    129:        keyCodeMask                                     = 0x0000FF00,
                    130:        adbAddrMask                                     = 0x00FF0000,
                    131:        osEvtMessageMask                        = (long)0xFF000000
                    132: };
                    133: 
                    134: 
                    135: enum {
                    136:                                                                                                                                /* OS event messages.  Event (sub)code is in the high byte of the message field.*/
                    137:        mouseMovedMessage                       = 0x00FA,
                    138:        suspendResumeMessage            = 0x0001
                    139: };
                    140: 
                    141: 
                    142: enum {
                    143:        resumeFlag                                      = 1,                                                    /* Bit 0 of message indicates resume vs suspend*/
                    144:        convertClipboardFlag            = 2                                                             /* Bit 1 in resume message indicates clipboard change*/
                    145: };
                    146: 
                    147: 
                    148: typedef UInt16                                                         EventModifiers;
                    149: 
                    150: enum {
                    151:                                                                                                                                /* modifiers */
                    152:        activeFlagBit                           = 0,                                                    /* activate? (activateEvt and mouseDown)*/
                    153:        btnStateBit                                     = 7,                                                    /* state of button?*/
                    154:        cmdKeyBit                                       = 8,                                                    /* command key down?*/
                    155:        shiftKeyBit                                     = 9,                                                    /* shift key down?*/
                    156:        alphaLockBit                            = 10,                                                   /* alpha lock down?*/
                    157:        optionKeyBit                            = 11,                                                   /* option key down?*/
                    158:        controlKeyBit                           = 12,                                                   /* control key down?*/
                    159:        rightShiftKeyBit                        = 13,                                                   /* right shift key down?*/
                    160:        rightOptionKeyBit                       = 14,                                                   /* right Option key down?*/
                    161:        rightControlKeyBit                      = 15                                                    /* right Control key down?*/
                    162: };
                    163: 
                    164: 
                    165: enum {
                    166:        activeFlag                                      = 1 << activeFlagBit,
                    167:        btnState                                        = 1 << btnStateBit,
                    168:        cmdKey                                          = 1 << cmdKeyBit,
                    169:        shiftKey                                        = 1 << shiftKeyBit,
                    170:        alphaLock                                       = 1 << alphaLockBit,
                    171:        optionKey                                       = 1 << optionKeyBit,
                    172:        controlKey                                      = 1 << controlKeyBit,
                    173:        rightShiftKey                           = 1 << rightShiftKeyBit,
                    174:        rightOptionKey                          = 1 << rightOptionKeyBit,
                    175:        rightControlKey                         = 1 << rightControlKeyBit
                    176: };
                    177: 
                    178: 
                    179: enum {
                    180:        kNullCharCode                           = 0,
                    181:        kHomeCharCode                           = 1,
                    182:        kEnterCharCode                          = 3,
                    183:        kEndCharCode                            = 4,
                    184:        kHelpCharCode                           = 5,
                    185:        kBellCharCode                           = 7,
                    186:        kBackspaceCharCode                      = 8,
                    187:        kTabCharCode                            = 9,
                    188:        kLineFeedCharCode                       = 10,
                    189:        kVerticalTabCharCode            = 11,
                    190:        kPageUpCharCode                         = 11,
                    191:        kFormFeedCharCode                       = 12,
                    192:        kPageDownCharCode                       = 12,
                    193:        kReturnCharCode                         = 13,
                    194:        kFunctionKeyCharCode            = 16,
                    195:        kEscapeCharCode                         = 27,
                    196:        kClearCharCode                          = 27,
                    197:        kLeftArrowCharCode                      = 28,
                    198:        kRightArrowCharCode                     = 29,
                    199:        kUpArrowCharCode                        = 30,
                    200:        kDownArrowCharCode                      = 31,
                    201:        kDeleteCharCode                         = 127,
                    202:        kNonBreakingSpaceCharCode       = 202
                    203: };
                    204: 
                    205: 
                    206: struct EventRecord {
                    207:        EventKind                                               what;
                    208:        UInt32                                                  message;
                    209:        UInt32                                                  when;
                    210:        Point                                                   where;
                    211:        EventModifiers                                  modifiers;
                    212: };
                    213: typedef struct EventRecord                             EventRecord;
                    214: #if 0     //naga
                    215: typedef CALLBACK_API( void , FKEYProcPtr )(void );
                    216: typedef STACK_UPP_TYPE(FKEYProcPtr)                                                    FKEYUPP;
                    217: enum { uppFKEYProcInfo = 0x00000000 };                                                         /* pascal no_return_value Func() */
                    218: #if MIXEDMODE_CALLS_ARE_FUNCTIONS
                    219: EXTERN_API(FKEYUPP)
                    220: NewFKEYProc                                       (FKEYProcPtr                         userRoutine);
                    221: EXTERN_API(void)
                    222: CallFKEYProc                              (FKEYUPP                                     userRoutine);
                    223: #else
                    224: #define NewFKEYProc(userRoutine)                                                               (FKEYUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFKEYProcInfo, GetCurrentArchitecture())
                    225: #define CallFKEYProc(userRoutine)                                                              CALL_ZERO_PARAMETER_UPP((userRoutine), uppFKEYProcInfo)
                    226: #endif
                    227: EXTERN_API( void )
                    228: GetMouse                                               (Point *                                mouseLoc)                                                       ONEWORDINLINE(0xA972);
                    229: 
                    230: EXTERN_API( Boolean )
                    231: Button                                                 (void)                                                                                                          ONEWORDINLINE(0xA974);
                    232: 
                    233: EXTERN_API( Boolean )
                    234: StillDown                                              (void)                                                                                                          ONEWORDINLINE(0xA973);
                    235: 
                    236: EXTERN_API( Boolean )
                    237: WaitMouseUp                                            (void)                                                                                                          ONEWORDINLINE(0xA977);
                    238: 
                    239: EXTERN_API( UInt32 )
                    240: TickCount                                              (void)                                                                                                          ONEWORDINLINE(0xA975);
                    241: 
                    242: EXTERN_API( UInt32 )
                    243: KeyTranslate                                   (const void *                   transData,
                    244:                                                                 UInt16                                 keycode,
                    245:                                                                 UInt32 *                               state)                                                          ONEWORDINLINE(0xA9C3);
                    246: 
                    247: EXTERN_API( UInt32 )
                    248: GetCaretTime                                   (void)                                                                                                          TWOWORDINLINE(0x2EB8, 0x02F4);
                    249: 
                    250: 
                    251: /* 
                    252:        QuickTime 3.0 supports GetKeys() on unix and win32
                    253:        But, on little endian machines you will have to be
                    254:        careful about bit numberings and/or use a KeyMapByteArray
                    255:        instead.
                    256: */
                    257: #endif 0  //naga
                    258: //naga#if TARGET_OS_MAC
                    259: 
                    260: typedef UInt32                                                         KeyMap[4];
                    261: /*naga
                    262: #else
                    263: typedef BigEndianLong                                  KeyMap[4];
                    264: #endif*/ /* TARGET_OS_MAC */
                    265: 
                    266: typedef UInt8                                                  KeyMapByteArray[16];
                    267: EXTERN_API( void )
                    268: GetKeys                                                        (KeyMap                                 theKeys)                                                        ONEWORDINLINE(0xA976);
                    269: 
                    270: 
                    271: /* Obsolete event types & masks */
                    272: 
                    273: enum {
                    274:        networkEvt                                      = 10,
                    275:        driverEvt                                       = 11,
                    276:        app1Evt                                         = 12,
                    277:        app2Evt                                         = 13,
                    278:        app3Evt                                         = 14,
                    279:        app4Evt                                         = 15,
                    280:        networkMask                                     = 0x0400,
                    281:        driverMask                                      = 0x0800,
                    282:        app1Mask                                        = 0x1000,
                    283:        app2Mask                                        = 0x2000,
                    284:        app3Mask                                        = 0x4000,
                    285:        app4Mask                                        = 0x8000
                    286: };
                    287: 
                    288: 
                    289: struct EvQEl {
                    290:        QElemPtr                                                qLink;
                    291:        SInt16                                                  qType;
                    292:        EventKind                                               evtQWhat;                                       /* this part is identical to the EventRecord as defined above */
                    293:        UInt32                                                  evtQMessage;
                    294:        UInt32                                                  evtQWhen;
                    295:        Point                                                   evtQWhere;
                    296:        EventModifiers                                  evtQModifiers;
                    297: };
                    298: typedef struct EvQEl                                   EvQEl;
                    299: typedef EvQEl *                                                        EvQElPtr;
                    300: typedef CALLBACK_API( void , GetNextEventFilterProcPtr )(EventRecord *theEvent, Boolean *result);
                    301: /*
                    302:        WARNING: GetNextEventFilterProcPtr uses register based parameters under classic 68k
                    303:                         and cannot be written in a high-level language without 
                    304:                         the help of mixed mode or assembly glue.
                    305: */
                    306: //naga
                    307: #if 0
                    308: typedef REGISTER_UPP_TYPE(GetNextEventFilterProcPtr)                   GetNextEventFilterUPP;
                    309: enum { uppGetNextEventFilterProcInfo = 0x000000BF };                   /* SPECIAL_CASE_PROCINFO(11) */
                    310: #if MIXEDMODE_CALLS_ARE_FUNCTIONS
                    311: EXTERN_API(GetNextEventFilterUPP)
                    312: NewGetNextEventFilterProc         (GetNextEventFilterProcPtr userRoutine);
                    313: EXTERN_API(void)
                    314: CallGetNextEventFilterProc        (GetNextEventFilterUPP       userRoutine,
                    315:                                                                EventRecord *                   theEvent,
                    316:                                                                Boolean *                               result);
                    317: #else
                    318: #define NewGetNextEventFilterProc(userRoutine)                                         (GetNextEventFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetNextEventFilterProcInfo, GetCurrentArchitecture())
                    319: #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
                    320:        /* CallGetNextEventFilterProc can't be called from classic 68k without glue code */
                    321: #else
                    322:        #define CallGetNextEventFilterProc(userRoutine, theEvent, result)  CALL_TWO_PARAMETER_UPP((userRoutine), uppGetNextEventFilterProcInfo, (theEvent), (result))
                    323: #endif
                    324: #endif
                    325: typedef GetNextEventFilterUPP                  GNEFilterUPP;
                    326: EXTERN_API( QHdrPtr )
                    327: GetEvQHdr                                              (void)                                                                                                          THREEWORDINLINE(0x2EBC, 0x0000, 0x014A);
                    328: 
                    329: EXTERN_API( UInt32 )
                    330: GetDblTime                                             (void)                                                                                                          TWOWORDINLINE(0x2EB8, 0x02F0);
                    331: 
                    332: EXTERN_API( void )
                    333: SetEventMask                                   (EventMask                              value)                                                          TWOWORDINLINE(0x31DF, 0x0144);
                    334: 
                    335:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
                    336:                                                                                                                                                                                        #pragma parameter __D0 PPostEvent(__A0, __D0, __A1)
                    337:                                                                                                                                                                                        #endif
                    338: EXTERN_API( OSErr )
                    339: PPostEvent                                             (EventKind                              eventCode,
                    340:                                                                 UInt32                                 eventMsg,
                    341:                                                                 EvQElPtr *                             qEl)                                                            TWOWORDINLINE(0xA12F, 0x2288);
                    342: 
                    343: #define KeyTrans(transData, keycode, state) KeyTranslate(transData, keycode, state)
                    344: EXTERN_API( Boolean )
                    345: GetNextEvent                                   (EventMask                              eventMask,
                    346:                                                                 EventRecord *                  theEvent)                                                       ONEWORDINLINE(0xA970);
                    347: 
                    348: EXTERN_API( Boolean )
                    349: WaitNextEvent                                  (EventMask                              eventMask,
                    350:                                                                 EventRecord *                  theEvent,
                    351:                                                                 UInt32                                 sleep,
                    352:                                                                 RgnHandle                              mouseRgn) /* can be NULL */                     ONEWORDINLINE(0xA860);
                    353: 
                    354: EXTERN_API( Boolean )
                    355: EventAvail                                             (EventMask                              eventMask,
                    356:                                                                 EventRecord *                  theEvent)                                                       ONEWORDINLINE(0xA971);
                    357: 
                    358: 
                    359:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
                    360:                                                                                                                                                                                        #pragma parameter __D0 PostEvent(__A0, __D0)
                    361:                                                                                                                                                                                        #endif
                    362: EXTERN_API( OSErr )
                    363: PostEvent                                              (EventKind                              eventNum,
                    364:                                                                 UInt32                                 eventMsg)                                                       ONEWORDINLINE(0xA02F);
                    365: 
                    366:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
                    367:                                                                                                                                                                                        #pragma parameter __D0 OSEventAvail(__D0, __A0)
                    368:                                                                                                                                                                                        #endif
                    369: EXTERN_API( Boolean )
                    370: OSEventAvail                                   (EventMask                              mask,
                    371:                                                                 EventRecord *                  theEvent)                                                       TWOWORDINLINE(0xA030, 0x5240);
                    372: 
                    373:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
                    374:                                                                                                                                                                                        #pragma parameter __D0 GetOSEvent(__D0, __A0)
                    375:                                                                                                                                                                                        #endif
                    376: EXTERN_API( Boolean )
                    377: GetOSEvent                                             (EventMask                              mask,
                    378:                                                                 EventRecord *                  theEvent)                                                       TWOWORDINLINE(0xA031, 0x5240);
                    379: 
                    380: EXTERN_API( void )
                    381: FlushEvents                                            (EventMask                              whichMask,
                    382:                                                                 EventMask                              stopMask)                                                       TWOWORDINLINE(0x201F, 0xA032);
                    383: 
                    384: EXTERN_API( void )
                    385: SystemClick                                            (const EventRecord *    theEvent,
                    386:                                                                 WindowPtr                              theWindow)                                                      ONEWORDINLINE(0xA9B3);
                    387: 
                    388: EXTERN_API( void )
                    389: SystemTask                                             (void)                                                                                                          ONEWORDINLINE(0xA9B4);
                    390: 
                    391: EXTERN_API( Boolean )
                    392: SystemEvent                                            (const EventRecord *    theEvent)                                                       ONEWORDINLINE(0xA9B2);
                    393: 
                    394: /* This call is only available as part of the Carbon API*/
                    395: EXTERN_API( void )
                    396: GetGlobalMouse                                 (Point *                                globalMouse);
                    397: 
                    398: 
                    399: 
                    400: #if PRAGMA_STRUCT_ALIGN
                    401:        #pragma options align=reset
                    402: #elif PRAGMA_STRUCT_PACKPUSH
                    403:        #pragma pack(pop)
                    404: #elif PRAGMA_STRUCT_PACK
                    405:        #pragma pack()
                    406: #endif
                    407: 
                    408: #ifdef PRAGMA_IMPORT_OFF
                    409: #pragma import off
                    410: #elif PRAGMA_IMPORT
                    411: #pragma import reset
                    412: #endif
                    413: 
                    414: #ifdef __cplusplus
                    415: }
                    416: #endif
                    417: #endif 0   //naga
                    418: #endif /* __EVENTS__ */
                    419: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.