home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / utilities / wbstartup+ / source / wbstartup+os3.5 / readkeyboard.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-02-05  |  2.3 KB  |  106 lines

  1. #include <exec/types.h>
  2. #include <exec/ports.h>
  3. #include <exec/io.h>
  4. #include <proto/exec.h>
  5. #include <devices/keyboard.h>
  6. #include <devices/inputevent.h>
  7. #include <devices/input.h>
  8.  
  9. #include "ReadKeyboard.h"
  10. #include "WBStartup+.h"
  11.  
  12. #include <proto/input.h>
  13. #include <clib/input_protos.h>
  14.  
  15. struct Device *InputBase;
  16. /*
  17. BOOL IsQualifierDepressed(struct WBStartupPrefs *prefs)
  18. {
  19.   struct MsgPort *InputMP;
  20.   struct IOStdReq *InputIO;
  21.   UBYTE  matrix[13];
  22. //  ULONG inputsigflag;
  23.   BOOL success=FALSE;
  24.   BOOL runprefs=FALSE;
  25.  
  26.   /////////////////////////
  27.   // Set up input device //
  28.   /////////////////////////
  29.   if (InputMP=CreateMsgPort())
  30.   {
  31.     if (InputIO = CreateIORequest (InputMP, sizeof (struct IOStdReq)))
  32.     {
  33.       if ( !(OpenDevice("keyboard.device",0,(struct IORequest *) InputIO,0)) )
  34.       {
  35.         //inputsigflag = 1L << InputMP->mp_SigBit;
  36.  
  37.         InputIO->io_Length  = 13;
  38.         InputIO->io_Command = KBD_READMATRIX;
  39.         InputIO->io_Data = matrix;
  40.         DoIO ((struct IORequest *) InputIO);
  41.  
  42.         if((matrix[96/8] & (1<<(96%8))))  // 96 (is the Raw Key number for Left Shift, p. 831 RKM
  43.           success=TRUE;
  44.         else if((matrix[99/8] & (1<<(99%8))))  // 99 is the Raw Key number for Ctrl
  45.           runprefs=TRUE;
  46.         else if((matrix[100/8] & (1<<(100%8)))) // 100 is the Raw Key number for Left Alt
  47.           prefs->Interactive = TRUE;
  48.  
  49.         CloseDevice ((struct IORequest *) InputIO);
  50.       }
  51.       DeleteIORequest(InputIO);
  52.     }
  53.     DeleteMsgPort(InputMP);
  54.   }
  55.  
  56.   if (runprefs)
  57.     RunPrefs(prefs);
  58.   return(success);
  59. }
  60. */
  61.  
  62. //NEW
  63.  
  64. BOOL IsQualifierDepressed(struct WBStartupPrefs *prefs)
  65. {
  66.   struct IOStdReq *InputIO;
  67.   struct MsgPort *InputMP;
  68.   BOOL success=FALSE;
  69.   BOOL runprefs=FALSE;
  70.  
  71.   /***********************/
  72.   /* Set up input device */
  73.   /***********************/
  74.  
  75.   if (InputMP=CreateMsgPort())
  76.   {
  77.     if (InputIO = CreateIORequest (InputMP, sizeof (struct IOStdReq)))
  78.     {
  79.  
  80.  
  81.   if (OpenDevice ("input.device", 0, (struct IORequest *) InputIO, 0))
  82.     {
  83.       UWORD data;
  84.  
  85.       InputBase = InputIO -> io_Device;
  86.  
  87.       data = PeekQualifier();
  88.  
  89.       if (data & (1 << IEQUALIFIER_MIDBUTTON))
  90.         runprefs = TRUE;
  91.  
  92.         
  93.  
  94.       CloseDevice ((struct IORequest *) InputIO);
  95.     }
  96.  
  97.       DeleteIORequest(InputIO);
  98.     }
  99.     DeleteMsgPort(InputMP);
  100.   }
  101.  
  102.   if (runprefs)
  103.     RunPrefs(prefs);
  104.   return(success);
  105. }
  106.