simulate click on focus steal

This commit is contained in:
April Ayres-Griffiths 2019-04-17 19:34:44 +10:00
parent 3953bb42fd
commit f09f0b85fa
4 changed files with 45 additions and 49 deletions

View File

@ -1,12 +1,12 @@
object GUIForm: TGUIForm
Left = 320
Height = 723
Top = 76
Width = 1113
Left = 371
Height = 683
Top = 112
Width = 1078
AlphaBlendValue = 128
Caption = 'microM8 GUI'
ClientHeight = 698
ClientWidth = 1113
ClientHeight = 658
ClientWidth = 1078
Constraints.MinWidth = 1078
DoubleBuffered = False
Menu = MainMenu1
@ -30,15 +30,15 @@ object GUIForm: TGUIForm
object StatusBar1: TStatusBar
Left = 0
Height = 19
Top = 679
Width = 1113
Top = 639
Width = 1078
Panels = <>
end
object ToolBar1: TToolBar
Left = 0
Height = 36
Top = 0
Width = 1113
Width = 1078
ButtonHeight = 32
ButtonWidth = 32
Caption = 'ToolBar1'
@ -327,31 +327,31 @@ object GUIForm: TGUIForm
end
object pnlContainer: TPanel
Left = 0
Height = 643
Height = 603
Top = 36
Width = 1113
Width = 1078
Align = alClient
BevelOuter = bvNone
ClientHeight = 643
ClientWidth = 1113
ClientHeight = 603
ClientWidth = 1078
ParentColor = False
TabOrder = 2
object sidecarPanel: TPanel
Left = 943
Height = 606
Left = 908
Height = 566
Top = 0
Width = 170
Align = alRight
BevelOuter = bvNone
Caption = 'sidecarPanel'
ClientHeight = 606
ClientHeight = 566
ClientWidth = 170
Color = clBlack
ParentColor = False
TabOrder = 0
object Image1: TImage
Left = 0
Height = 606
Height = 566
Top = 0
Width = 170
Align = alClient
@ -5444,13 +5444,13 @@ object GUIForm: TGUIForm
end
object embedPanel: TPanel
Left = 0
Height = 606
Height = 566
Top = 0
Width = 943
Width = 908
Align = alClient
BevelOuter = bvNone
ClientHeight = 606
ClientWidth = 943
ClientHeight = 566
ClientWidth = 908
Color = clBlack
Font.Color = clWhite
ParentColor = False
@ -5461,9 +5461,9 @@ object GUIForm: TGUIForm
OnMouseUp = FormMouseUp
object backdrop: TImage
Left = 0
Height = 606
Height = 566
Top = 0
Width = 943
Width = 908
Align = alClient
OnClick = backdropClick
OnMouseDown = FormMouseDown
@ -5474,11 +5474,11 @@ object GUIForm: TGUIForm
object pnlMemory: TPanel
Left = 0
Height = 37
Top = 606
Width = 1113
Top = 566
Width = 1078
Align = alBottom
ClientHeight = 37
ClientWidth = 1113
ClientWidth = 1078
ParentColor = False
TabOrder = 2
Visible = False
@ -5520,7 +5520,7 @@ object GUIForm: TGUIForm
Text = '$00'
end
object pnlMemButtons: TPanel
Left = 859
Left = 824
Height = 35
Top = 1
Width = 253

View File

@ -696,15 +696,8 @@ begin
RepaintWindow;
if not IsMicroM8Active then
HideM8
else
begin
lastFocusLostTime:=Now();
//StatusBar1.SimpleText:='focus';
// send fake mouse button state change
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/1' );
end;
//StatusBar1.SimpleText := GetTitleOfActiveWindow;
HideM8;
//log.Lines.Add('app is deactivating');
end;
@ -2726,7 +2719,7 @@ begin
{$ENDIF}
// another hack: disable mouse buttons on refocus
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
//SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
//Application.Restore;
//StatusBar1.SimpleText := 'trying to focus '+DateTimeToStr(Now);
@ -2736,6 +2729,11 @@ begin
{$ENDIF}
//StatusBar1.SimpleText := 'App is refocussing';
lastShowTime := Now();
lastFocusLostTime:=Now();
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/1' );
Delay(50);
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
end;
ReposWindow;
end;

View File

@ -696,15 +696,8 @@ begin
RepaintWindow;
if not IsMicroM8Active then
HideM8
else
begin
lastFocusLostTime:=Now();
//StatusBar1.SimpleText:='focus';
// send fake mouse button state change
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/1' );
end;
//StatusBar1.SimpleText := GetTitleOfActiveWindow;
HideM8;
//log.Lines.Add('app is deactivating');
end;
@ -2726,7 +2719,7 @@ begin
{$ENDIF}
// another hack: disable mouse buttons on refocus
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
//SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
//Application.Restore;
//StatusBar1.SimpleText := 'trying to focus '+DateTimeToStr(Now);
@ -2736,6 +2729,11 @@ begin
{$ENDIF}
//StatusBar1.SimpleText := 'App is refocussing';
lastShowTime := Now();
lastFocusLostTime:=Now();
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/1' );
Sleep(50);
SimpleGet( baseUrl + '/api/control/mouse/buttonstate/0' );
end;
ReposWindow;
end;

View File

@ -21,8 +21,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="2868"/>
<CursorPos X="10" Y="2886"/>
<TopLine Value="694"/>
<CursorPos X="16" Y="699"/>
<UsageCount Value="323"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>