Cudatext only half of Screen

Did you find any problems using this software? Please post here...
hextext
Posts: 7
Joined: 04.01.2024 15:15

Cudatext only half of Screen

Post by hextext »

Hello everyone,
first of all, I would like to thank everyone who worked on the development of this software.

Starting with version 1.200.0.1 I have the problem that cudatext only takes
up half the window when opened in full screen.
If I press the F11 key twice, then half the window expands to
the entire screen and everything works as usual.
This problem does not occur with version 1.199.0.0.

I use Linux with the following specification:
Kernel: 6.5.0-0.deb12.4-amd64
arch: x86_64 bits: 64
compiler: gcc v: 12.2.0
Desktop: Xfce v: 4.18.1
Distro: MX-23.1_x64 Libretto July 31 2023
base: Debian GNU/Linux 12 (bookworm)

The problem probably only occurs under Linux.

Thank you!
Attachments
half_screen.png
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: Cudatext only half of Screen

Post by main Alexey »

- Is it Gtk2 version or Qt5 one?
- Wayland or X11?
hextext
Posts: 7
Joined: 04.01.2024 15:15

Re: Cudatext only half of Screen

Post by hextext »

I'm installing cudatext_1.206.5.0-1_gtk2_amd64.deb
and the data of the graphics unit:
Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: amdgpu
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: Cudatext only half of Screen

Post by main Alexey »

let's test small demo which only can go fullscreen / go back to normal.
http://uvviewsoft.com/c/tst-gtk2-fullscreen.zip
program is 'project1'.

press the button.
button toggles the fullscreen.
(on my PC, i must press button 2 times to return to normal mode - it is also a bug).
hextext
Posts: 7
Joined: 04.01.2024 15:15

Re: Cudatext only half of Screen

Post by hextext »

There seems to be a fundamental problem with wsFullScreen in some systems.
In Linux, when the window is maximized, the first click is still wsNormal in WindowState.
After the second click, wsFullScreen is back.

For the Windows platform, wsFullScreen is converted to wsMaximized when calling the ShowWindow API function;
the Windows API does not provide a full-screen option.

The following works with 'wsMaximized':

Code: Select all

    if WindowState = wsNormal then
    WindowState := wsMaximized
  else
    WindowState := wsNormal;    
A possible solution here would be:

Code: Select all

unit Unit1;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;
type
  { TForm1 }
  TForm1 = class(TForm)
    Button1: TButton;
    Panel1: TPanel;
    procedure Button1Click(Sender: TObject);
  private
    FOldBorderStyle: TFormBorderStyle;
    FOldBoundsRect: TRect;
  public
  end;

var
  Form1: TForm1;

implementation
{$R *.frm}

{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
  Form: TForm;
begin

  //  TWindowState = (wsNormal, wsMinimized, wsMaximized, wsFullScreen);
  //if WindowState = wsNormal then
  //  WindowState := wsMaximized
  //else
  //  WindowState := wsNormal;


//https://forum.lazarus.freepascal.org/index.php?topic=38573.0
    if BorderStyle = bsNone then
    begin
      BorderStyle := FOldBorderStyle;
      BoundsRect := FOldBoundsRect;
    end
  else
    begin
      FOldBorderStyle := BorderStyle;
      FOldBoundsRect := BoundsRect;
      BorderStyle := bsNone;
      BoundsRect := Screen.DesktopRect;
      // In Linux, need a form to assist
      Form := TForm.Create(nil);
      try
        Parent := Form;
        Parent := nil
      finally
        Form.Free;
      end;
    end;
end;
end.  
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: Cudatext only half of Screen

Post by main Alexey »

i should apply your fix to my demo and recompile it for you. then you can test fullscreen again.

BTW, did you reproduce half-screen issue with my demo?
hextext
Posts: 7
Joined: 04.01.2024 15:15

Re: Cudatext only half of Screen

Post by hextext »

The window in the demo project is displayed maximized without any graphical errors.
I'm currently using version 1.199.0.0 and the error doesn't show up here.
So it's not a big problem.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: Cudatext only half of Screen

Post by main Alexey »

i made demo #2.
http://uvviewsoft.com/c/tst-gtk2-fullscreen_2.zip
it has old code - button#1, and new code like in CudaText - button#2.
does button#2 work?
hextext
Posts: 7
Joined: 04.01.2024 15:15

Re: Cudatext only half of Screen

Post by hextext »

Yes, Button 2 works as it should.
First click full screen, second click start size.
No double-click required.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Re: Cudatext only half of Screen

Post by main Alexey »

So both buttons - don't give half-screen size. then I cannot reproduce problem on small demo.
(make sure you used _my_ binary 'project1' which is made using my version of Lazarus)

i first must make reproduction on a demo. only then we can add some fix. it should be the fix in Lazarus LCL, not in the Cud.
Post Reply