Changeset 175 for trunk/Packages/Common
- Timestamp:
- Jul 19, 2024, 8:00:37 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/PersistentForm.pas
r148 r175 16 16 FMinVisiblePart: Integer; 17 17 FRegistryContext: TRegistryContext; 18 FResizeEventOccured: Boolean; 18 19 procedure LoadControl(Control: TControl); 19 20 procedure SaveControl(Control: TControl); 21 procedure WindowStateChange(Sender: TObject); 20 22 public 21 23 FormRestoredSize: TRect; … … 301 303 302 304 procedure TPersistentForm.SetFullScreen(State: Boolean); 305 var 306 OldHandler: TNotifyEvent; 307 var 308 I: Integer; 303 309 begin 304 310 if State then begin … … 312 318 end; 313 319 FormWindowState := Form.WindowState; 314 Form.WindowState := wsMaximized;315 Form.WindowState := wsNormal;316 ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);317 320 {$IFDEF WINDOWS} 318 321 Form.BorderStyle := bsNone; 319 322 {$ENDIF} 323 Form.WindowState := wsFullscreen; 324 {$IFDEF UNIX} 325 // Workaround on Linux, WindowState is rewriten by WMSize event to wsNormal. 326 // We need for that even to occure 327 OldHandler := Form.OnWindowStateChange; 328 Form.OnWindowStateChange := WindowStateChange; 329 FResizeEventOccured := False; 330 for I := 0 to 10 do begin 331 if FResizeEventOccured then Break; 332 Application.ProcessMessages; 333 Sleep(1); 334 end; 335 Form.OnWindowStateChange := OldHandler; 336 {$ENDIF} 320 337 end else begin 321 338 FormFullScreen := False; 339 Form.WindowState := wsNormal; 322 340 {$IFDEF WINDOWS} 323 341 Form.BorderStyle := bsSizeable; 324 342 {$ENDIF} 325 ShowWindow(Form.Handle, SW_SHOWNORMAL);326 343 if FormWindowState = wsNormal then begin 327 344 Form.WindowState := wsNormal; … … 335 352 end; 336 353 354 procedure TPersistentForm.WindowStateChange(Sender: TObject); 355 begin 356 Form.WindowState := wsFullscreen; 357 FResizeEventOccured := True; 358 end; 359 337 360 end.
Note:
See TracChangeset
for help on using the changeset viewer.