Browse Source

morphunits: added input.device and keyboard.device interfaces, based on fpc-triforce

git-svn-id: trunk@32710 -
Károly Balogh 9 years ago
parent
commit
6bbc078ef8

+ 2 - 0
.gitattributes

@@ -5804,6 +5804,7 @@ packages/morphunits/Makefile.fpc.fpcmake svneol=native#text/plain
 packages/morphunits/fpmake.pp svneol=native#text/plain
 packages/morphunits/src/agraphics.pas svneol=native#text/plain
 packages/morphunits/src/ahi.pas svneol=native#text/plain
+packages/morphunits/src/akeyboard.pas svneol=native#text/plain
 packages/morphunits/src/amigados.pas svneol=native#text/plain
 packages/morphunits/src/amigalib.pas svneol=native#text/plain
 packages/morphunits/src/asl.pas svneol=native#text/plain
@@ -5817,6 +5818,7 @@ packages/morphunits/src/gadtools.pas svneol=native#text/pascal
 packages/morphunits/src/get9.pas svneol=native#text/plain
 packages/morphunits/src/hardware.pas svneol=native#text/plain
 packages/morphunits/src/iffparse.pas svneol=native#text/plain
+packages/morphunits/src/input.pas svneol=native#text/plain
 packages/morphunits/src/inputevent.pas svneol=native#text/plain
 packages/morphunits/src/intuition.pas svneol=native#text/plain
 packages/morphunits/src/keymap.pas svneol=native#text/plain

+ 2 - 1
packages/morphunits/Makefile.fpc.fpcmake

@@ -9,7 +9,8 @@ version=3.1.1
 [target]
 units= amigalib agraphics ahi amigados asl clipboard datatypes exec get9 \
        hardware inputevent intuition keymap layers mui muihelper timer \
-       tinygl utility iffparse diskfont cybergraphics cgxvideo gadtools
+       tinygl utility iffparse diskfont cybergraphics cgxvideo gadtools \
+       akeyboard input
 
 [compiler]
 includedir=src

+ 2 - 0
packages/morphunits/fpmake.pp

@@ -34,6 +34,8 @@ begin
     T:=P.Targets.AddUnit('exec.pas');
     T:=P.Targets.AddUnit('timer.pas');
     T:=P.Targets.AddUnit('utility.pas');
+    T:=P.Targets.AddUnit('akeyboard.pas');
+    T:=P.Targets.AddUnit('input.pas');
     T:=P.Targets.AddUnit('intuition.pas');
     T:=P.Targets.AddUnit('agraphics.pas');
     T:=P.Targets.AddUnit('amigalib.pas');

+ 41 - 0
packages/morphunits/src/akeyboard.pas

@@ -0,0 +1,41 @@
+{
+  This file is part of the Free Pascal MorphOS support package
+  Copyright (c) 2015 the Free Pascal Development Team
+
+  keyboard.device interface unit
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+unit akeyboard;
+
+{
+   Contents of this file is based on keyboard.h from the MorphOS SDK:
+
+   keyboard.device include
+   Copyright (c) 2002 The MorphOS Development Team, All Rights Reserved
+}
+
+{ Pascal conversion based on fpc-triforce repo by Magorium }
+
+interface
+
+uses
+  exec;
+
+const
+  KBD_READEVENT               = (CMD_NONSTD + 0);
+  KBD_READMATRIX              = (CMD_NONSTD + 1);
+  KBD_ADDRESETHANDLER         = (CMD_NONSTD + 2);
+  KBD_REMRESETHANDLER         = (CMD_NONSTD + 3);
+  KBD_RESETHANDLERDONE        = (CMD_NONSTD + 4);
+
+implementation
+
+end.

+ 81 - 0
packages/morphunits/src/input.pas

@@ -0,0 +1,81 @@
+{
+  This file is part of the Free Pascal MorphOS support package
+  Copyright (c) 2015 the Free Pascal Development Team
+
+  input.device interface unit
+
+  See the file COPYING.FPC, included in this distribution,
+  for details about the copyright.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+{$MODE FPC}
+{$PACKRECORDS 2}
+unit input;
+
+{
+   Contents of this file is based on input.h from the MorphOS SDK:
+
+   input.device include (V50)
+   Copyright (c) 2002 The MorphOS Development Team, All Rights Reserved
+}
+
+{ Pascal conversion based on fpc-triforce repo by Magorium }
+
+interface
+
+uses 
+  exec, utility;
+
+const
+  IND_ADDHANDLER    = CMD_NONSTD + 0;
+  IND_REMHANDLER    = CMD_NONSTD + 1;
+  IND_WRITEEVENT    = CMD_NONSTD + 2;
+  IND_SETTHRESH     = CMD_NONSTD + 3;
+  IND_SETPERIOD     = CMD_NONSTD + 4;
+  IND_SETMPORT      = CMD_NONSTD + 5;
+  IND_SETMTYPE      = CMD_NONSTD + 6;
+  IND_SETMTRIG      = CMD_NONSTD + 7;
+
+type
+  TInputDeviceData = record
+    Device  : PChar;
+    unit_   : ULONG;
+    flags   : ULONG;
+  end;
+
+  {
+  * GetInputEventAttr(),SetInputEventAttr() attributes of functons that
+  * doesn't seem to exist.. !?
+  *
+  * This may be a mistake in the comment in the MorphOS SDK. Since
+  * InputEvents are BOOPSI objects in MorphOS, it's possible that you
+  * can use GetAttr/SetAttrs in theory..? 
+  * This is pending for answer by the MorphOS Team. (KB)
+  }
+const
+  INPUTEVENTATTR_TagBase    = TAG_USER + $8000000;
+  INPUTEVENTATTR_NEXTEVENT  = (INPUTEVENTATTR_TagBase + 0);
+  INPUTEVENTATTR_CLASS      = (INPUTEVENTATTR_TagBase + 1);
+  INPUTEVENTATTR_SUBCLASS   = (INPUTEVENTATTR_TagBase + 2);
+  INPUTEVENTATTR_CODE       = (INPUTEVENTATTR_TagBase + 3);
+  INPUTEVENTATTR_QUALIFIER  = (INPUTEVENTATTR_TagBase + 4);
+  INPUTEVENTATTR_X          = (INPUTEVENTATTR_TagBase + 5);
+  INPUTEVENTATTR_Y          = (INPUTEVENTATTR_TagBase + 6);
+  INPUTEVENTATTR_ADDR       = (INPUTEVENTATTR_TagBase + 7);
+  INPUTEVENTATTR_DOWNKEYS   = (INPUTEVENTATTR_TagBase + 8);
+  INPUTEVENTATTR_TIMESTAMP  = (INPUTEVENTATTR_TagBase + 9);
+
+var
+  InputBase: pDevice;
+
+function PeekQualifier: UWORD; syscall InputBase 042;
+
+
+implementation
+
+end.