Changeset 580 for trunk


Ignore:
Timestamp:
May 23, 2024, 8:19:21 PM (6 months ago)
Author:
chronos
Message:
  • Fixed: Task bar shouldn't be visible in full screen mode on Windows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r561 r580  
    324324    HaveStrategyAdvice: Boolean;
    325325    FirstMovieTurn: Boolean;
    326     PrevWindowState: TWindowState;
    327     CurrentWindowState: TWindowState;
     326    FormFullScreen: Boolean;
     327    FormRestoredSize: TRect;
     328    FormWindowState: TWindowState;
    328329    MainMap: TIsoMap;
    329330    NoMap: TIsoMap;
     
    70237024
    70247025procedure TMainScreen.SetFullScreen(Active: Boolean);
    7025 begin
    7026   if Active and (CurrentWindowState <> TWindowState.wsFullScreen) then begin
    7027     PrevWindowState := WindowState;
    7028     CurrentWindowState := TWindowState.wsFullScreen;
    7029     WindowState := CurrentWindowState;
     7026var
     7027  Form: TForm;
     7028begin
     7029  Form := Self;
     7030  if Active then begin
     7031    FormFullScreen := True;
     7032    if Form.WindowState = TWindowState.wsMaximized then begin
     7033      FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth,
     7034        Form.RestoredHeight);
     7035    end else
     7036    if Form.WindowState = TWindowState.wsNormal then begin
     7037      FormRestoredSize := Bounds(Form.Left, Form.Top, Form.Width, Form.Height);
     7038    end;
     7039    FormWindowState := Form.WindowState;
     7040    Form.WindowState := TWindowState.wsMaximized;
     7041    Form.WindowState := TWindowState.wsNormal;
     7042    ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);
    70307043    {$IFDEF WINDOWS}
    7031     BorderStyle := TBorderStyle.bsNone;
     7044    Form.BorderStyle := TBorderStyle.bsNone;
    70327045    {$ENDIF}
    7033     BorderIcons := [];
    7034   end else
    7035   if not Active and (CurrentWindowState = TWindowState.wsFullScreen) then begin
    7036     if PrevWindowState = TWindowState.wsMaximized then begin
    7037       CurrentWindowState := TWindowState.wsNormal;
    7038       WindowState := CurrentWindowState;
    7039     end else begin
    7040       CurrentWindowState := PrevWindowState;
    7041       WindowState := CurrentWindowState;
    7042       WindowState := TWindowState.wsFullScreen;
    7043       WindowState := CurrentWindowState;
    7044     end;
     7046  end else begin
     7047    FormFullScreen := False;
    70457048    {$IFDEF WINDOWS}
    7046     BorderStyle := TBorderStyle.bsSizeable;
     7049    Form.BorderStyle := TBorderStyle.bsSizeable;
    70477050    {$ENDIF}
    7048     BorderIcons := [TBorderIcon.biSystemMenu, TBorderIcon.biMinimize,
    7049       TBorderIcon.biMaximize];
    7050     if Left < 0 then Left := 0;
    7051     if Top < 0 then Top := 0;
     7051    ShowWindow(Form.Handle, SW_SHOWNORMAL);
     7052    if FormWindowState = TWindowState.wsNormal then begin
     7053      Form.WindowState := TWindowState.wsNormal;
     7054      Form.BoundsRect := FormRestoredSize;
     7055    end else
     7056    if FormWindowState = TWindowState.wsMaximized then begin
     7057      Form.BoundsRect := FormRestoredSize;
     7058      Form.WindowState := TWindowState.wsMaximized;
     7059    end;
    70527060  end;
    70537061end;
     
    80588066  if FullScreen then BoundsRect := Bounds(0, 0, Screen.Width, Screen.Height)
    80598067    else BoundsRect := TermBounds;
     8068  FormRestoredSize := TermBounds;
    80608069  SetFullScreen(FullScreen);
    80618070  FormResize(nil); // place mini map correctly according to its size
     
    80658074procedure TMainScreen.FormClose(Sender: TObject; var Action: TCloseAction);
    80668075begin
    8067   TermBounds := BoundsRect;
     8076  if FullScreen then TermBounds := FormRestoredSize
     8077    else TermBounds := BoundsRect;
    80688078  Timer1.Enabled := False;
    80698079end;
Note: See TracChangeset for help on using the changeset viewer.