View Issue Details

IDProjectCategoryView StatusLast Update
0034759LazarusLCLpublic2020-07-09 17:09
ReporterSerge Anvarov Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindows 
Product Version2.0RC3 
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 Revisionr62835
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0036855 resolvedJuha Manninen Swapped wsFullScreen and wsMaximized in TForm Properties WIndowState only on OS Windows 

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.

CudaText man

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?

Juha Manninen

2020-03-31 21:09

developer   ~0121805

I understood that simulating wsFullScreen with Maximized is better than the current state. I applied the patch.

Serge Anvarov

2020-07-09 17:09

reporter   ~0123844

In 2.0.10

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 CudaText man Note Added: 0113565
2019-05-15 22:20 Andrew S. Baker (ASB) Note Added: 0116213
2020-03-31 17:51 Juha Manninen Relationship added related to 0036855
2020-03-31 21:09 Juha Manninen Assigned To => Juha Manninen
2020-03-31 21:09 Juha Manninen Status new => resolved
2020-03-31 21:09 Juha Manninen Resolution open => fixed
2020-03-31 21:09 Juha Manninen Fixed in Revision => r62835
2020-03-31 21:09 Juha Manninen LazTarget => -
2020-03-31 21:09 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2020-03-31 21:09 Juha Manninen Note Added: 0121805
2020-07-09 17:09 Serge Anvarov Status resolved => closed
2020-07-09 17:09 Serge Anvarov Note Added: 0123844