home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 6
/
AACD06.ISO
/
AACD
/
System
/
WBStartup+
/
Source
/
WBStartup+OS3.x
/
ReadKeyboard.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-10-26
|
1KB
|
55 lines
#include <exec/types.h>
#include <exec/ports.h>
#include <exec/io.h>
#include <proto/exec.h>
#include <devices/keyboard.h>
#include <devices/inputevent.h>
#include "ReadKeyboard.h"
#include "WBStartup+.h"
BOOL IsQualifierDepressed(struct WBStartupPrefs *prefs)
{
struct MsgPort *InputMP;
struct IOStdReq *InputIO;
UBYTE matrix[13];
// ULONG inputsigflag;
BOOL success=FALSE;
BOOL runprefs=FALSE;
/***********************/
/* Set up input device */
/***********************/
if (InputMP=CreateMsgPort())
{
if (InputIO= (struct IOStdReq *)CreateIORequest(InputMP, sizeof(struct IOStdReq)))
{
if ( !(OpenDevice("keyboard.device",0,InputIO,0)) )
{
//inputsigflag = 1L << InputMP->mp_SigBit;
InputIO->io_Length = 13;
InputIO->io_Command = KBD_READMATRIX;
InputIO->io_Data = matrix;
DoIO(InputIO);
if((matrix[96/8] & (1<<(96%8)))) /* 96 (is the Raw Key number for Left Shift, p. 831 RKM */
success=TRUE;
else if((matrix[99/8] & (1<<(99%8)))) /* 99 is the Raw Key number for Ctrl */
runprefs=TRUE;
else if((matrix[100/8] & (1<<(100%8)))) /* 100 is the Raw Key number for Left Alt */
prefs->Interactive = TRUE;
CloseDevice(InputIO);
}
DeleteIORequest(InputIO);
}
DeleteMsgPort(InputMP);
}
if (runprefs)
RunPrefs(prefs);
return(success);
}