You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-04 21:32:54 +02:00
Fixed initial browser focus in SimpleOSRBrowser for Linux-GTK2
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 1658
|
Left = 1658
|
||||||
Height = 1260
|
Height = 630
|
||||||
Top = 423
|
Top = 423
|
||||||
Width = 2000
|
Width = 1000
|
||||||
Caption = ' Initializing browser. Please wait...'
|
Caption = ' Initializing browser. Please wait...'
|
||||||
ClientHeight = 1260
|
ClientHeight = 630
|
||||||
ClientWidth = 2000
|
ClientWidth = 1000
|
||||||
DesignTimePPI = 192
|
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
OnCloseQuery = FormCloseQuery
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
@@ -15,30 +14,29 @@ object Form1: TForm1
|
|||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
OnWindowStateChange = FormWindowStateChange
|
OnWindowStateChange = FormWindowStateChange
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '3.8.0.0'
|
|
||||||
object AddressPnl: TPanel
|
object AddressPnl: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 60
|
Height = 30
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 2000
|
Width = 1000
|
||||||
Align = alTop
|
Align = alTop
|
||||||
ClientHeight = 60
|
ClientHeight = 30
|
||||||
ClientWidth = 2000
|
ClientWidth = 1000
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 1867
|
Left = 933
|
||||||
Height = 58
|
Height = 28
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 132
|
Width = 66
|
||||||
Align = alRight
|
Align = alRight
|
||||||
ClientHeight = 58
|
ClientHeight = 28
|
||||||
ClientWidth = 132
|
ClientWidth = 66
|
||||||
TabOrder = 0
|
TabOrder = 1
|
||||||
object GoBtn: TButton
|
object GoBtn: TButton
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 56
|
Height = 26
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 62
|
Width = 31
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
Caption = 'Go'
|
Caption = 'Go'
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@@ -46,13 +44,13 @@ object Form1: TForm1
|
|||||||
OnEnter = GoBtnEnter
|
OnEnter = GoBtnEnter
|
||||||
end
|
end
|
||||||
object SnapshotBtn: TButton
|
object SnapshotBtn: TButton
|
||||||
Left = 69
|
Left = 34
|
||||||
Height = 56
|
Height = 26
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 62
|
Width = 31
|
||||||
Align = alRight
|
Align = alRight
|
||||||
Caption = 'µ'
|
Caption = 'µ'
|
||||||
Font.Height = -48
|
Font.Height = -24
|
||||||
Font.Name = 'Webdings'
|
Font.Name = 'Webdings'
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@@ -62,15 +60,22 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object AddressCb: TComboBox
|
object AddressCb: TComboBox
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 58
|
Height = 28
|
||||||
Top = 1
|
Top = 1
|
||||||
Width = 1866
|
Width = 932
|
||||||
Align = alClient
|
Align = alClient
|
||||||
AutoSelect = False
|
AutoSelect = False
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
ItemIndex = 0
|
ItemIndex = 7
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'https://www.google.com'
|
'https://www.google.com'
|
||||||
|
'https://www.bing.com'
|
||||||
|
'https://duckduckgo.com'
|
||||||
|
'https://www.qwant.com'
|
||||||
|
'https://yandex.com'
|
||||||
|
'https://www.startpage.com'
|
||||||
|
'https://www.ecosia.org'
|
||||||
|
'https://www.baidu.com'
|
||||||
'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending'
|
'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending'
|
||||||
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close'
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close'
|
||||||
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert'
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert'
|
||||||
@@ -119,15 +124,16 @@ object Form1: TForm1
|
|||||||
'chrome://extensions-support'
|
'chrome://extensions-support'
|
||||||
'chrome://process-internals'
|
'chrome://process-internals'
|
||||||
)
|
)
|
||||||
TabOrder = 1
|
TabOrder = 0
|
||||||
Text = 'https://www.google.com'
|
Text = 'https://www.baidu.com'
|
||||||
|
OnEnter = AddressCbEnter
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Panel1: TBufferPanel
|
object Panel1: TBufferPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 1200
|
Height = 600
|
||||||
Top = 60
|
Top = 30
|
||||||
Width = 2000
|
Width = 1000
|
||||||
OnIMEPreEditStart = Panel1IMEPreEditStart
|
OnIMEPreEditStart = Panel1IMEPreEditStart
|
||||||
OnIMEPreEditEnd = Panel1IMEPreEditEnd
|
OnIMEPreEditEnd = Panel1IMEPreEditEnd
|
||||||
OnIMEPreEditChanged = Panel1IMEPreEditChanged
|
OnIMEPreEditChanged = Panel1IMEPreEditChanged
|
||||||
@@ -138,7 +144,6 @@ object Form1: TForm1
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TabStop = True
|
TabStop = True
|
||||||
OnClick = Panel1Click
|
|
||||||
OnEnter = Panel1Enter
|
OnEnter = Panel1Enter
|
||||||
OnExit = Panel1Exit
|
OnExit = Panel1Exit
|
||||||
OnMouseDown = Panel1MouseDown
|
OnMouseDown = Panel1MouseDown
|
||||||
@@ -151,6 +156,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Chromium1: TChromium
|
object Chromium1: TChromium
|
||||||
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
||||||
|
OnSetFocus = Chromium1SetFocus
|
||||||
OnTooltip = Chromium1Tooltip
|
OnTooltip = Chromium1Tooltip
|
||||||
OnCursorChange = Chromium1CursorChange
|
OnCursorChange = Chromium1CursorChange
|
||||||
OnBeforePopup = Chromium1BeforePopup
|
OnBeforePopup = Chromium1BeforePopup
|
||||||
@@ -164,20 +170,20 @@ object Form1: TForm1
|
|||||||
OnPopupSize = Chromium1PopupSize
|
OnPopupSize = Chromium1PopupSize
|
||||||
OnPaint = Chromium1Paint
|
OnPaint = Chromium1Paint
|
||||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||||
Left = 96
|
Left = 48
|
||||||
Top = 144
|
Top = 72
|
||||||
end
|
end
|
||||||
object Timer1: TTimer
|
object Timer1: TTimer
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnTimer = Timer1Timer
|
OnTimer = Timer1Timer
|
||||||
Left = 96
|
Left = 48
|
||||||
Top = 288
|
Top = 144
|
||||||
end
|
end
|
||||||
object SaveDialog1: TSaveDialog
|
object SaveDialog1: TSaveDialog
|
||||||
Title = 'Save screenshot bitmap as'
|
Title = 'Save screenshot bitmap as'
|
||||||
DefaultExt = '.bmp'
|
DefaultExt = '.bmp'
|
||||||
Filter = 'Bitmap file|*.bmp'
|
Filter = 'Bitmap file|*.bmp'
|
||||||
Left = 96
|
Left = 48
|
||||||
Top = 432
|
Top = 216
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -29,7 +29,6 @@ type
|
|||||||
Panel2: TPanel;
|
Panel2: TPanel;
|
||||||
Timer1: TTimer;
|
Timer1: TTimer;
|
||||||
|
|
||||||
procedure Panel1Click(Sender: TObject);
|
|
||||||
procedure Panel1Enter(Sender: TObject);
|
procedure Panel1Enter(Sender: TObject);
|
||||||
procedure Panel1Exit(Sender: TObject);
|
procedure Panel1Exit(Sender: TObject);
|
||||||
procedure Panel1IMECommit(Sender: TObject; const aCommitText: ustring);
|
procedure Panel1IMECommit(Sender: TObject; const aCommitText: ustring);
|
||||||
@@ -58,6 +57,7 @@ type
|
|||||||
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||||
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||||
procedure Chromium1DevToolsMethodResult(Sender: TObject; const browser: ICefBrowser; message_id: integer; success: boolean; const result: ICefValue);
|
procedure Chromium1DevToolsMethodResult(Sender: TObject; const browser: ICefBrowser; message_id: integer; success: boolean; const result: ICefValue);
|
||||||
|
procedure Chromium1SetFocus(Sender: TObject; const browser: ICefBrowser; source: TCefFocusSource; out Result: Boolean);
|
||||||
|
|
||||||
procedure FormActivate(Sender: TObject);
|
procedure FormActivate(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
@@ -74,8 +74,8 @@ type
|
|||||||
procedure GoBtnEnter(Sender: TObject);
|
procedure GoBtnEnter(Sender: TObject);
|
||||||
procedure SnapshotBtnClick(Sender: TObject);
|
procedure SnapshotBtnClick(Sender: TObject);
|
||||||
|
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
procedure AddressEdtEnter(Sender: TObject);
|
procedure AddressCbEnter(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@@ -95,6 +95,7 @@ type
|
|||||||
FDevToolsStatus : TDevToolsStatus;
|
FDevToolsStatus : TDevToolsStatus;
|
||||||
FCheckEditable : boolean;
|
FCheckEditable : boolean;
|
||||||
FWasEditing : boolean;
|
FWasEditing : boolean;
|
||||||
|
FBrowserIsFocused : boolean;
|
||||||
{$IFDEF CEF_USE_IME}
|
{$IFDEF CEF_USE_IME}
|
||||||
FIMEHandler : TCEFLinuxOSRIMEHandler;
|
FIMEHandler : TCEFLinuxOSRIMEHandler;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@@ -366,14 +367,15 @@ begin
|
|||||||
SendCompMessage(CEF_AFTERCREATED);
|
SendCompMessage(CEF_AFTERCREATED);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.AddressEdtEnter(Sender: TObject);
|
procedure TForm1.Chromium1SetFocus(Sender: TObject; const browser: ICefBrowser;
|
||||||
|
source: TCefFocusSource; out Result: Boolean);
|
||||||
begin
|
begin
|
||||||
Chromium1.SetFocus(False);
|
Result := not(FBrowserIsFocused);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Panel1Click(Sender: TObject);
|
procedure TForm1.AddressCbEnter(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Panel1.SetFocus;
|
Chromium1.SetFocus(False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormWindowStateChange(Sender: TObject);
|
procedure TForm1.FormWindowStateChange(Sender: TObject);
|
||||||
@@ -386,7 +388,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Chromium1.WasHidden(False);
|
Chromium1.WasHidden(False);
|
||||||
Chromium1.SetFocus(Panel1.Focused);
|
Chromium1.SetFocus(FBrowserIsFocused);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -394,7 +396,7 @@ procedure TForm1.Application_OnActivate(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
IsEditing := FWasEditing;
|
IsEditing := FWasEditing;
|
||||||
FCheckEditable := True;
|
FCheckEditable := True;
|
||||||
Chromium1.SetFocus(Panel1.Focused);
|
Chromium1.SetFocus(FBrowserIsFocused);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Application_OnDeactivate(Sender: TObject);
|
procedure TForm1.Application_OnDeactivate(Sender: TObject);
|
||||||
@@ -634,12 +636,14 @@ procedure TForm1.Panel1Enter(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
IsEditing := FWasEditing;
|
IsEditing := FWasEditing;
|
||||||
FCheckEditable := True;
|
FCheckEditable := True;
|
||||||
|
FBrowserIsFocused := True;
|
||||||
Chromium1.SetFocus(True);
|
Chromium1.SetFocus(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.Panel1Exit(Sender: TObject);
|
procedure TForm1.Panel1Exit(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FWasEditing := IsEditing;
|
FWasEditing := IsEditing;
|
||||||
|
FBrowserIsFocused := False;
|
||||||
Chromium1.SetFocus(False);
|
Chromium1.SetFocus(False);
|
||||||
{$IFDEF CEF_USE_IME}
|
{$IFDEF CEF_USE_IME}
|
||||||
FIMEHandler.Blur;
|
FIMEHandler.Blur;
|
||||||
@@ -1008,7 +1012,8 @@ begin
|
|||||||
FResizing := False;
|
FResizing := False;
|
||||||
FPendingResize := False;
|
FPendingResize := False;
|
||||||
FCanClose := False;
|
FCanClose := False;
|
||||||
FClosing := False;
|
FClosing := False;
|
||||||
|
FBrowserIsFocused := False;
|
||||||
FResizeCS := TCriticalSection.Create;
|
FResizeCS := TCriticalSection.Create;
|
||||||
FBrowserCS := TCriticalSection.Create;
|
FBrowserCS := TCriticalSection.Create;
|
||||||
{$IFDEF CEF_USE_IME}
|
{$IFDEF CEF_USE_IME}
|
||||||
@@ -1042,7 +1047,7 @@ end;
|
|||||||
procedure TForm1.FormShow(Sender: TObject);
|
procedure TForm1.FormShow(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.WasHidden(False);
|
Chromium1.WasHidden(False);
|
||||||
Chromium1.SetFocus(Panel1.Focused);
|
Chromium1.SetFocus(FBrowserIsFocused);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.GoBtnEnter(Sender: TObject);
|
procedure TForm1.GoBtnEnter(Sender: TObject);
|
||||||
@@ -1069,6 +1074,7 @@ begin
|
|||||||
Caption := 'Simple OSR Browser';
|
Caption := 'Simple OSR Browser';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
|
|
||||||
|
Chromium1.SetFocus(FBrowserIsFocused);
|
||||||
Chromium1.NotifyMoveOrResizeStarted;
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 697,
|
"InternalVersion" : 698,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "132.3.2"
|
"Version" : "132.3.2"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user