Hello, I'm getting bug reports from members of my OS4 userbase, reporting that keyboard input is being ignored. It works fine on OS3.9 and MOS. So I'm wondering if something has changed for keyboard.device under OS4? The OS4 SDK implies that it hasn't.
I searched the forums here for guidance, but this is all I found:
On a classic Amiga keyboard.device is probably the one to ask, but on an A1 you have more than one device which could hold a keyboard (PS/2, USB, Catweasel etc.)
Does this mean that keyboard input on OS4 might not always go through keyboard.device? If that's the case, what would be the recommended method to get the up/down state of all keys?
I assume that reading IntuitionBase->ActiveWindow is still the best way to get the active window?
Here's the function in question.
EXPORT void readkybd(void)
{ ULONG IBaseLock, i;
struct Window* ActiveWindowPtr;
IBaseLock = LockIBase(0);
ActiveWindowPtr = IntuitionBase->ActiveWindow;
UnlockIBase(IBaseLock);
if
( ActiveWindowPtr == MainWindowPtr
|| (ControlsWindowPtr && ActiveWindowPtr == ControlsWindowPtr)
|| ( DIPsWindowPtr && ActiveWindowPtr == DIPsWindowPtr)
|| (GameInfoWindowPtr && ActiveWindowPtr == GameInfoWindowPtr)
|| ( MonitorWindowPtr && ActiveWindowPtr == MonitorWindowPtr)
|| ( MemoryWindowPtr && ActiveWindowPtr == MemoryWindowPtr)
|| ( PaletteWindowPtr && ActiveWindowPtr == PaletteWindowPtr)
)
{ // Strangely, this only seems to work if KeyMatrix is dynamically
// allocated.
KybdIO->io_Command = KBD_READMATRIX;
KybdIO->io_Length = 16;
KybdIO->io_Data = (APTR) KeyMatrix;
DISCARD DoIO((struct IORequest *) KybdIO);
} else
{ for (i = 0; i < 16; i++)
{ KeyMatrix[i] = 0;
} } }