Changeset 153 for trunk/Packages/Common/PersistentForm.pas
- Timestamp:
- Aug 14, 2024, 1:05:13 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/PersistentForm.pas
r145 r153 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 {$IFDEF UNIX} 306 var 307 OldHandler: TNotifyEvent; 308 var 309 I: Integer; 310 {$ENDIF} 303 311 begin 304 312 if State then begin … … 312 320 end; 313 321 FormWindowState := Form.WindowState; 314 Form.WindowState := wsMaximized;315 Form.WindowState := wsNormal;316 ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);317 322 {$IFDEF WINDOWS} 318 323 Form.BorderStyle := bsNone; 319 324 {$ENDIF} 325 Form.WindowState := wsFullscreen; 326 {$IFDEF UNIX} 327 // Workaround on Linux, WindowState is rewriten by WMSize event to wsNormal. 328 // We need for that even to occure 329 OldHandler := Form.OnWindowStateChange; 330 Form.OnWindowStateChange := WindowStateChange; 331 FResizeEventOccured := False; 332 for I := 0 to 10 do begin 333 if FResizeEventOccured then Break; 334 Application.ProcessMessages; 335 Sleep(1); 336 end; 337 Form.OnWindowStateChange := OldHandler; 338 FormFullScreen := True; 339 {$ENDIF} 320 340 end else begin 321 341 FormFullScreen := False; 342 Form.WindowState := wsNormal; 322 343 {$IFDEF WINDOWS} 323 344 Form.BorderStyle := bsSizeable; 324 345 {$ENDIF} 325 ShowWindow(Form.Handle, SW_SHOWNORMAL);326 346 if FormWindowState = wsNormal then begin 327 347 Form.WindowState := wsNormal; … … 335 355 end; 336 356 357 procedure TPersistentForm.WindowStateChange(Sender: TObject); 358 begin 359 Form.WindowState := wsFullscreen; 360 FResizeEventOccured := True; 361 end; 362 337 363 end.
Note:
See TracChangeset
for help on using the changeset viewer.