2
0
Эх сурвалжийг харах

* The new terminal started by svgalib after a switch to graphics mode is
now set to raw mode, so that some functions of the CRT unit such as
ReadKey can work correctly now.

sg 25 жил өмнө
parent
commit
80b35eca1f
1 өөрчлөгдсөн 28 нэмэгдсэн , 1 устгасан
  1. 28 1
      rtl/linux/graph.pp

+ 28 - 1
rtl/linux/graph.pp

@@ -239,6 +239,26 @@ var
  function vga_screenon: Longint;  Cdecl; External;
  function vga_screenon: Longint;  Cdecl; External;
  function vga_getgraphmem: PByteArray; cdecl; external;
  function vga_getgraphmem: PByteArray; cdecl; external;
 
 
+
+
+var
+  OldIO : TermIos;
+Procedure SetRawMode(b:boolean);
+Var
+  Tio : Termios;
+Begin
+  if b then
+   begin
+     TCGetAttr(1,Tio);
+     OldIO:=Tio;
+     CFMakeRaw(Tio);
+   end
+  else
+   Tio:=OldIO;
+  TCSetAttr(1,TCSANOW,Tio);
+End;
+
+
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     Required procedures
     Required procedures
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
@@ -295,6 +315,7 @@ begin
   nrColors:=vga_getcolors;
   nrColors:=vga_getcolors;
   if (nrColors=16) or (nrcolors=256) then
   if (nrColors=16) or (nrcolors=256) then
     InitColors;
     InitColors;
+  SetRawMode(True);
 end;
 end;
 
 
 Function ClipCoords (Var X,Y : Integer) : Boolean;
 Function ClipCoords (Var X,Y : Integer) : Boolean;
@@ -476,6 +497,7 @@ end;
         _graphresult := grnoinitgraph;
         _graphresult := grnoinitgraph;
         exit
         exit
       end;
       end;
+    SetRawMode(False);
     RestoreVideoState;
     RestoreVideoState;
     isgraphmode := false;
     isgraphmode := false;
  end;
  end;
@@ -567,7 +589,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2000-03-25 19:12:00  florian
+  Revision 1.14  2000-04-13 16:01:22  sg
+  * The new terminal started by svgalib after a switch to graphics mode is
+    now set to raw mode, so that some functions of the CRT unit such as
+    ReadKey can work correctly now.
+
+  Revision 1.13  2000/03/25 19:12:00  florian
     * fixed values of MaxX and MaxY
     * fixed values of MaxX and MaxY
 
 
   Revision 1.12  2000/03/19 11:20:14  peter
   Revision 1.12  2000/03/19 11:20:14  peter