mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 17:39:25 +02:00
Merged revisions 3243-3244,3345-3346,3367,3374,3393,3434,3698,3767,3782,3812-3813,3841,3910 via svnmerge from
http://peter@svn.freepascal.org/svn/fpc/trunk ........ r3243 | daniel | 2006-04-17 14:39:02 +0200 (Mon, 17 Apr 2006) | 2 lines * Unix video unit character set conversion overhaul ........ r3244 | daniel | 2006-04-17 15:01:02 +0200 (Mon, 17 Apr 2006) | 2 lines * Conversion tables for video unit. ........ r3345 | daniel | 2006-04-27 22:15:57 +0200 (Thu, 27 Apr 2006) | 2 lines * Fix exiting acs after screen update ........ r3346 | daniel | 2006-04-27 23:00:46 +0200 (Thu, 27 Apr 2006) | 2 lines * Force VGA colours, regardless of xterm background colour. ........ r3367 | daniel | 2006-04-29 20:33:51 +0200 (Sat, 29 Apr 2006) | 2 lines * Another xterm hack :( ........ r3374 | daniel | 2006-04-29 23:43:37 +0200 (Sat, 29 Apr 2006) | 2 lines * Make hack uglier, so it works better. ........ r3393 | jonas | 2006-04-30 22:51:02 +0200 (Sun, 30 Apr 2006) | 2 lines * fixed compilation on non-Linux ........ r3434 | daniel | 2006-05-06 20:39:32 +0200 (Sat, 06 May 2006) | 2 lines * Codepage code had a bug ........ r3698 | daniel | 2006-05-27 18:42:47 +0200 (Sat, 27 May 2006) | 2 lines * Set standard I/O line ending to #13#10 when keyboard in raw mode. ........ r3767 | daniel | 2006-06-02 22:46:46 +0200 (Fri, 02 Jun 2006) | 2 lines * Fix window resizing in X. ........ r3782 | hajny | 2006-06-04 01:50:53 +0200 (Sun, 04 Jun 2006) | 1 line * another cleanup of unnecessary variables ........ r3812 | daniel | 2006-06-05 23:42:36 +0200 (Mon, 05 Jun 2006) | 2 lines + Add S_IRWXU ........ r3813 | daniel | 2006-06-05 23:46:05 +0200 (Mon, 05 Jun 2006) | 2 lines * Now right. ........ r3841 | daniel | 2006-06-11 11:00:19 +0200 (Sun, 11 Jun 2006) | 2 lines + Correct behaviour when initialization fails. ........ r3910 | daniel | 2006-06-21 16:39:44 +0200 (Wed, 21 Jun 2006) | 2 lines * Fix missing ctrlZmarkseof check. ........ git-svn-id: branches/fixes_2_0@3952 -
This commit is contained in:
parent
6202422165
commit
9ca67e6c0b
@ -892,6 +892,8 @@ begin
|
||||
{ InitMemory;}
|
||||
InitScreen;
|
||||
Video.SetVideoMode(Mode);
|
||||
ScreenWidth:=Video.ScreenWidth;
|
||||
ScreenHeight:=Video.ScreenHeight;
|
||||
Buffer := Views.PVideoBuf(VideoBuf);
|
||||
R.Assign(0, 0, ScreenWidth, ScreenHeight);
|
||||
ChangeBounds(R);
|
||||
|
@ -112,8 +112,8 @@ begin
|
||||
((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
|
||||
begin
|
||||
SystemEvent.typ:=SysResize;
|
||||
SystemEvent.x:=WinSize.ws_row;
|
||||
SystemEvent.y:=WinSize.ws_col;
|
||||
SystemEvent.x:=WinSize.ws_col;
|
||||
SystemEvent.y:=WinSize.ws_row;
|
||||
PutSystemEvent(SystemEvent);
|
||||
LastXSize:=WinSize.ws_row;
|
||||
LastYSize:=WinSize.ws_col;
|
||||
|
@ -893,8 +893,17 @@ End;
|
||||
Function ReadPCharLen(var f:Text;s:pchar;maxlen:longint):longint;
|
||||
var
|
||||
sPos,len : Longint;
|
||||
p,startp,maxp : pchar;
|
||||
p,q,startp,maxp : pchar;
|
||||
stop_chars:array[0..3] of char;
|
||||
end_of_string:boolean;
|
||||
Begin
|
||||
{Avoid use of ctrlZmarkseof in the inner loop.}
|
||||
stop_chars[0]:=#13;
|
||||
stop_chars[1]:=#10;
|
||||
stop_chars[2]:=#0;
|
||||
if ctrlZmarkseof then
|
||||
stop_chars[2]:=#26;
|
||||
stop_chars[3]:=#0;
|
||||
ReadPCharLen:=0;
|
||||
{ Check error and if file is open }
|
||||
If (InOutRes<>0) then
|
||||
@ -911,6 +920,7 @@ Begin
|
||||
end;
|
||||
{ Read maximal until Maxlen is reached }
|
||||
sPos:=0;
|
||||
end_of_string:=false;
|
||||
repeat
|
||||
If TextRec(f).BufPos>=TextRec(f).BufEnd Then
|
||||
begin
|
||||
@ -924,19 +934,27 @@ Begin
|
||||
else
|
||||
maxp:=@TextRec(f).Bufptr^[TextRec(f).BufEnd];
|
||||
startp:=p;
|
||||
{ search linefeed }
|
||||
while (p<maxp) and not(P^ in [#10,#13]) do
|
||||
inc(p);
|
||||
{ find stop character }
|
||||
{ while (p<maxp) and not(P^ in [#10,#13]) do
|
||||
inc(p);}
|
||||
while p<maxp do
|
||||
begin
|
||||
q:=@stop_chars;
|
||||
while (q^<>#0) and (p^<>q^) do
|
||||
inc(q);
|
||||
if p^=q^ then
|
||||
begin
|
||||
end_of_string:=true;
|
||||
break;
|
||||
end;
|
||||
inc(p);
|
||||
end;
|
||||
{ calculate read bytes }
|
||||
len:=p-startp;
|
||||
inc(TextRec(f).BufPos,Len);
|
||||
Move(startp^,s[sPos],Len);
|
||||
inc(sPos,Len);
|
||||
{ was it a LF or CR? then leave }
|
||||
if (spos=MaxLen) or
|
||||
((p<maxp) and (p^ in [#10,#13])) then
|
||||
break;
|
||||
until false;
|
||||
until (spos=MaxLen) or end_of_string;
|
||||
ReadPCharLen:=spos;
|
||||
End;
|
||||
|
||||
|
@ -149,16 +149,19 @@ end;
|
||||
Procedure InitVideo;
|
||||
|
||||
begin
|
||||
If Not VideoInitialized then
|
||||
if not VideoInitialized then
|
||||
begin
|
||||
If Assigned(CurrentVideoDriver.InitDriver) then
|
||||
CurrentVideoDriver.InitDriver;
|
||||
VideoInitialized:=True;
|
||||
if NextVideoModeSet then
|
||||
SetVideoMode(NextVideoMode)
|
||||
else
|
||||
AssignVideoBuf(0,0);
|
||||
ClearScreen;
|
||||
if Assigned(CurrentVideoDriver.InitDriver) then
|
||||
CurrentVideoDriver.InitDriver;
|
||||
if errorcode=viook then
|
||||
begin
|
||||
VideoInitialized:=true;
|
||||
if NextVideoModeSet then
|
||||
SetVideoMode(NextVideoMode)
|
||||
else
|
||||
AssignVideoBuf(0,0);
|
||||
ClearScreen;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -98,10 +98,19 @@ var
|
||||
VideoBufSize : Longint;
|
||||
CursorLines : Byte;
|
||||
|
||||
const
|
||||
LowAscii : Boolean = true;
|
||||
NoExtendedFrame : Boolean = false;
|
||||
FVMaxWidth = 132;
|
||||
const {The following constants were variables in the past.
|
||||
- Lowascii was set to true if ASCII characters < 32 were available
|
||||
- NoExtendedFrame was set to true if the double with line drawing
|
||||
characters were set to true.
|
||||
|
||||
These variables did exist because of VT100 limitations on Unix. However,
|
||||
only part of the character set problem was solved this way. Nowadays, the
|
||||
video unit converts characters to the output character set (which might be
|
||||
VT100) automatically, so the user does not need to worry about it anymore.}
|
||||
LowAscii = true;
|
||||
NoExtendedFrame = false;
|
||||
|
||||
FVMaxWidth = 132;
|
||||
|
||||
Procedure LockScreenUpdate;
|
||||
{ Increments the screen update lock count with one.}
|
||||
|
@ -273,6 +273,7 @@ CONST
|
||||
S_IROTH = %0000000100; { Read permission for world }
|
||||
S_IWOTH = %0000000010; { Write permission for world }
|
||||
S_IXOTH = %0000000001; { Exec permission for world }
|
||||
S_IRWXU = S_IRUSR or S_IWUSR or S_IXUSR;
|
||||
|
||||
{ Used for waitpid }
|
||||
WNOHANG = 1; { don't block waiting }
|
||||
|
@ -102,7 +102,6 @@ function SysGetShiftState: Byte;
|
||||
|
||||
var
|
||||
K: TKbdInfo;
|
||||
L: cardinal;
|
||||
begin
|
||||
KbdGetFocus (IO_NoWait, Handle);
|
||||
K.cb := SizeOf (K);
|
||||
|
@ -94,7 +94,6 @@ begin
|
||||
ScreenColor := Color >= Colors_16;
|
||||
end;
|
||||
VioGetCurPos (CursorY, CursorX, 0);
|
||||
LowAscii := true;
|
||||
SetCursorType (LastCursorType);
|
||||
{ Get the address of the videobuffer.}
|
||||
if VioGetBuf (SysVideoBuf, PWord (@VideoBufSize)^, 0) = 0 then
|
||||
|
@ -1307,6 +1307,7 @@ end;
|
||||
procedure SysDoneKeyboard;
|
||||
begin
|
||||
{$ifdef linux}
|
||||
if is_console then
|
||||
unpatchkeyboard;
|
||||
{$endif linux}
|
||||
|
||||
|
@ -1098,11 +1098,11 @@ begin
|
||||
{$endif logging}
|
||||
{ save new terminal characteristics and possible restore rawness }
|
||||
videoInitDone;
|
||||
|
||||
decide_codepages;
|
||||
end
|
||||
else
|
||||
ErrorCode:=errVioInit; { not a TTY }
|
||||
|
||||
decide_codepages;
|
||||
end;
|
||||
|
||||
procedure SysDoneVideo;
|
||||
@ -1224,13 +1224,33 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function SysSetVideoMode(const mode:Tvideomode):boolean;
|
||||
|
||||
var winsize:Twinsize;
|
||||
|
||||
begin
|
||||
{Due to xterm resize this procedure might get called with the new xterm
|
||||
size. Approve the video mode change if the new size equals that of
|
||||
the terminal window size.}
|
||||
SysSetVideoMode:=false;
|
||||
fpioctl(stdinputhandle,TIOCGWINSZ,@winsize);
|
||||
if (mode.row=winsize.ws_row) and
|
||||
(mode.col=winsize.ws_col) then
|
||||
begin
|
||||
screenwidth:=mode.col;
|
||||
screenheight:=mode.row;
|
||||
screencolor:=true;
|
||||
SysSetVideoMode:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
Const
|
||||
SysVideoDriver : TVideoDriver = (
|
||||
InitDriver : @SysInitVideo;
|
||||
DoneDriver : @SysDoneVideo;
|
||||
UpdateScreen : @SysUpdateScreen;
|
||||
ClearScreen : @SysClearScreen;
|
||||
SetVideoMode : Nil;
|
||||
SetVideoMode : @SysSetVideoMode;
|
||||
GetVideoModeCount : Nil;
|
||||
GetVideoModeData : Nil;
|
||||
SetCursorPos : @SysSetCursorPos;
|
||||
|
Loading…
Reference in New Issue
Block a user