View Issue Details

IDProjectCategoryView StatusLast Update
0034759LazarusLCLpublic2019-05-15 22:20
ReporterSerge AnvarovAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformWindowsOSOS Version
Product Version2.0RC3Product Build 
Target VersionFixed in Version 
Summary0034759: For Windows there is a inconsistency in the use of wsFullScreen for WindowState
DescriptionwsFullScreen acts as wsNormal or as wsMaximized in different cases.
In Win32WinApi.inc it equal wsMaximized:
[code]
function TWin32WidgetSet.ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean;
begin
  if nCmdShow = SW_SHOWFULLSCREEN then
    nCmdShow := SW_SHOWMAXIMIZED;
  Result := Boolean(Windows.ShowWindow(hWnd, nCmdShow));
end;
[/code]
but in Win32WSForms.pp it equal wsNormal:
[code]
class procedure TWin32WSCustomForm.ShowHide(const AWinControl: TWinControl);
const
  WindowStateToFlags: array[TWindowState] of DWord = (
 { wsNormal } SW_SHOWNORMAL, // to restore from minimzed/maximized we need to use SW_SHOWNORMAL instead of SW_SHOW
 { wsMinimized } SW_SHOWMINIMIZED,
 { wsMaximized } SW_SHOWMAXIMIZED,
 { wsFullScreen } SW_SHOWNORMAL // win32 has no fullscreen window state
  );
[/code]
I think the ShowHide needs to be changed to match the ShowWindow (replace last SW_SHOWNORMAL to SW_SHOWMAXIMIZED in ShowHide)
Steps To ReproduceCreate new project. Set Form1.WindowState = wsFullScreen. Run. Form will be maximized size but in design position. Stop. Set Form1.WindowState = wsMaximized. Run. Form will be maximized size in position 0,0.
Additional InformationPatch included
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetWin32/Win64
Attached Files
  • wsFullScreen.diff (624 bytes)
    Index: lcl/interfaces/win32/win32wsforms.pp
    ===================================================================
    --- lcl/interfaces/win32/win32wsforms.pp	(revision 59910)
    +++ lcl/interfaces/win32/win32wsforms.pp	(working copy)
    @@ -711,7 +711,7 @@
      { wsNormal     } SW_SHOWNORMAL, // to restore from minimzed/maximized we need to use SW_SHOWNORMAL instead of SW_SHOW
      { wsMinimized  } SW_SHOWMINIMIZED,
      { wsMaximized  } SW_SHOWMAXIMIZED,
    - { wsFullScreen } SW_SHOWNORMAL  // win32 has no fullscreen window state
    + { wsFullScreen } SW_SHOWMAXIMIZED  // win32 has no fullscreen window state
       );
     var
       Flags: DWord;
    
    wsFullScreen.diff (624 bytes)

Activities

Serge Anvarov

2018-12-25 10:30

reporter  

wsFullScreen.diff (624 bytes)
Index: lcl/interfaces/win32/win32wsforms.pp
===================================================================
--- lcl/interfaces/win32/win32wsforms.pp	(revision 59910)
+++ lcl/interfaces/win32/win32wsforms.pp	(working copy)
@@ -711,7 +711,7 @@
  { wsNormal     } SW_SHOWNORMAL, // to restore from minimzed/maximized we need to use SW_SHOWNORMAL instead of SW_SHOW
  { wsMinimized  } SW_SHOWMINIMIZED,
  { wsMaximized  } SW_SHOWMAXIMIZED,
- { wsFullScreen } SW_SHOWNORMAL  // win32 has no fullscreen window state
+ { wsFullScreen } SW_SHOWMAXIMIZED  // win32 has no fullscreen window state
   );
 var
   Flags: DWord;
wsFullScreen.diff (624 bytes)

jamie philbrook

2018-12-25 14:12

reporter   ~0112867

Please don't make FullScreen into Maximize

The ShowWindow in the widget should be doing something different here, for example it should be making a call to the forms code to set full screen not
diverting the message over to Maximize, there is a difference.
 
  A custom component message could be sent to the form for this to happen..
 
 That's my vote.

Serge Anvarov

2018-12-25 14:51

reporter   ~0112869

Something? Yes, please implement. Now it just does different things in different places. And until you come up with nothing else, it is better to make it behavior the same

jamie philbrook

2018-12-25 17:32

reporter   ~0112873

procedure TForm1.Button3Click(Sender: TObject);
Var
  M:TMonitor;
  X:Boolean;
begin
  M:= Screen.MonitorFromWindow(Handle);
  X:=SetWindowPos(Handle,handle,M.WorkAreaRect.Left,M.WorkAreaRect.Top,
   M.WorkAreaRect.Width,M.WorkAreaRect.Height,SWP_NOZORDER+SWP_SHOWWINDOW);
end;

Ok, I suppose this could be done, it does the full screen as opposed to maximized to the taskbar.

 This will use all of the work area.

 Issues are that windows normally uses all of the work area if maximized on a monitor that isn't the primary one, because there is no taskbar there

 Using the above code will use full screen no matter what I guess.

Serge Anvarov

2018-12-26 17:47

reporter   ~0112894

We say about wsFullScreen and patch for it.
You can add a patch that opens the form to the full screen, but so far it turns out all awful: full size form from the middle of the screen

Bart Broersma

2019-01-21 22:36

developer   ~0113556

I asked on devel ML which way to go.

Alexey Tor.

2019-01-22 09:17

reporter   ~0113565

Original patch is Ok. jamie's wish must be a separate patch in new issue.

Andrew S. Baker (ASB)

2019-05-15 22:20

reporter   ~0116213

Any verdict on this?

Issue History

Date Modified Username Field Change
2018-12-25 10:30 Serge Anvarov New Issue
2018-12-25 10:30 Serge Anvarov File Added: wsFullScreen.diff
2018-12-25 14:12 jamie philbrook Note Added: 0112867
2018-12-25 14:51 Serge Anvarov Note Added: 0112869
2018-12-25 17:32 jamie philbrook Note Added: 0112873
2018-12-26 17:47 Serge Anvarov Note Added: 0112894
2019-01-21 22:36 Bart Broersma Note Added: 0113556
2019-01-22 09:17 Alexey Tor. Note Added: 0113565
2019-05-15 22:20 Andrew S. Baker (ASB) Note Added: 0116213