Annotation of XNU/iokit/IOKit/hidsystem/IOHIKeyboard.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
        !            23:  *
        !            24:  * EventSrcPCKeyboard.h - PC Keyboard EventSrc subclass definition
        !            25:  *
        !            26:  * HISTORY
        !            27:  * 28 Aug 1992    Joe Pasqua
        !            28:  *      Created. 
        !            29:  */
        !            30: 
        !            31: #ifndef _IOHIKEYBOARD_H
        !            32: #define _IOHIKEYBOARD_H
        !            33: 
        !            34: #include <IOKit/hidsystem/IOHIDevice.h>
        !            35: #include <IOKit/hidsystem/IOHIKeyboardMapper.h>
        !            36: 
        !            37: /* Start Action Definitions */
        !            38: 
        !            39: /*
        !            40:  * HISTORICAL NOTE:
        !            41:  *   The following entry points were part of the IOHIKeyboardEvents
        !            42:  *   protocol.
        !            43:  */
        !            44: 
        !            45: typedef void (*KeyboardEventAction)(       OSObject * target,
        !            46:                     /* eventFlags  */      unsigned   eventType,
        !            47:                     /* flags */            unsigned   flags,
        !            48:                     /* keyCode */          unsigned   key,
        !            49:                     /* charCode */         unsigned   charCode,
        !            50:                     /* charSet */          unsigned   charSet,
        !            51:                     /* originalCharCode */ unsigned   origCharCode,
        !            52:                     /* originalCharSet */  unsigned   origCharSet,
        !            53:                     /* repeat */           bool       repeat,
        !            54:                     /* atTime */           AbsoluteTime ts);
        !            55: 
        !            56: typedef void (*KeyboardSpecialEventAction)(OSObject * target,
        !            57:                     /* eventType */        unsigned   eventType,
        !            58:                     /* flags */            unsigned   flags,
        !            59:                     /* keyCode */          unsigned   key,
        !            60:                     /* specialty */        unsigned   flavor,
        !            61:                     /* atTime */           AbsoluteTime ts);
        !            62: 
        !            63: typedef void (*UpdateEventFlagsAction)(    OSObject * target,
        !            64:                      /* flags */           unsigned   flags);
        !            65: 
        !            66: /* End Action Definitions */
        !            67: 
        !            68: 
        !            69: 
        !            70: /* Default key repeat parameters */
        !            71: #define EV_DEFAULTINITIALREPEAT 500000000ULL    // 1/2 sec in nanoseconds
        !            72: #define EV_DEFAULTKEYREPEAT     83333333ULL     // 1/12 sec in nanoseconds
        !            73: #define EV_MINKEYREPEAT         16700000ULL     // 1/60 sec
        !            74: 
        !            75: class IOHIKeyboard : public IOHIDevice
        !            76: {
        !            77:   OSDeclareDefaultStructors(IOHIKeyboard);
        !            78: 
        !            79: protected:
        !            80:     IOLock *            _deviceLock;   // Lock for all device access
        !            81:     IOHIKeyboardMapper * _keyMap;      // KeyMap instance
        !            82: 
        !            83:     // The following fields decribe the state of the keyboard
        !            84:     UInt32 *   _keyState;              // kbdBitVector
        !            85:     IOByteCount _keyStateSize;         // kbdBitVector allocated size
        !            86:     unsigned   _eventFlags;            // Current eventFlags
        !            87:     bool       _alphaLock;             // true means alpha lock is on
        !            88:     bool       _charKeyActive;         // true means char gen. key active
        !            89: 
        !            90:     // The following fields are used in performing key repeats
        !            91:     bool       _isRepeat;              // true means we're generating repeat
        !            92:     unsigned   _codeToRepeat;          // What we are repeating
        !            93:     bool       _calloutPending;        // true means we've sched. a callout
        !            94:     AbsoluteTime       _lastEventTime;         // Time last event was dispatched
        !            95:     AbsoluteTime       _downRepeatTime;        // Time when we should next repeat
        !            96:     AbsoluteTime       _keyRepeat;             // Delay between key repeats
        !            97:     AbsoluteTime       _initialKeyRepeat;      // Delay before initial key repeat
        !            98: 
        !            99:     OSObject *                 _keyboardEventTarget;
        !           100:     KeyboardEventAction        _keyboardEventAction;
        !           101:     OSObject *                 _keyboardSpecialEventTarget;
        !           102:     KeyboardSpecialEventAction _keyboardSpecialEventAction;
        !           103:     OSObject *                 _updateEventFlagsTarget;
        !           104:     UpdateEventFlagsAction     _updateEventFlagsAction;
        !           105: 
        !           106: protected:
        !           107:   virtual void dispatchKeyboardEvent(unsigned int keyCode,
        !           108:                     /* direction */ bool         goingDown,
        !           109:                     /* timeStamp */ AbsoluteTime time);
        !           110: 
        !           111: public:
        !           112:   virtual bool init(OSDictionary * properties = 0);
        !           113:   virtual bool start(IOService * provider);
        !           114:   virtual void free();
        !           115: 
        !           116:   virtual bool open(IOService *                client,
        !           117:                    IOOptionBits               options,
        !           118:                     KeyboardEventAction        keAction,
        !           119:                     KeyboardSpecialEventAction kseAction,
        !           120:                     UpdateEventFlagsAction     uefAction);
        !           121:   virtual void close(IOService * client, IOOptionBits );
        !           122: 
        !           123:   virtual IOHIDKind hidKind();
        !           124:   virtual bool             updateProperties( void );
        !           125:   virtual IOReturn  setParamProperties(OSDictionary * dict);
        !           126: 
        !           127: protected: // for subclasses to implement
        !           128:   virtual const unsigned char * defaultKeymapOfLength(UInt32 * length);
        !           129:   virtual void setAlphaLockFeedback(bool val);
        !           130:   virtual UInt32 maxKeyCodes();
        !           131: 
        !           132: private:
        !           133:   virtual bool resetKeyboard();
        !           134:   virtual void scheduleAutoRepeat();
        !           135:   static void _autoRepeat(void * arg, void *);
        !           136:   virtual void autoRepeat();
        !           137:   virtual void setRepeat(unsigned eventType, unsigned keyCode);
        !           138: 
        !           139: /*
        !           140:  * HISTORICAL NOTE:
        !           141:  *   The following methods were part of the KeyMapDelegate protocol;
        !           142:  *   the declarations have now been merged directly into this class.
        !           143:  */
        !           144: 
        !           145: public:
        !           146:   virtual void keyboardEvent(unsigned eventType,
        !           147:       /* flags */            unsigned flags,
        !           148:       /* keyCode */          unsigned keyCode,
        !           149:       /* charCode */         unsigned charCode,
        !           150:       /* charSet */          unsigned charSet,
        !           151:       /* originalCharCode */ unsigned origCharCode,
        !           152:       /* originalCharSet */  unsigned origCharSet);
        !           153: 
        !           154:   virtual void keyboardSpecialEvent(unsigned eventType,
        !           155:                    /* flags */     unsigned flags,
        !           156:                    /* keyCode */   unsigned keyCode,
        !           157:                    /* specialty */ unsigned flavor);
        !           158: 
        !           159:   virtual void updateEventFlags(unsigned flags); // Does not generate events
        !           160: 
        !           161:   virtual unsigned eventFlags();           // Global event flags
        !           162:   virtual unsigned deviceFlags();          // per-device event flags
        !           163:   virtual void setDeviceFlags(unsigned flags); // Set device event flags
        !           164:   virtual bool alphaLock();                // current alpha-lock state
        !           165:   virtual void setAlphaLock(bool val);     // Set current alpha-lock state
        !           166:   virtual bool charKeyActive();            // Is a character gen. key down?
        !           167:   virtual void setCharKeyActive(bool val); // Note that a char gen key is down.
        !           168: };
        !           169: 
        !           170: #endif /* !_IOHIKEYBOARD_H */

unix.superglobalmegacorp.com

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