home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / WBStartup+ / Source / WBStartup+OS3.x / ReadKeyboard.c < prev    next >
C/C++ Source or Header  |  1998-10-26  |  1KB  |  55 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.  
  8. #include "ReadKeyboard.h"
  9. #include "WBStartup+.h"
  10.  
  11. BOOL IsQualifierDepressed(struct WBStartupPrefs *prefs)
  12. {
  13.   struct MsgPort *InputMP;
  14.   struct IOStdReq *InputIO;
  15.   UBYTE  matrix[13];
  16. //  ULONG inputsigflag;
  17.   BOOL success=FALSE;
  18.   BOOL runprefs=FALSE;
  19.  
  20.   /***********************/
  21.   /* Set up input device */
  22.   /***********************/
  23.   if (InputMP=CreateMsgPort())
  24.   {
  25.     if (InputIO= (struct IOStdReq *)CreateIORequest(InputMP, sizeof(struct IOStdReq)))
  26.     {
  27.       if ( !(OpenDevice("keyboard.device",0,InputIO,0)) )
  28.       {
  29.         //inputsigflag = 1L << InputMP->mp_SigBit;
  30.  
  31.         InputIO->io_Length  = 13;
  32.         InputIO->io_Command = KBD_READMATRIX;
  33.         InputIO->io_Data = matrix;
  34.         DoIO(InputIO);
  35.  
  36.         if((matrix[96/8] & (1<<(96%8))))  /* 96 (is the Raw Key number for Left Shift, p. 831 RKM */
  37.           success=TRUE;
  38.         else if((matrix[99/8] & (1<<(99%8))))  /* 99 is the Raw Key number for Ctrl */
  39.           runprefs=TRUE;
  40.         else if((matrix[100/8] & (1<<(100%8)))) /* 100 is the Raw Key number for Left Alt */
  41.           prefs->Interactive = TRUE;
  42.  
  43.         CloseDevice(InputIO);
  44.       }
  45.       DeleteIORequest(InputIO);
  46.     }
  47.     DeleteMsgPort(InputMP);
  48.   }
  49.  
  50.   if (runprefs)
  51.     RunPrefs(prefs);
  52.   return(success);
  53. }
  54.  
  55.