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

View File

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

View File

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

View File

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