add defocus action delay of 250ms

This commit is contained in:
April Ayres-Griffiths 2019-04-13 13:48:22 +10:00
parent b4a3c7e325
commit 06a8af05fe
4 changed files with 10 additions and 4 deletions

View File

@ -500,6 +500,7 @@ type
lx, ly, lw, lh: integer;
lastShowTime: TDateTime;
lastHideTime: TDateTime;
lastFocusLostTime: TDateTime;
hidden: boolean;
lastMouseX, lastMouseY: longint;
inPopup: boolean;
@ -539,7 +540,7 @@ var
mstate: integer;
s: string;
begin
s := GetConfig( baseUrl+'/api/control/mouse/buttonstate' );
s := SimpleGet( baseUrl+'/api/control/mouse/buttonstate' );
mstate := StrToInt( s );
result := (mstate and integer(AMouseBtn)) <> 0;
end;
@ -560,7 +561,7 @@ function TGUIForm.IsMouseBtnDown: Boolean;
var
mstate: integer;
begin
mstate := StrToInt( GetConfig( baseUrl+'/api/control/mouse/buttonstate' ) );
mstate := StrToInt( SimpleGet( baseUrl+'/api/control/mouse/buttonstate' ) );
result := mstate <> 0;
end;
{$ENDIF}
@ -2358,6 +2359,8 @@ end;
procedure TGUIForm.FormDeactivate(Sender: TObject);
begin
StatusBar1.SimpleText := 'focus lost';
lastFocusLostTime:=Now();
end;
procedure TGUIForm.FormHide(Sender: TObject);

Binary file not shown.

Binary file not shown.

View File

@ -500,6 +500,7 @@ type
lx, ly, lw, lh: integer;
lastShowTime: TDateTime;
lastHideTime: TDateTime;
lastFocusLostTime: TDateTime;
hidden: boolean;
lastMouseX, lastMouseY: longint;
inPopup: boolean;
@ -2289,8 +2290,8 @@ procedure TGUIForm.CheckTimerTimer(Sender: TObject);
begin
if isFS then
exit;
//if MilliSecondsBetween(Now(), lastShowTime) < 500 then
// exit;
if MilliSecondsBetween(Now(), lastFocusLostTime) < 250 then
exit;
if WindowState = wsMinimized then
exit;
//if hidden then
@ -2358,6 +2359,8 @@ end;
procedure TGUIForm.FormDeactivate(Sender: TObject);
begin
StatusBar1.SimpleText := 'focus lost';
lastFocusLostTime:=Now();
end;
procedure TGUIForm.FormHide(Sender: TObject);