* * *

Author Topic: (Solved)Modal window won't become fullscreen on linux(Ubuntu)  (Read 1059 times)

torumyax

  • New member
  • *
  • Posts: 33
(Solved)Modal window won't become fullscreen on linux(Ubuntu)
« on: February 20, 2018, 05:10:39 am »
Hello everyone,

I've been trying to make a fullscreen window application that works both on Windows and Linux. Thanks to everyone who share the information, I've manage to figure this out.

However, the problem is that, on Ubuntu, modal window won't become fullscreen. "Top bar" and "Dock" won't hide. Normal window can become fullscreen without problem. On windows, both normal and modal windows can be fullscreen without a problem.

Is there any work around?

I've attached a screenshot and the minimum project which you can recreate this.

Thank you!
cheers.

Windows 10:
Lazarus 1.8.0 r56594 FPC 3.0.4 x86_64-win64-win32/win64

Ubuntu 17.10:
Lazarus 1.8.0 rc4+dfsg-1 FPC 3.0.2 x86_64-linux-gtk2
« Last Edit: February 20, 2018, 07:15:23 am by torumyax »

torumyax

  • New member
  • *
  • Posts: 33
Re: Modal window won't become fullscreen on linux(Ubuntu)
« Reply #1 on: February 20, 2018, 06:17:07 am »
Uhh.. I got it. The trick was...

DON'T use WindowState:=wsFullScreen; if the form is modal.

So, here is the new cross platform way of making fullscreen window.

Code: Pascal  [Select]
  1. procedure TForm2.SetFullScreen_Universal();
  2. begin
  3.   if FisFullscreen then
  4.   begin
  5.     //turn fullscreen off.
  6.     WindowState:= FOrigWndState;
  7.     {$ifdef windows}
  8.     BorderStyle:= bsSizeable;  //don't do this at runtime on linux!
  9.     {$endif}
  10.     ShowWindow(Handle, SW_SHOWNORMAL);
  11.     BoundsRect:= FOrigBounds;
  12.  
  13.     //set flag
  14.     FisFullscreen := false;
  15.   end else
  16.   begin
  17.     //save original windowstate
  18.     FOrigWndState:= WindowState;
  19.     FOrigBounds := BoundsRect;
  20.  
  21.     //turn fullscreen on.
  22.     //WindowState:=wsFullScreen; //don't do this if the form is modal on linux.
  23.     {$ifdef windows}
  24.     BorderStyle:= bsNone;  //don't do this at runtime on linux!
  25.     {$endif}
  26.     BoundsRect:= Monitor.BoundsRect;
  27.     ShowWindow(Handle, SW_SHOWFULLSCREEN);
  28.  
  29.     //set flag
  30.     FisFullscreen := true;
  31.   end;
  32. end;      
  33.  


 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus