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