home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 367.lha / netkeys_v2.0 / netkeys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-02  |  4.0 KB  |  121 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1990 The Software Distillery.  All Rights Reserved.*/
  3. /* |. o.| || This program may not be distributed without the permission of   */
  4. /* | .  | || the authors.                                                    */
  5. /* | o  | ||                                                                 */
  6. /* |  . |// Written by Doug Walker                                           */
  7. /* ======          BBS:(919)-471-6436      VOICE:(919)-467-4764              */ 
  8. /*                 BIX: djwalker           USENET: ...!mcnc!rti!sas!walker   */
  9. /*                 405 B3 Gooseneck Dr, Cary, NC 27513, USA                  */
  10. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  11. #include <exec/types.h>
  12. #include <exec/nodes.h>
  13. #include <exec/lists.h>
  14. #include <exec/memory.h>
  15. #include <exec/interrupts.h>
  16. #include <exec/ports.h>
  17. #include <exec/libraries.h>
  18. #include <exec/io.h>
  19. #include <exec/tasks.h>
  20. #include <exec/execbase.h>
  21. #include <exec/devices.h>
  22. #include <devices/timer.h>
  23. #include <devices/input.h>
  24. #include <devices/inputevent.h>
  25. #include <intuition/intuitionbase.h>
  26. #include <libraries/dos.h>
  27. /*#include <graphics/gfxmacros.h>*/
  28. #include <hardware/custom.h>
  29. #include <hardware/dmabits.h>
  30. #include <hardware/cia.h>
  31. #include <resources/misc.h>
  32. #include <proto/dos.h>
  33. #include <proto/exec.h>
  34. /*#include <proto/intuition.h>*/
  35. #include <graphics/copper.h>
  36. #include <graphics/gfxbase.h>
  37. #include <proto/graphics.h>
  38. #include <string.h>
  39.  
  40. #include "dnet.h"
  41.  
  42. #define PORT_NETKEYS 9494
  43.  
  44.  
  45.  
  46. #define NKMPNAME "NetKeys 2.0"
  47. #define BANNER "\x9B" "1m" NKMPNAME "\x9b" "0m by Doug Walker\n"\
  48.                "Copyright \xA9 1990 The Software Distillery\n"\
  49.                "235 Trillingham Ln, Cary NC 27513 USA\nBBS:(919)382-8265\n"
  50.  
  51. #define INSTR  "Use 'NetKeys QUIT' to remove\n"\
  52.                "Installing, please wait...\n"
  53.  
  54. #define DEFDOKEY     0x13
  55. #define MAXMSGS      100
  56.  
  57. #define MSG(fh,st)  if(fh) Write(fh, st, strlen(st))
  58.  
  59. #define IESZ  (sizeof(struct InputEvent))
  60. #define NKMSZ (sizeof(struct NETKEYMSG))
  61.  
  62. /* Magic class to tell other side information */
  63. #define IECLASS_NKCONTROL    IECLASS_POINTERPOS
  64.  
  65. /* Values for the 'Code' field of a IECLASS_NKCONTROL message                  */
  66. #define IECODE_NKHOTKEY  0x01  /* Hotkey transferred control to server         */
  67. #define IECODE_NKHOTQUIT 0x02  /* Hotkey ending control by server              */
  68. #define IECODE_NKLEFT    0x04  /* Mouse is exiting from left of handler screen */
  69. #define IECODE_NKRIGHT   0x08  /* Mouse is exiting from right of handler scrn  */
  70.  
  71. struct NETKEYMSG
  72. {
  73.    struct Message m;
  74.    short msgtype;
  75.    struct InputEvent ie;   
  76. };
  77.  
  78. /* Defines for the msgtype field */
  79. #define NKM_NONE    -1
  80. #define NKM_IEVENT   0
  81. #define NKM_QUIT     1
  82. #define NKM_CONTROL  2
  83. #define NKM_ACK      3
  84. #define NKM_HEREWEGO 4
  85. #define NKM_WEBEDONE 5
  86.  
  87. typedef struct
  88. {
  89.    struct Task *buddy;
  90.    short dokey;
  91.    short state;
  92.    short nmsgs;
  93.    struct MsgPort *nkmp;
  94.    struct MsgPort *rtnp;
  95.    struct IntuitionBase *ibase;
  96.    short  swidth;
  97.    short exit;
  98.    int active;
  99.    struct DChannel *chan;
  100.    
  101. } GLOBAL_DATA;
  102.  
  103. /* Defines for the global.state field */
  104. #define EM_SANITY -3  /* Failed sanity check - prolly too many msgs outstanding */
  105. #define EM_NOMEM  -2  /* Out of memory                                          */
  106. #define EM_QUIT   -1  /* Normal quit                                            */
  107. #define EM_DOIT    0  /* Keep on truckin'                                       */
  108. #define EM_LURK    1  /* Pass events through                                    */
  109. #define EM_RELURK  2  /* Start lurking immediately                              */
  110.  
  111. #define NKM_HANDLER 2 /* Parms to InitDevice */
  112. #define NKM_SERVER  1
  113.  
  114. struct InputEvent * __regargs myhandler(struct InputEvent *ev, GLOBAL_DATA *gptr);
  115.  
  116. /* * * * * * * * * * * EXTERNAL ROUTINES * * * * * * * * * */
  117. struct IOStdReq * CreateIOReq(struct MsgPort *, int);
  118. void DeleteIOReq(struct IOStdReq *);
  119.  
  120. void mshow(struct GfxBase *GfxBase, UWORD *NoSprData, int on);
  121.