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