From 8117c97d921cb0b56f4e958a0ddb7b6d34acf0dd Mon Sep 17 00:00:00 2001 From: Marcus Sackrow Date: Sun, 8 Aug 2021 14:50:25 +0100 Subject: [PATCH] amiga: FPC_DOKEYCONVERSION env var if key conversation Ansi to IBM should be done for every key --- packages/rtl-console/src/amicommon/keyboard.pp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/rtl-console/src/amicommon/keyboard.pp b/packages/rtl-console/src/amicommon/keyboard.pp index eebcd1202e..1f4da5fb20 100644 --- a/packages/rtl-console/src/amicommon/keyboard.pp +++ b/packages/rtl-console/src/amicommon/keyboard.pp @@ -34,11 +34,14 @@ function WaitForSystemEvent(millisec: Integer): boolean; function IBMToANSI(s: RawByteString): RawByteString; function ANSIToIBM(s: RawByteString): RawByteString; +var + FPC_DOKEYCONVERSION: boolean = False; + implementation uses - video, exec, intuition, inputevent, mouse, sysutils, keymap, timer; + video, exec, intuition, inputevent, mouse, sysutils, keymap, timer, amigados; {$i keyboard.inc} {$i keyscan.inc} @@ -460,7 +463,8 @@ begin ie.ie_position.ie_addr := PPointer(IAddr)^; Buff[0] := #0; Ret := MapRawKey(@ie, @Buff[0], 1, nil); - AnsiToIBMChar(Buff[0]); + if FPC_DOKEYCONVERSION then + AnsiToIBMChar(Buff[0]); KeyCode := Ord(Buff[0]); KeySet^.KeyCode := Ord(Buff[0]); // if maprawkey does not work it still is 0 KeySet^.ShiftState := LastShiftState; // shift state set before the case @@ -712,7 +716,13 @@ end; procedure InitSystemEventWait; var initOK: boolean; + envBuf: array[0..15] of char; begin + {.$if not defined(AMIGA_V1_2_ONLY)} + if GetVar('FPC_DOKEYCONVERSION',@envBuf,sizeof(envBuf),0) > -1 then + FPC_DOKEYCONVERSION := True; + {.$endif} + waitTimerFired:=false; waitTPort:=CreateMsgPort(); if assigned(waitTPort) then