You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Added workaround for focus issues in Linux
Added workaround for the CEF issue #2026 : https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<ProjectSession>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="57">
|
||||
<Units Count="58">
|
||||
<Unit0>
|
||||
<Filename Value="ExternalPumpBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@@ -19,12 +19,12 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="44"/>
|
||||
<CursorPos X="3" Y="171"/>
|
||||
<TopLine Value="235"/>
|
||||
<CursorPos X="6" Y="271"/>
|
||||
<UsageCount Value="49"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 Y="258" ID="3"/>
|
||||
<Item1 X="57" Y="221" ID="1"/>
|
||||
<Item0 Y="273" ID="3"/>
|
||||
<Item1 X="57" Y="222" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -424,8 +424,16 @@
|
||||
<CursorPos X="59" Y="135"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit56>
|
||||
<Unit57>
|
||||
<Filename Value="../SimpleBrowser2/usimplebrowser2.pas"/>
|
||||
<UnitName Value="uSimpleBrowser2"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="227"/>
|
||||
<CursorPos Y="234"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit57>
|
||||
</Units>
|
||||
<JumpHistory Count="10" HistoryIndex="9">
|
||||
<JumpHistory Count="13" HistoryIndex="12">
|
||||
<Position1>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="153" Column="60" TopLine="127"/>
|
||||
@@ -466,6 +474,18 @@
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="147" Column="16" TopLine="111"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="172" Column="3" TopLine="128"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="197" Column="82" TopLine="190"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="62" Column="15" TopLine="45"/>
|
||||
</Position13>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -55,6 +55,7 @@ object Form1: TForm1
|
||||
Chromium = Chromium1
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnGotFocus = Chromium1GotFocus
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
|
||||
@@ -65,6 +65,7 @@ type
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||
procedure Chromium1GotFocus(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@@ -196,7 +197,7 @@ procedure TForm1.Chromium1BeforePopup(Sender: TObject;
|
||||
begin
|
||||
// For simplicity, this demo blocks all popup windows and new tabs
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
|
||||
@@ -245,14 +246,28 @@ begin
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFLinkedWindowParent1Enter(Sender: TObject);
|
||||
begin
|
||||
If not(csDesigning in ComponentState) then Chromium1.SetFocus(True);
|
||||
end;
|
||||
|
||||
// This is a workaround for the CEF issue #2026
|
||||
// https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on
|
||||
// We use CEFLinkedWindowParent1.OnEnter, CEFLinkedWindowParent1.OnExit and
|
||||
// TChromium.OnGotFocus to avoid most of the focus issues.
|
||||
// CEFLinkedWindowParent1.TabStop must be TRUE.
|
||||
procedure TForm1.CEFLinkedWindowParent1Exit(Sender: TObject);
|
||||
begin
|
||||
if not(csDesigning in ComponentState) then Chromium1.SendCaptureLostEvent;
|
||||
if not(csDesigning in ComponentState) then
|
||||
Chromium1.SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFLinkedWindowParent1Enter(Sender: TObject);
|
||||
begin
|
||||
if not(csDesigning in ComponentState) and
|
||||
Chromium1.Initialized and
|
||||
not(Chromium1.FrameIsFocused) then
|
||||
Chromium1.SendFocusEvent(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1GotFocus(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
CEFLinkedWindowParent1.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMMove(var Message: TLMMove);
|
||||
|
||||
Reference in New Issue
Block a user