Forum > FPC development

Possible Bug in video.pp (GetVideoMode(aMode);) delivers zero values.

(1/1)

jc99:
the video.pp from rtl-console is heavily used in fv and it's descendents.

the DetectVideo-Procedure in drivers should detect the current -text-console mode, without changing it.
therefore it's declared as

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure DetectVideo;VAR  CurrMode : TVideoMode;begin  { Video.InitVideo; Incompatible with BP    and forces a screen clear which is often a bad thing PM }  GetVideoMode(CurrMode);  ScreenMode:=CurrMode;end; 
But since video isn't initialized, it returns zero-values.
But on video.initVideo the screen is changed.
Is there a way to init video, another (less invasive) way ?

jc99:
I found a possible workaround:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure DetectVideo;VAR  CurrMode : TVideoMode;  Driver: TVideoDriver;begin  { Video.InitVideo; Incompatible with BP    and forces a screen clear which is often a bad thing PM }  if video.ScreenWidth = 0 then    begin      GetVideoDriver (Driver);      if Assigned(Driver.InitDriver) then        driver.InitDriver;    end;  GetVideoMode(CurrMode);  ScreenMode:=CurrMode;end; 
Now it detects the color and width but still there is a minor issue about the height, (I allways get 63 instead of 25/43 or 50 )

[Edit:]
Maybe it's a bug in FV and the initialization should be done in the initialization-section of the unit.

The best way to solve it, would be that initVideo has a (DoClearScreen=true) parameter. So you have the option whether to clear the screen, or not.

Navigation

[0] Message Index

Go to full version