diff --git a/fv/app.pas b/fv/app.pas index 06d1146800..aeb90fafc7 100644 --- a/fv/app.pas +++ b/fv/app.pas @@ -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); diff --git a/fv/unixsmsg.inc b/fv/unixsmsg.inc index a3841e66df..7872ebafe8 100644 --- a/fv/unixsmsg.inc +++ b/fv/unixsmsg.inc @@ -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; diff --git a/rtl/unix/keyboard.pp b/rtl/unix/keyboard.pp index f58b34ba44..6d308f4e4d 100644 --- a/rtl/unix/keyboard.pp +++ b/rtl/unix/keyboard.pp @@ -1307,6 +1307,7 @@ end; procedure SysDoneKeyboard; begin {$ifdef linux} + if is_console then unpatchkeyboard; {$endif linux} diff --git a/rtl/unix/video.pp b/rtl/unix/video.pp index 26b8b58884..bf58e165bd 100644 --- a/rtl/unix/video.pp +++ b/rtl/unix/video.pp @@ -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;