Skip to content

Commit

Permalink
Prevent sleep on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
torum committed Aug 19, 2022
1 parent 2a3728c commit 582054d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ufullscreen.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ object frmFullscreen: TfrmFullscreen
end
object IdleTimerMouseHide: TIdleTimer
AutoEnabled = True
Interval = 2000
Interval = 1500
OnTimer = IdleTimerMouseHideTimer
Left = 18
Top = 204
Expand Down
23 changes: 22 additions & 1 deletion ufullscreen.pas
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ procedure TfrmFullscreen.PlaybackPlay(preLoad:boolean);
{$IFDEF Windows}
SetThreadExecutionState(ES_DISPLAY_REQUIRED or ES_SYSTEM_REQUIRED or ES_CONTINUOUS);
{$ELSE}
// Couldn't find a better way.
// https://forum.lazarus.freepascal.org/index.php/topic,56671.0.html
MPos:=Mouse.CursorPos;
Mouse.CursorPos:=MPos;
{$ENDIF}
Expand Down Expand Up @@ -548,7 +550,6 @@ procedure TfrmFullscreen.PlaybackPlay(preLoad:boolean);

procedure TfrmFullscreen.PlaybackRepeatStart();
begin

{$ifdef Mydebug}
OutputDebugString(PChar(TrimRight( 'PlaybackRepeatStart ')));
{$endif}
Expand Down Expand Up @@ -1034,9 +1035,19 @@ procedure TfrmFullscreen.Image1MouseDown(Sender: TObject; Button: TMouseButton;
procedure TfrmFullscreen.Image1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
{$ifdef windows}
Screen.Cursor:= crDefault;
Self.Cursor:=crDefault;
Image1.Cursor:=crDefault;
{$else}
if FIsSlideshowPlaying and (not TimerInterval.Enabled) and (not TimerFadeIn.Enabled) and
(not TimerFadeOut.Enabled) then
begin
Screen.Cursor:= crDefault;
Self.Cursor:=crDefault;
Image1.Cursor:=crDefault;
end;
{$endif}

if FisInFrame then
begin
Expand Down Expand Up @@ -1537,9 +1548,19 @@ procedure TfrmFullscreen.FormKeyDown(Sender: TObject; var Key: Word;
procedure TfrmFullscreen.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
{$ifdef windows}
Screen.Cursor:= crDefault;
Self.Cursor:=crDefault;
Image1.Cursor:=crDefault;
{$else}
if FIsSlideshowPlaying and (not TimerInterval.Enabled) and (not TimerFadeIn.Enabled) and
(not TimerFadeOut.Enabled) then
begin
Screen.Cursor:= crDefault;
Self.Cursor:=crDefault;
Image1.Cursor:=crDefault;
end;
{$endif}
// Do the same at Image1.
end;

Expand Down

0 comments on commit 582054d

Please sign in to comment.