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

  1. /*     Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * EventProtocols.h - ObjC protocols used by the Event Driver and it's clients.
  4.  *
  5.  * HISTORY
  6.  * 31 Mar 1992    Mike Paquette at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #ifndef    _BSD_DEV_EVENT_PROTOCOLS_
  11. #define _BSD_DEV_EVENT_PROTOCOLS_
  12.  
  13. #import <driverkit/generalFuncs.h>
  14. #import <driverkit/driverTypes.h>
  15. #import <bsd/dev/ev_types.h>    /* Basic types for event system */
  16. #import <bsd/dev/event.h>    /* Event flags */
  17. #import <objc/objc.h>
  18.  
  19. /*
  20.  * Methods exported by the EventDriver to event source objects.
  21.  *
  22.  *    The EventSrcClient protocol is used by event source objects to
  23.  *    post state changes into the event driver.
  24.  *     The event driver implements this protocol.
  25.  */
  26. @protocol EventSrcClient
  27.  
  28. /*
  29.  * Method to be called to register a new EventSrc instance with the Event
  30.  * driver.  This method can be used by loadable drivers to get the attention
  31.  * of the Event Driver.  During the call, the EventSrc instance should expect
  32.  * to receive a becomeOwner message from the Event Driver.
  33.  */
  34. - registerEventSource : source;
  35.  
  36. /*
  37.  * Called when another client wishes to assume ownership of calling EventSrc.
  38.  * This happens when a client attempts a becomeOwner: on a source which is 
  39.  * owned by the callee of this method. 
  40.  *
  41.  * Returns:
  42.  *    IO_R_SUCCESS ==> It's OK to give ownership of the source to other client.
  43.  *               In this case, callee no longer owns the source.
  44.  *    IO_R_BUSY    ==> Don't transfer ownership.
  45.  *
  46.  * Note that this call occurs during (i.e., before the return of) a 
  47.  * becomeOwner: call to the caller of this method.
  48.  */
  49. - (IOReturn)relinquishOwnershipRequest    : source;
  50.  
  51. /*
  52.  * Method by which a client, who has registered "intent to own" via 
  53.  * desireOwnership:client, is notified that the calling device is available.
  54.  * Client will typically call becomeOwner: during this call.
  55.  */
  56. - (void)canBecomeOwner            : source;
  57.  
  58. /* Mouse event reporting */
  59. - relativePointerEvent:(int)buttons deltaX:(int)dx deltaY:(int)dy;
  60. - relativePointerEvent:(int)buttons
  61.         deltaX:(int)dx
  62.         deltaY:(int)dy
  63.         atTime:(ns_time_t)ts;
  64.  
  65. /* Tablet event reporting */
  66. - absolutePointerEvent:(int)buttons
  67.         at:(Point *)newLoc
  68.         inProximity:(BOOL)proximity;
  69. - absolutePointerEvent:(int)buttons
  70.         at:(Point *)newLoc
  71.         inProximity:(BOOL)proximity
  72.         withPressure:(int)pressure;
  73. - absolutePointerEvent:(int)buttons
  74.         at:(Point *)newLoc
  75.         inProximity:(BOOL)proximity
  76.         withPressure:(int)pressure
  77.         withAngle:(int)stylusAngle
  78.         atTime:(ns_time_t)ts;
  79.  
  80. /* Keyboard Event reporting */
  81. - keyboardEvent:(unsigned)eventType
  82.         flags:(unsigned)flags
  83.         keyCode:(unsigned)key
  84.         charCode:(unsigned)charCode
  85.         charSet:(unsigned)charSet
  86.         repeat:(BOOL)repeat
  87.         atTime:(ns_time_t)ts;
  88. - keyboardSpecial:(unsigned)eventType
  89.         flags:(unsigned)flags
  90.         keyCode:(unsigned)key
  91.         specialty:(unsigned)flavor
  92.         atTime:(ns_time_t)ts;
  93. - updateEventFlags:(unsigned)flags;    /* Does not generate events */
  94.  
  95. /* Return current event flag values */
  96. - (int)eventFlags;
  97. @end /* EventSrcClient */
  98.  
  99. /*
  100.  * The EventClient API lists generally useful methods exported by the Event
  101.  * driver.  These can be used by Event sources, or other users of the event
  102.  * system within the same address space.
  103.  */
  104. @protocol EventClient
  105.  
  106. /*
  107.  * Return the current instance of the Event Driver.  There should only be
  108.  * one instance per system.
  109.  */
  110. + instance;
  111.  
  112. /* 
  113.  * Event clients may need to use an I/O thread from time to time.
  114.  * Rather than have each instance running it's own thread, we provide
  115.  * a callback mechanism to let all the instances share a common Event I/O
  116.  * thread running in the IOTask space, and managed by the Event Driver.
  117.  */
  118. - (IOReturn)performInIOThread:    (id)instance    // Instance to call back
  119.     withSelector    :    (SEL)selector    // Selector to call back on
  120.     andData        :    (id)data;    // Data to pass back
  121.  
  122. /* Returns self, or nil on error. */
  123. - performInIOThreadAsync:    (id)instance    // Instance to call back
  124.     withSelector    :    (SEL)selector    // Selector to call back on
  125.     andData        :    (id)data;    // Data to pass back
  126.  
  127. /*
  128.  * Absolute position input devices and some specialized output devices
  129.  * may need to know the bounding rectangle for all attached displays.
  130.  * The following method returns a Bounds* for the workspace.  Please note
  131.  * that the bounds are kept as signed values, and that on a multi-display
  132.  * system the minx and miny values may very well be negative.
  133.  */
  134. - (Bounds *)workSpaceBounds;
  135.  
  136. @end /* EventClient */
  137.  
  138. /*
  139.  * Methods exported by EventSrc objects.
  140.  */
  141. @protocol EventSrcExported
  142.  
  143. /*
  144.  * Register for event dispatch via EventSrcClient protocol. Returns
  145.  * IO_R_SUCCESS if successful, else IO_R_BUSY. The relinquishOwnershipRequest: 
  146.  * method may be called on another client during the execution of this method.
  147.  */
  148. - (IOReturn)becomeOwner        : client;
  149.  
  150. /*
  151.  * Relinquish ownership. Returns IO_R_BUSY if caller is not current owner.
  152.  */
  153. - (IOReturn)relinquishOwnership    : client;
  154.  
  155. /*
  156.  * Request notification (via canBecomeOwner:) when relinquishOwnership: is
  157.  * called. This allows one potential client to place itself "next in line"
  158.  * for ownership. The queue is only one deep.
  159.  */
  160. - (IOReturn)desireOwnership    : client;
  161.  
  162. @end /* EventSrcExported */
  163.  
  164. /*
  165.  * Methods exported by the EventDriver for display systems.
  166.  *
  167.  *    The screenRegister protocol is used by frame buffer drivers to register
  168.  *    themselves with the Event Driver.  These methods are called in response
  169.  *    to an _IOGetParameterInIntArray() call with "IO_Framebuffer_Register" or
  170.  *    "IO_Framebuffer_Unregister".
  171.  */
  172. @protocol screenRegister
  173.  
  174. - (int) registerScreen:    (id)instance
  175.         bounds:(Bounds *)bp
  176.         shmem:(void **)addr
  177.         size:(int *)size;
  178. - (void) unregisterScreen:(int)token;
  179.  
  180. @end /* screenRegister */
  181.  
  182.  
  183. /*
  184.  * Methods exported by compliant frame buffer drivers to the Event Driver.
  185.  *
  186.  *    Any frame buffer driver which will be used by the Window Server should
  187.  *    implement this protocol.  The methods in this protocol are invoked by
  188.  *    the Event Driver on command from the Window Server and from the pointer
  189.  *    management software.
  190.  * 
  191.  *    The frame field is an integer index into the driver's private array of
  192.  *    cursor bitmaps.  It is used to select the cursor to be displayed.
  193.  *    The token field is a small integer as returned by registerScreen, which
  194.  *    indicates which of the driver's screens should be used for drawing.
  195.  */
  196. @protocol evScreen
  197.  
  198. - (port_t) devicePort;
  199. - hideCursor: (int)token;
  200. - moveCursor:(Point*)cursorLoc frame:(int)frame token:(int)t;
  201. - showCursor:(Point*)cursorLoc frame:(int)frame token:(int)t;
  202. - setBrightness:(int)level token:(int)t;
  203.  
  204. @end    /* evScreen */
  205.  
  206. /*
  207.  * Probe protocol used by event sources.
  208.  */
  209. @protocol EventSourceProbe
  210. - probe;
  211. @end
  212.  
  213. #endif /* _BSD_DEV_EVENT_PROTOCOLS_ */
  214.  
  215.