Annotation of kernel/bsd/dev/event.h, revision 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:        event.h (PostScript side version)
        !            27:        
        !            28:        CONFIDENTIAL
        !            29:        Copyright (c) 1988 NeXT, Inc. as an unpublished work.
        !            30:        All Rights Reserved.
        !            31: 
        !            32:        Created Leo 01Mar88
        !            33: 
        !            34:        Modified:
        !            35:        04May88 Leo  Final event types and record
        !            36:        22Aug88 Leo  Change short -> int for window, add reserved
        !            37:        26May90 Ted  Added NX_UNDIMMASK to correct triggering of UndoAutoDim
        !            38:        12Dec91 Mike Brought into sync with dpsclient/event.h, and fixed
        !            39:                     the #ifndef interlock with dpsclient/event.h that was
        !            40:                     broken during the Great Header Revision.
        !            41: 
        !            42:        The PostScript version of this file differs from the
        !            43:        Window Kit version in that the coordinates here are
        !            44:        ints instead of floats.
        !            45: ******************************************************************************/
        !            46: 
        !            47: #ifndef _DEV_EVENT_
        !            48: #define _DEV_EVENT_
        !            49: 
        !            50: #ifdef EVENT_H         /* Interlock with dpsclient/event.h */
        !            51: #if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
        !            52: #define _NXSIZE_       1       /* NXCoord, NXPoint, NXSize decl seen */
        !            53: #define _NXSize_       NXSize
        !            54: #endif /* _NXSIZE_ */
        !            55: #else  /* EVENT_H */           /* Haven't seen dpsclient/event.h, so define away */
        !            56: #define EVENT_H
        !            57: 
        !            58: #ifdef KERNEL
        !            59: #else  /* KERNEL */
        !            60: 
        !            61: #if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
        !            62: #define _NXSIZE_       1       /* NXCoord, NXPoint, NXSize decl seen */
        !            63: typedef float   NXCoord;
        !            64: 
        !            65: typedef struct _NXPoint {      /* point */
        !            66:     NXCoord         x, y;
        !            67: } NXPoint;
        !            68: 
        !            69: typedef struct _NXSize {       /* size */
        !            70:     NXCoord         width, height;
        !            71: } NXSize;
        !            72: #define _NXSize_       NXSize  /* Correct usage in event_status_driver.h */
        !            73: #endif /* _NXSIZE_ */
        !            74: 
        !            75: #endif /* KERNEL */
        !            76: 
        !            77: /* Event types */
        !            78: 
        !            79: #define NX_NULLEVENT           0       /* internal use */
        !            80: 
        !            81: /* mouse events */
        !            82: 
        !            83: #define NX_LMOUSEDOWN          1       /* left mouse-down event */
        !            84: #define NX_LMOUSEUP            2       /* left mouse-up event */
        !            85: #define NX_RMOUSEDOWN          3       /* right mouse-down event */
        !            86: #define NX_RMOUSEUP            4       /* right mouse-up event */
        !            87: #define NX_MOUSEMOVED          5       /* mouse-moved event */
        !            88: #define NX_LMOUSEDRAGGED       6       /* left mouse-dragged event */
        !            89: #define NX_RMOUSEDRAGGED       7       /* right mouse-dragged event */
        !            90: #define NX_MOUSEENTERED                8       /* mouse-entered event */
        !            91: #define NX_MOUSEEXITED         9       /* mouse-exited event */
        !            92: 
        !            93: /* keyboard events */
        !            94: 
        !            95: #define NX_KEYDOWN             10      /* key-down event */
        !            96: #define NX_KEYUP               11      /* key-up event */
        !            97: #define NX_FLAGSCHANGED                12      /* flags-changed event */
        !            98: 
        !            99: /* composite events */
        !           100: 
        !           101: #define NX_KITDEFINED          13      /* application-kit-defined event */
        !           102: #define NX_SYSDEFINED          14      /* system-defined event */
        !           103: #define NX_APPDEFINED          15      /* application-defined event */
        !           104: /* There are additional DPS client defined events past this point. */
        !           105: 
        !           106: #define NX_FIRSTEVENT          0
        !           107: #define NX_LASTEVENT           15
        !           108: #define NX_NUMPROCS            (NX_LASTEVENT-NX_FIRSTEVENT+1)
        !           109: 
        !           110: /* Event masks */
        !           111: 
        !           112: #define NX_LMOUSEDOWNMASK      (1 << NX_LMOUSEDOWN)    /* left mouse-down */
        !           113: #define NX_LMOUSEUPMASK                (1 << NX_LMOUSEUP)      /* left mouse-up */
        !           114: #define NX_RMOUSEDOWNMASK      (1 << NX_RMOUSEDOWN)    /* right mouse-down */
        !           115: #define NX_RMOUSEUPMASK                (1 << NX_RMOUSEUP)      /* right mouse-up */
        !           116: #define NX_MOUSEMOVEDMASK      (1 << NX_MOUSEMOVED)    /* mouse-moved */
        !           117: #define NX_LMOUSEDRAGGEDMASK   (1 << NX_LMOUSEDRAGGED) /* left-dragged */
        !           118: #define NX_RMOUSEDRAGGEDMASK   (1 << NX_RMOUSEDRAGGED) /* right-dragged */
        !           119: #define NX_MOUSEENTEREDMASK    (1 << NX_MOUSEENTERED)  /* mouse-entered */
        !           120: #define NX_MOUSEEXITEDMASK     (1 << NX_MOUSEEXITED)   /* mouse-exited */
        !           121: #define NX_KEYDOWNMASK         (1 << NX_KEYDOWN)       /* key-down */
        !           122: #define NX_KEYUPMASK           (1 << NX_KEYUP)         /* key-up */
        !           123: #define NX_FLAGSCHANGEDMASK    (1 << NX_FLAGSCHANGED)  /* flags-changed */
        !           124: #define NX_KITDEFINEDMASK      (1 << NX_WINCHANGED)    /* kit-defined */
        !           125: #define NX_SYSDEFINEDMASK      (1 << NX_SYSDEFINED)    /* system-defined */
        !           126: #define NX_APPDEFINEDMASK      (1 << NX_APPDEFINED)    /* app-defined */
        !           127: 
        !           128: #define EventCodeMask(type)    (1 << (type))
        !           129: #define NX_ALLEVENTS           -1      /* Check for all events */
        !           130: 
        !           131: 
        !           132: /* Masks for the bits in event.flags */
        !           133: 
        !           134: /* device-independent */
        !           135: 
        !           136: #define        NX_ALPHASHIFTMASK       0x00010000
        !           137: #define        NX_SHIFTMASK            0x00020000
        !           138: #define        NX_CONTROLMASK          0x00040000
        !           139: #define        NX_ALTERNATEMASK        0x00080000
        !           140: #define        NX_COMMANDMASK          0x00100000
        !           141: #define        NX_NUMERICPADMASK       0x00200000
        !           142: #define        NX_HELPMASK             0x00400000
        !           143: 
        !           144: /* The device dependant flags are defined in <bsd/dev/machine/event.h> */
        !           145: 
        !           146: /* 
        !           147:  * Additional reserved bits in event.flags
        !           148:  */
        !           149: 
        !           150: #define NX_STYLUSPROXIMITYMASK 0x00000080
        !           151: #define NX_NONCOALSESCEDMASK   0x00000100
        !           152: 
        !           153: /* click state values
        !           154:  * If you have the following events in close succession, the click
        !           155:  * field has the indicated value:
        !           156:  *     
        !           157:  *  Event      Click Value     Comments
        !           158:  *  mouse-down 1               Not part of any click yet
        !           159:  *  mouse-up   1               Aha! A click!
        !           160:  *  mouse-down 2               Doing a double-click
        !           161:  *  mouse-up   2               It's finished
        !           162:  *  mouse-down 3               A triple
        !           163:  *  mouse-up   3
        !           164:  */
        !           165: 
        !           166: /* Values for the character set in event.data.key.charSet */
        !           167: 
        !           168: #define        NX_ASCIISET             0
        !           169: #define NX_SYMBOLSET           1
        !           170: #define        NX_DINGBATSSET          2
        !           171: 
        !           172: /* EventData type: defines the data field of an event */
        !           173: 
        !           174: typedef        union {
        !           175:     struct {   /* For mouse-down and mouse-up events */
        !           176:        unsigned char   subx;           /* sub-pixel position for x */
        !           177:        unsigned char   suby;           /* sub-pixel position for y */
        !           178:        short           eventNum;       /* unique identifier for this button */
        !           179:        int             click;          /* click state of this event */
        !           180:        unsigned char   pressure;       /* pressure value: 0=none, 255=full */
        !           181:        char            reserved1;
        !           182:        short           reserved2;
        !           183:     } mouse;
        !           184:     struct {   /* For key-down and key-up events */
        !           185:        unsigned short  origCharSet;    /* unmodified character set code */
        !           186:        short           repeat;  /* for key-down: nonzero if really a repeat */
        !           187:        unsigned short  charSet;        /* character set code */
        !           188:        unsigned short  charCode;       /* character code in that set */
        !           189:        unsigned short  keyCode;        /* device-dependent key number */
        !           190:        unsigned short  origCharCode;   /* unmodified character code */
        !           191:     } key;
        !           192:     struct {   /* For mouse-entered and mouse-exited events */
        !           193:        short   reserved;
        !           194:        short   eventNum;       /* unique identifier from mouse down event */
        !           195:        int     trackingNum;    /* unique identifier from settrackingrect */
        !           196:        int     userData;   /* uninterpreted integer from settrackingrect */
        !           197:     } tracking;
        !           198:     struct {   /* For window-changed, sys-defined, and app-defined events */
        !           199:        short   reserved;
        !           200:        short   subType;        /* event subtype for compound events */
        !           201:        union {
        !           202:            float       F[2];   /* for use in compound events */
        !           203:            long        L[2];   /* for use in compound events */
        !           204:            short       S[4];   /* for use in compound events */
        !           205:            char        C[8];   /* for use in compound events */
        !           206:        } misc;
        !           207:     } compound;
        !           208: } NXEventData;
        !           209: 
        !           210: /* Finally! The event record! */
        !           211: typedef struct _NXEvent {
        !           212:     int                        type;           /* An event type from above */
        !           213:     struct {
        !           214:        int             x, y;           /* Base coordinates in window, */
        !           215:     }                  location;       /* from bottom left */
        !           216:     long               time;           /* vertical intervals since launch */
        !           217:     int                        flags;          /* key state flags */
        !           218:     unsigned int       window;         /* window number of assigned window */
        !           219:     NXEventData                data;           /* type-dependent data */
        !           220: } NXEvent, *NXEventPtr;
        !           221: 
        !           222: /* How to pick window(s) for event (for PostEvent) */
        !           223: #define NX_NOWINDOW            -1
        !           224: #define NX_BYTYPE              0
        !           225: #define NX_BROADCAST           1
        !           226: #define NX_TOPWINDOW           2
        !           227: #define NX_FIRSTWINDOW         3
        !           228: #define NX_MOUSEWINDOW         4
        !           229: #define NX_NEXTWINDOW          5
        !           230: #define NX_LASTLEFT            6
        !           231: #define NX_LASTRIGHT           7
        !           232: #define NX_LASTKEY             8
        !           233: #define NX_EXPLICIT            9
        !           234: #define NX_TRANSMIT            10
        !           235: #define NX_BYPSCONTEXT         11
        !           236: 
        !           237: #endif /* EVENT_H */   /* End of defs common with dpsclient/event.h */
        !           238: 
        !           239: /* Mask of events that cause screen to undim */
        !           240: 
        !           241: #define NX_UNDIMMASK           (NX_KEYDOWNMASK | NX_KEYUPMASK | \
        !           242:                                 NX_LMOUSEDOWNMASK | NX_LMOUSEUPMASK | \
        !           243:                                 NX_RMOUSEDOWNMASK | NX_RMOUSEUPMASK | \
        !           244:                                 NX_MOUSEMOVEDMASK | NX_FLAGSCHANGEDMASK | \
        !           245:                                 NX_MOUSEENTEREDMASK | NX_MOUSEEXITEDMASK | \
        !           246:                                 NX_LMOUSEDRAGGEDMASK | NX_RMOUSEDRAGGEDMASK)
        !           247: 
        !           248: #endif /* _DEV_EVENT_ */
        !           249: 

unix.superglobalmegacorp.com

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