Browse Source

* Fix window resizing in X.

git-svn-id: trunk@3767 -
daniel 19 years ago
parent
commit
aa93e6a11e
4 changed files with 26 additions and 3 deletions
  1. 2 0
      fv/app.pas
  2. 2 2
      fv/unixsmsg.inc
  3. 1 0
      rtl/unix/keyboard.pp
  4. 21 1
      rtl/unix/video.pp

+ 2 - 0
fv/app.pas

@@ -892,6 +892,8 @@ begin
 {  InitMemory;}
 {  InitMemory;}
   InitScreen;
   InitScreen;
   Video.SetVideoMode(Mode);
   Video.SetVideoMode(Mode);
+  ScreenWidth:=Video.ScreenWidth;
+  ScreenHeight:=Video.ScreenHeight;
   Buffer := Views.PVideoBuf(VideoBuf);
   Buffer := Views.PVideoBuf(VideoBuf);
   R.Assign(0, 0, ScreenWidth, ScreenHeight);
   R.Assign(0, 0, ScreenWidth, ScreenHeight);
   ChangeBounds(R);
   ChangeBounds(R);

+ 2 - 2
fv/unixsmsg.inc

@@ -112,8 +112,8 @@ begin
         ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
         ((winsize.ws_row<>lastxsize) or (winsize.ws_col<>lastysize)) then
        begin
        begin
          SystemEvent.typ:=SysResize;
          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);
          PutSystemEvent(SystemEvent);
          LastXSize:=WinSize.ws_row;
          LastXSize:=WinSize.ws_row;
          LastYSize:=WinSize.ws_col;
          LastYSize:=WinSize.ws_col;

+ 1 - 0
rtl/unix/keyboard.pp

@@ -1307,6 +1307,7 @@ end;
 procedure SysDoneKeyboard;
 procedure SysDoneKeyboard;
 begin
 begin
 {$ifdef linux}
 {$ifdef linux}
+  if is_console then
   unpatchkeyboard;
   unpatchkeyboard;
 {$endif linux}
 {$endif linux}
 
 

+ 21 - 1
rtl/unix/video.pp

@@ -1224,13 +1224,33 @@ begin
   end;
   end;
 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
 Const
   SysVideoDriver : TVideoDriver = (
   SysVideoDriver : TVideoDriver = (
     InitDriver : @SysInitVideo;
     InitDriver : @SysInitVideo;
     DoneDriver : @SysDoneVideo;
     DoneDriver : @SysDoneVideo;
     UpdateScreen : @SysUpdateScreen;
     UpdateScreen : @SysUpdateScreen;
     ClearScreen : @SysClearScreen;
     ClearScreen : @SysClearScreen;
-    SetVideoMode : Nil;
+    SetVideoMode : @SysSetVideoMode;
     GetVideoModeCount : Nil;
     GetVideoModeCount : Nil;
     GetVideoModeData : Nil;
     GetVideoModeData : Nil;
     SetCursorPos : @SysSetCursorPos;
     SetCursorPos : @SysSetCursorPos;