home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / EventDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  5.5 KB  |  160 lines

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * EventDriver.h - Exported Interface Event Driver object.
  4.  *
  5.  *        The EventDriver is a pseudo-device driver.
  6.  *
  7.  * HISTORY
  8.  * 19 Mar 1992    Mike Paquette at NeXT
  9.  *      Created. 
  10.  */
  11.  
  12. #ifndef    _EVENT_DRIVER_
  13. #define _EVENT_DRIVER_
  14.  
  15. #import <driverkit/IODevice.h>
  16. #import <kernserv/queue.h>
  17. #import <bsd/dev/EventProtocols.h>
  18. #import <bsd/dev/ev_types.h>
  19. #import <bsd/dev/ev_keymap.h>        /* For NX_NUM_SCANNED_SPECIALKEYS */
  20.  
  21. @interface EventDriver: IODevice <screenRegister, EventClient>
  22. {
  23. @private
  24.  
  25.     BOOL        hasRegistered;    // Has device been registered yet?
  26.     port_t        devicePort;
  27.     id        driverLock;
  28.  
  29.     // Ports on which we hold send rights
  30.     port_t    eventPort;        // Send msg here when event queue
  31.                     // goes non-empty
  32.     port_t    specialKeyPort[NX_NUM_SCANNED_SPECIALKEYS]; // Special key msgs
  33.  
  34.     // Ports owned by the event driver
  35.     port_t        ev_port;    // Privileged request port
  36.     port_t        evs_port;    // event status port
  37.     port_t        notify_port;    // client port death notification
  38.  
  39.     // kern_port_t versions of previous ports. Typed as port_t's to allow
  40.     // MACH_USER_API compilation.
  41.     port_t        notify_kern_port;    // from notify_port
  42.     port_t        event_kern_port;    // from eventPort
  43.  
  44.     port_set_name_t    ev_port_set;    // Set holding above ports
  45.  
  46.     void        *eventMsg;    // Msg to be sent to Window Server.
  47.  
  48.     // Shared memory area information
  49.     port_t        owner_task;    // task port object for owner
  50.     void         *owner;        // Task which shares mem with driver
  51.     vm_offset_t    owner_addr;    // Address as mapped into owner task
  52.     vm_offset_t    shmem_addr;    // kernel address of shared memory
  53.     vm_size_t    shmem_size;    // size of shared memory
  54.  
  55.     // Pointers to structures which occupy the shared memory area.
  56.     void        *evs;        // Pointer to private driver shmem
  57.     void        *evg;        // Pointer to EvGlobals (shmem)
  58.     // Internal variables related to the shared memory area
  59.     int        lleqSize;    // # of entries in low-level queue
  60.     
  61.     // Event sources list
  62.     id        eventSrcListLock;
  63.     queue_head_t    eventSrcList;
  64.  
  65.     // Screens list
  66.     vm_size_t    evScreenSize;    // Byte size of evScreen array
  67.     void        *evScreen;    // array of screens known to driver
  68.     void        *lastShmemPtr;    // Pointer used to index thru shmem
  69.                     // while assigning shared areas to
  70.                     // drivers.
  71.     int        screens;    // running total of allocated screens
  72.     int        currentScreen;    // Current active screen
  73.     Bounds        cursorPin;    // Range to which cursor is pinned
  74.                     // while on this screen.
  75.     Bounds        workSpace;    // Bounds of full workspace.
  76.     // Event Status state - This includes things like event timestamps,
  77.     // time til screen dim, and related things manipulated through the
  78.     // Event Status API.
  79.     //
  80.     // Note: In this implementation, a tick is defined as 1/64th of
  81.     // one second.  Vertical blanking interrupts are not used.
  82.     //
  83.     unsigned autoDimPeriod;    // How long since last user action before
  84.                 // we autodim screen?  User preference item,
  85.                 // set by InitMouse and evsioctl
  86.     unsigned autoDimTime;    // Time value when we will autodim screen,
  87.                 // if autoDimmed is 0.
  88.                 // Set in LLEventPost.
  89.     Point    pointerLoc;    // Current pointing device location
  90.                 // The value leads evg->cursorLoc.
  91.     Point    clickLoc;    // location of last mouse click
  92.     Point clickSpaceThresh;    // max mouse delta to be a doubleclick
  93.     int    clickState;    // Current click state
  94.     unsigned clickTime;    // Timestamps used to determine doubleclicks
  95.     unsigned clickTimeThresh;
  96.     unsigned char lastPressure;    // last pressure seen
  97.     BOOL    lastProximity;    // last proximity state seen
  98.  
  99.     int    curVolume;    // Value of volume setting.
  100.     int    dimmedBrightness;// Value of screen brightness when autoDim
  101.                 // has turned on.
  102.     int    curBright;    // The current brightness is cached here while
  103.                 // the driver is open.  This number is always
  104.                 // the user-specified brightness level; if the
  105.                 // screen is autodimmed, the actual brightness
  106.                 // level in the monitor will be less.
  107.     BOOL evOpenCalled;    // Has the driver been opened?
  108.     BOOL evInitialized;    // Has the first-open-only initialization run?
  109.     BOOL eventsOpen;    // Boolean: has evmmap been called yet?
  110.     BOOL autoDimmed;    // Is screen currently autodimmed?
  111.     ns_time_t waitSustain;    // Sustain time before removing cursor
  112.     ns_time_t waitSusTime;    // Sustain counter
  113.     ns_time_t waitFrameRate;// Ticks per wait cursor frame
  114.     ns_time_t waitFrameTime;// Wait cursor frame timer
  115.  
  116.     short leftENum;        // Unique id for last left down event
  117.     short rightENum;    // Unique id for last right down event
  118.     
  119.     // The periodic event mechanism timestamps and state
  120.     // are recorded here.
  121.     ns_time_t    thisPeriodicRun;
  122.     ns_time_t    nextPeriodicRun;
  123.     BOOL        periodicRunPending;
  124.  
  125.     // Flags used in scheduling periodic event callbacks
  126.     BOOL        needSetCursorPosition;
  127.     BOOL        needToKickEventConsumer;
  128.     id        kickConsumerLock;
  129. }
  130.  
  131. /* subclass specific factory methods */
  132. + instance;            /* Return the current instance of the */
  133.                 /* EventDriver, or nil if none. */
  134.  
  135. /* Methods from superclass which we override */
  136. + (BOOL)probe : deviceDescription;
  137. + (IODeviceStyle)deviceStyle;
  138. - init;
  139. - free;
  140. - (IOReturn)getIntValues        : (unsigned *)parameterArray
  141.                forParameter : (IOParameterName)parameterName
  142.                       count : (unsigned *)count;    // in/out
  143.  
  144. - (IOReturn)getCharValues        : (unsigned char *)parameterArray
  145.                forParameter : (IOParameterName)parameterName
  146.                       count : (unsigned *)count;    // in/out
  147.             
  148. - (IOReturn)setIntValues        : (unsigned *)parameterArray
  149.                forParameter : (IOParameterName)parameterName
  150.                       count : (unsigned)count;
  151.  
  152. - (IOReturn)setCharValues        : (unsigned char *)parameterArray
  153.                forParameter : (IOParameterName)parameterName
  154.                       count : (unsigned)count;
  155.  
  156. @end
  157.  
  158. #endif    _EVENT_DRIVER_
  159.  
  160.