1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-04-17 06:57:13 +02:00

Added a Linux version of the SubProcess demo for Lazarus

GlobalCEFApp now uses the custom "ShowX11Message" procedure to show messages when the WidgetSet is not initialized.
This commit is contained in:
Salvador Diaz Fau 2020-12-31 12:15:10 +01:00
parent 05680d5abc
commit 5fd5dc79f0
16 changed files with 1797 additions and 8 deletions

View File

@ -0,0 +1,2 @@
rmdir /S /Q lib
rmdir /S /Q backup

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="SubProcess"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="CEF4Delphi_Lazarus"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="3">
<Unit0>
<Filename Value="SubProcess.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="uSubProcess.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
<Unit2>
<Filename Value="interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Interfaces"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/SubProcess"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dUseCthreads"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,73 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
program SubProcess;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
// "Interfaces" is a custom unit used to initialize the LCL WidgetSet
// We keep the same name to avoid a Lazarus warning.
Interfaces, // this includes the LCL widgetset
Forms, uSubProcess,
{ you can add units after this }
uCEFApplication;
{$R *.res}
begin
CreateGlobalCEFApp;
if GlobalCEFApp.StartMainProcess then
begin
// The LCL Widgetset must be initialized after the CEF initialization and
// only in the browser process.
CustomWidgetSetInitialization;
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
CustomWidgetSetFinalization;
end;
DestroyGlobalCEFApp;
end.

View File

@ -0,0 +1,558 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="58">
<Unit0>
<Filename Value="SubProcess.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="3"/>
<TopLine Value="27"/>
<CursorPos X="74" Y="42"/>
<UsageCount Value="46"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="uSubProcess.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="95"/>
<CursorPos X="31" Y="109"/>
<UsageCount Value="46"/>
<Bookmarks Count="1">
<Item0 Y="235" ID="3"/>
</Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Interfaces"/>
<EditorIndex Value="-1"/>
<UsageCount Value="44"/>
</Unit2>
<Unit3>
<Filename Value="../../../../source/uCEFConstants.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="571"/>
<CursorPos X="66" Y="597"/>
<UsageCount Value="9"/>
</Unit3>
<Unit4>
<Filename Value="../../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="891"/>
<CursorPos X="63" Y="1021"/>
<UsageCount Value="9"/>
</Unit4>
<Unit5>
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lclrescache.pas"/>
<UnitName Value="LCLResCache"/>
<EditorIndex Value="-1"/>
<TopLine Value="379"/>
<CursorPos Y="398"/>
<UsageCount Value="9"/>
</Unit5>
<Unit6>
<Filename Value="../../../../source/uCEFMiscFunctions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1025"/>
<CursorPos X="80" Y="1040"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="/usr/share/lazarus/2.0.6/lcl/include/application.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1019"/>
<CursorPos X="127" Y="1047"/>
<UsageCount Value="9"/>
</Unit7>
<Unit8>
<Filename Value="../../../../source/uCEFChromium.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="284"/>
<CursorPos Y="312"/>
<UsageCount Value="9"/>
</Unit8>
<Unit9>
<Filename Value="../../../../source/uCEFChromiumCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="4369"/>
<CursorPos X="40" Y="4378"/>
<UsageCount Value="9"/>
</Unit9>
<Unit10>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/classes/classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1556"/>
<CursorPos X="3" Y="1573"/>
<UsageCount Value="9"/>
</Unit10>
<Unit11>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/osutilsh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="10" Y="26"/>
<UsageCount Value="9"/>
</Unit11>
<Unit12>
<Filename Value="../../../source/uCEFWindowParent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="41"/>
<CursorPos X="49" Y="86"/>
<UsageCount Value="13"/>
</Unit12>
<Unit13>
<Filename Value="../../../source/uCEFWinControl.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="51"/>
<CursorPos X="29" Y="73"/>
<UsageCount Value="19"/>
</Unit13>
<Unit14>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/winapih.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="195"/>
<CursorPos X="10" Y="222"/>
<UsageCount Value="9"/>
</Unit14>
<Unit15>
<Filename Value="../../../../fpCEF3/cef3types.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit15>
<Unit16>
<Filename Value="../../../../fpCEF3/Component/cef3lcl.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="744"/>
<CursorPos X="62" Y="784"/>
<UsageCount Value="11"/>
</Unit16>
<Unit17>
<Filename Value="../../../source/uCEFChromium.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="48"/>
<CursorPos X="3" Y="66"/>
<UsageCount Value="14"/>
</Unit17>
<Unit18>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="2524"/>
<CursorPos X="59" Y="2566"/>
<UsageCount Value="20"/>
<Bookmarks Count="2">
<Item0 Y="2564" ID="1"/>
<Item1 Y="4727" ID="2"/>
</Bookmarks>
</Unit18>
<Unit19>
<Filename Value="../../../source/uCEFTypes.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="397"/>
<CursorPos X="18" Y="414"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="2946"/>
<CursorPos X="18" Y="2980"/>
<UsageCount Value="14"/>
<Bookmarks Count="1">
<Item0 X="5" Y="2949" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="-1"/>
<TopLine Value="1958"/>
<CursorPos X="3" Y="1981"/>
<UsageCount Value="14"/>
</Unit21>
<Unit22>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lcltype.pp"/>
<UnitName Value="LCLType"/>
<EditorIndex Value="-1"/>
<TopLine Value="79"/>
<CursorPos X="22" Y="89"/>
<UsageCount Value="9"/>
</Unit22>
<Unit23>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/systemh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="312"/>
<CursorPos X="3" Y="339"/>
<UsageCount Value="9"/>
</Unit23>
<Unit24>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/unix/aliasctp.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="49"/>
<UsageCount Value="9"/>
</Unit24>
<Unit25>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/unix/ctypes.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<CursorPos X="3" Y="55"/>
<UsageCount Value="9"/>
</Unit25>
<Unit26>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/gtk+/gtk/gtkwidget.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="69"/>
<CursorPos X="4" Y="96"/>
<UsageCount Value="10"/>
</Unit26>
<Unit27>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2def.pp"/>
<UnitName Value="Gtk2Def"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/gtk2x11/gdk2x.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit28>
<Unit29>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2extrah.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="32"/>
<CursorPos X="10" Y="59"/>
<UsageCount Value="10"/>
</Unit29>
<Unit30>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/wincontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7104"/>
<CursorPos X="3" Y="7117"/>
<UsageCount Value="13"/>
</Unit30>
<Unit31>
<Filename Value="../../../source/uCEFLinkedWindowParent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="51"/>
<CursorPos X="91" Y="87"/>
<UsageCount Value="18"/>
</Unit31>
<Unit32>
<Filename Value="../../../../fpCEF3/cef3lib.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1101"/>
<CursorPos X="5" Y="1137"/>
<UsageCount Value="16"/>
</Unit32>
<Unit33>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/x11/src/xlib.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="1445"/>
<CursorPos X="10" Y="1467"/>
<UsageCount Value="10"/>
</Unit33>
<Unit34>
<Filename Value="../../../source/uCEFLibFunctions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="34"/>
<CursorPos X="30" Y="57"/>
<UsageCount Value="10"/>
</Unit34>
<Unit35>
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1453"/>
<CursorPos Y="1490"/>
<UsageCount Value="11"/>
</Unit35>
<Unit36>
<Filename Value="../../../source/uCEFApplication.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="31"/>
<CursorPos X="21" Y="38"/>
<UsageCount Value="9"/>
</Unit36>
<Unit37>
<Filename Value="../../../source/uCEFInterfaces.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="441"/>
<CursorPos Y="484"/>
<UsageCount Value="16"/>
</Unit37>
<Unit38>
<Filename Value="../../../source/uCEFTask.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="777"/>
<CursorPos X="3" Y="794"/>
<UsageCount Value="15"/>
</Unit38>
<Unit39>
<Filename Value="../../../source/uCEFChromiumWindow.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="61"/>
<CursorPos X="47" Y="88"/>
<UsageCount Value="14"/>
</Unit39>
<Unit40>
<Filename Value="../../../../../Vídeos/4280/tests/cefclient/browser/root_window_gtk.cc"/>
<EditorIndex Value="-1"/>
<TopLine Value="516"/>
<CursorPos X="39" Y="551"/>
<UsageCount Value="15"/>
<Bookmarks Count="1">
<Item0 X="58" Y="524" ID="3"/>
</Bookmarks>
<DefaultSyntaxHighlighter Value="C++"/>
</Unit40>
<Unit41>
<Filename Value="../SimpleOSRBrowser/usimpleosrbrowser.pas"/>
<UnitName Value="uSimpleOSRBrowser"/>
<EditorIndex Value="-1"/>
<TopLine Value="242"/>
<CursorPos X="82" Y="277"/>
<UsageCount Value="15"/>
</Unit41>
<Unit42>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="5777"/>
<CursorPos X="3" Y="5787"/>
<UsageCount Value="14"/>
</Unit42>
<Unit43>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/lazmethodlist.pas"/>
<UnitName Value="LazMethodList"/>
<EditorIndex Value="-1"/>
<TopLine Value="15"/>
<CursorPos X="15" Y="57"/>
<UsageCount Value="10"/>
</Unit43>
<Unit44>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/opengles/examples/es2example1.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="156"/>
<CursorPos X="75" Y="192"/>
<UsageCount Value="10"/>
</Unit44>
<Unit45>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/x11/src/x.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="266"/>
<CursorPos X="4" Y="293"/>
<UsageCount Value="9"/>
</Unit45>
<Unit46>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/x11/src/xatom.pp"/>
<EditorIndex Value="-1"/>
<CursorPos X="9" Y="18"/>
<UsageCount Value="9"/>
</Unit46>
<Unit47>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/fpgtk/src/fpgtk.pp"/>
<UnitName Value="FPgtk"/>
<EditorIndex Value="-1"/>
<TopLine Value="4153"/>
<CursorPos X="140" Y="4167"/>
<UsageCount Value="13"/>
</Unit47>
<Unit48>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2widgetset.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="412"/>
<CursorPos X="181" Y="435"/>
<UsageCount Value="13"/>
</Unit48>
<Unit49>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2proc.pp"/>
<UnitName Value="Gtk2Proc"/>
<EditorIndex Value="-1"/>
<TopLine Value="150"/>
<CursorPos X="10" Y="177"/>
<UsageCount Value="13"/>
</Unit49>
<Unit50>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2callback.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2433"/>
<CursorPos X="38" Y="2476"/>
<UsageCount Value="13"/>
</Unit50>
<Unit51>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2proc.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="6707"/>
<CursorPos X="66" Y="6724"/>
<UsageCount Value="13"/>
<Bookmarks Count="1">
<Item0 X="66" Y="6724" ID="1"/>
</Bookmarks>
</Unit51>
<Unit52>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="-1"/>
<TopLine Value="2219"/>
<CursorPos X="9" Y="2224"/>
<UsageCount Value="13"/>
</Unit52>
<Unit53>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/customform.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="753"/>
<CursorPos X="3" Y="761"/>
<UsageCount Value="13"/>
</Unit53>
<Unit54>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/application.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2267"/>
<CursorPos Y="2285"/>
<UsageCount Value="10"/>
</Unit54>
<Unit55>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/lclintf.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="353"/>
<CursorPos Y="376"/>
<UsageCount Value="11"/>
</Unit55>
<Unit56>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/x11/src/keysym.pp"/>
<EditorIndex Value="-1"/>
<UsageCount Value="11"/>
</Unit56>
<Unit57>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfacebase.pp"/>
<UnitName Value="InterfaceBase"/>
<EditorIndex Value="1"/>
<TopLine Value="18"/>
<CursorPos X="19" Y="18"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit57>
</Units>
<JumpHistory Count="25" HistoryIndex="24">
<Position1>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="1613" TopLine="1591"/>
</Position1>
<Position2>
<Filename Value="uSubProcess.pas"/>
<Caret Line="137" TopLine="110"/>
</Position2>
<Position3>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2929" Column="82" TopLine="2895"/>
</Position3>
<Position4>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="318" Column="11" TopLine="290"/>
</Position4>
<Position5>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2940" Column="5" TopLine="2897"/>
</Position5>
<Position6>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="66" Column="16" TopLine="55"/>
</Position6>
<Position7>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="320" Column="32" TopLine="285"/>
</Position7>
<Position8>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2950" TopLine="2949"/>
</Position8>
<Position9>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2951" TopLine="2942"/>
</Position9>
<Position10>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2953" TopLine="2942"/>
</Position10>
<Position11>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2959" TopLine="2942"/>
</Position11>
<Position12>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2960" TopLine="2942"/>
</Position12>
<Position13>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2964" TopLine="2942"/>
</Position13>
<Position14>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2960" TopLine="2942"/>
</Position14>
<Position15>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2963" TopLine="2942"/>
</Position15>
<Position16>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2960" TopLine="2942"/>
</Position16>
<Position17>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2961" TopLine="2942"/>
</Position17>
<Position18>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2960" TopLine="2942"/>
</Position18>
<Position19>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2966" TopLine="2942"/>
</Position19>
<Position20>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2968" TopLine="2942"/>
</Position20>
<Position21>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2984" Column="29" TopLine="2952"/>
</Position21>
<Position22>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2956" Column="61" TopLine="2928"/>
</Position22>
<Position23>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2950" Column="74" TopLine="2928"/>
</Position23>
<Position24>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2949" TopLine="2928"/>
</Position24>
<Position25>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="2950" TopLine="2928"/>
</Position25>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
<Debugging>
<BreakPoints Count="1">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="../../../../source/uCEFChromiumCore.pas"/>
<Line Value="4373"/>
</Item1>
</BreakPoints>
</Debugging>
</CONFIG>

Binary file not shown.

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="SubProcess_sp"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="CEF4Delphi_Lazarus"/>
</Item1>
</RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="SubProcess_sp.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/SubProcess_sp"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CustomOptions Value="-dUseCThreads"/>
<OtherDefines Count="1">
<Define0 Value="UseCThreads"/>
</OtherDefines>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,71 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
program SubProcess_sp;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
uCEFApplicationCore;
begin
GlobalCEFApp := TCefApplicationCore.Create;
// The main process and the subprocess *MUST* have the same GlobalCEFApp
// properties and events, specially FrameworkDirPath, ResourcesDirPath,
// LocalesDirPath, cache and UserDataPath paths.
// The demos are compiled into the BIN directory. Make sure SubProcess.exe
// and SubProcess_sp.exe are in that directory or this demo won't work.
// In case you want to use custom directories for the CEF3 binaries, cache
// and user data.
{
GlobalCEFApp.FrameworkDirPath := 'cef';
GlobalCEFApp.ResourcesDirPath := 'cef';
GlobalCEFApp.LocalesDirPath := 'cef\locales';
GlobalCEFApp.cache := 'cef\cache';
GlobalCEFApp.UserDataPath := 'cef\User Data';
}
GlobalCEFApp.StartSubProcess;
DestroyGlobalCEFApp;
end.

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="SubProcess_sp.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<TopLine Value="27"/>
<CursorPos Y="70"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="564"/>
<CursorPos X="11" Y="553"/>
<UsageCount Value="10"/>
</Unit1>
</Units>
<OtherDefines Count="1">
<Define0 Value="UseCThreads"/>
</OtherDefines>
<JumpHistory Count="3" HistoryIndex="2">
<Position1>
<Filename Value="SubProcess_sp.lpr"/>
<Caret Line="56" Column="23" TopLine="25"/>
</Position1>
<Position2>
<Filename Value="SubProcess_sp.lpr"/>
<Caret Line="46" Column="22" TopLine="27"/>
</Position2>
<Position3>
<Filename Value="SubProcess_sp.lpr"/>
<Caret Line="69" Column="5" TopLine="26"/>
</Position3>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,456 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2017 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
// The complete list of compiler versions is here :
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
{$DEFINE DELPHI_VERSION_UNKNOW}
// Delphi 5
{$IFDEF VER130}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$ENDIF}
// Delphi 6
{$IFDEF VER140}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$ENDIF}
// Delphi 7
{$IFDEF VER150}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$ENDIF}
// Delphi 8
{$IFDEF VER160}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$ENDIF}
// Delphi 2005
{$IFDEF VER170}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$ENDIF}
{$IFDEF VER180}
{$UNDEF DELPHI_VERSION_UNKNOW}
// Delphi 2007
{$IFDEF VER185}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
// Delphi 2006
{$ELSE}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$ENDIF}
{$ENDIF}
// Delphi 2009
{$IFDEF VER200}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$ENDIF}
//Delphi 2010
{$IFDEF VER210}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$ENDIF}
// Delphi XE
{$IFDEF VER220}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$ENDIF}
// Delphi XE2 (First FireMonkey and 64bit compiler)
{$IFDEF VER230}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$ENDIF}
// Delphi XE3
{$IFDEF VER240}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$ENDIF}
// Delphi XE4
{$IFDEF VER250}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$ENDIF}
// Delphi XE5
{$IFDEF VER260}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$ENDIF}
// Delphi XE6
{$IFDEF VER270}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$ENDIF}
// Delphi XE7
{$IFDEF VER280}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$ENDIF}
// Delphi XE8
{$IFDEF VER290}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$ENDIF VER290}
// Rad Studio 10 - Delphi Seattle
{$IFDEF VER300}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$ENDIF}
// Rad Studio 10.1 - Delphi Berlin
{$IFDEF VER310}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$DEFINE DELPHI24_UP}
{$ENDIF}
// Rad Studio 10.2 - Delphi Tokyo
{$IFDEF VER320}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$DEFINE DELPHI24_UP}
{$DEFINE DELPHI25_UP}
{$ENDIF}
// Rad Studio 10.3 - Delphi Rio
{$IFDEF VER330}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$DEFINE DELPHI24_UP}
{$DEFINE DELPHI25_UP}
{$DEFINE DELPHI26_UP}
{$ENDIF}
// Rad Studio 10.4 - Delphi Sydney
{$IFDEF VER340}
{$UNDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$DEFINE DELPHI24_UP}
{$DEFINE DELPHI25_UP}
{$DEFINE DELPHI26_UP}
{$DEFINE DELPHI27_UP}
{$ENDIF}
{$IFDEF FPC}
{$DEFINE SUPPORTS_INLINE}
{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
{$DEFINE FPC_VER_320}
{$IFEND}
{$ELSE}
{$IFDEF DELPHI_VERSION_UNKNOW}
{$DEFINE DELPHI5_UP}
{$DEFINE DELPHI6_UP}
{$DEFINE DELPHI7_UP}
{$DEFINE DELPHI8_UP}
{$DEFINE DELPHI9_UP}
{$DEFINE DELPHI10_UP}
{$DEFINE DELPHI11_UP}
{$DEFINE DELPHI12_UP}
{$DEFINE DELPHI14_UP}
{$DEFINE DELPHI15_UP}
{$DEFINE DELPHI16_UP}
{$DEFINE DELPHI17_UP}
{$DEFINE DELPHI18_UP}
{$DEFINE DELPHI19_UP}
{$DEFINE DELPHI20_UP}
{$DEFINE DELPHI21_UP}
{$DEFINE DELPHI22_UP}
{$DEFINE DELPHI23_UP}
{$DEFINE DELPHI24_UP}
{$DEFINE DELPHI25_UP}
{$DEFINE DELPHI26_UP}
{$DEFINE DELPHI27_UP}
{$ENDIF}
{$ENDIF}
{$IFDEF DELPHI9_UP}
{$DEFINE SUPPORTS_INLINE}
{$ENDIF}
{$IF DEFINED(CPUX32) OR
DEFINED(CPU386) OR
DEFINED(CPUi386) OR
DEFINED(CPUPOWERPC32) OR
DEFINED(CPUSPARC32) OR
DEFINED(CPU32BITS) OR
DEFINED(CPUARM32) OR
DEFINED(WIN32) OR
DEFINED(IOS32) OR
DEFINED(MACOS32) OR
DEFINED(LINUX32) OR
DEFINED(POSIX32) OR
DEFINED(ANDROID32)}
{$DEFINE TARGET_32BITS}
{$IFEND}

View File

@ -0,0 +1,30 @@
unit Interfaces;
{$mode objfpc}{$H+}
interface
{$IFDEF UNIX}{$IFNDEF DisableCWString}uses cwstring;{$ENDIF}{$ENDIF}
procedure CustomWidgetSetInitialization;
procedure CustomWidgetSetFinalization;
implementation
uses
{$IFNDEF EnableLibOverlay}
gtk2DisableLibOverlay,
{$ENDIF}
Gtk2Int, Forms;
procedure CustomWidgetSetInitialization;
begin
CreateWidgetset(TGtk2WidgetSet);
end;
procedure CustomWidgetSetFinalization;
begin
FreeWidgetSet;
end;
end.

View File

@ -0,0 +1,72 @@
object Form1: TForm1
Left = 424
Height = 589
Top = 232
Width = 967
Caption = 'Initializing browser. Please wait...'
ClientHeight = 589
ClientWidth = 967
OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '2.0.10.0'
object AddressPnl: TPanel
Left = 0
Height = 23
Top = 0
Width = 967
Align = alTop
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 967
Enabled = False
TabOrder = 0
object GoBtn: TButton
Left = 932
Height = 23
Top = 0
Width = 35
Align = alRight
Caption = 'Go'
OnClick = GoBtnClick
TabOrder = 0
end
object AddressEdt: TEdit
Left = 0
Height = 23
Top = 0
Width = 932
Align = alClient
TabOrder = 1
Text = 'https://www.google.com'
end
end
object CEFLinkedWindowParent1: TCEFLinkedWindowParent
Left = 0
Height = 566
Top = 23
Width = 967
Align = alClient
TabStop = True
TabOrder = 1
OnEnter = CEFLinkedWindowParent1Enter
OnExit = CEFLinkedWindowParent1Exit
Chromium = Chromium1
end
object Chromium1: TChromium
OnBeforePopup = Chromium1BeforePopup
OnAfterCreated = Chromium1AfterCreated
OnBeforeClose = Chromium1BeforeClose
OnClose = Chromium1Close
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
Left = 56
Top = 80
end
object Timer1: TTimer
Enabled = False
OnTimer = Timer1Timer
Left = 56
Top = 160
end
end

View File

@ -0,0 +1,268 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uSubProcess;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, LMessages,
uCEFChromium, uCEFWindowParent, uCEFConstants, uCEFTypes, uCEFInterfaces,
uCEFChromiumEvents, uCEFLinkedWindowParent;
type
{ TForm1 }
TForm1 = class(TForm)
AddressEdt: TEdit;
CEFLinkedWindowParent1: TCEFLinkedWindowParent;
GoBtn: TButton;
Chromium1: TChromium;
AddressPnl: TPanel;
Timer1: TTimer;
procedure CEFLinkedWindowParent1Enter(Sender: TObject);
procedure CEFLinkedWindowParent1Exit(Sender: TObject);
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
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 Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure GoBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
protected
// Variables to control when can we destroy the form safely
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
FClosing : boolean; // Set to True in the CloseQuery event.
// CEF needs to handle these messages to call TChromium.NotifyMoveOrResizeStarted
procedure WMMove(var Message: TLMMove); message LM_MOVE;
procedure WMSize(var Message: TLMSize); message LM_SIZE;
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
procedure SendCompMessage(aMsg : cardinal);
procedure BrowserCreatedMsg(Data: PtrInt);
procedure BrowserCloseFormMsg(Data: PtrInt);
public
end;
var
Form1: TForm1;
procedure CreateGlobalCEFApp;
implementation
{$R *.lfm}
// This is a demo based on the SimpleBrowser2 demo but it uses a different
// executable for the Chromium subprocesses.
// Before running this demo you need to build the "SubProcess_sp.lpr" project.
// Destruction steps
// =================
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
// 2. TChromium.OnClose sets aAction to cbaClose to destroy the browser, which triggers the TChromium.OnBeforeClose event.
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends CEF_BEFORECLOSE to close the form.
uses
uCEFApplication;
{ TForm1 }
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.BrowserSubprocessPath := 'SubProcess_sp'; // This is the name of the executable used by CEF for the Chromium subprocesses
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FCanClose := False;
FClosing := False;
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
end;
procedure TForm1.GoBtnClick(Sender: TObject);
begin
Chromium1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
if not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) and
not(Chromium1.Initialized) then
Timer1.Enabled := True;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
CanClose := FCanClose;
if not(FClosing) then
begin
FClosing := True;
Visible := False;
Chromium1.CloseBrowser(True);
end;
end;
procedure TForm1.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);
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;
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out
Result: Boolean);
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;
procedure TForm1.FormActivate(Sender: TObject);
begin
// You *MUST* call CreateBrowser to create and initialize the browser.
// This will trigger the AfterCreated event when the browser is fully
// initialized and ready to receive commands.
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
// If it's not initialized yet, we use a simple timer to create the browser later.
// Linux needs a visible form to create a browser so we need to use the
// TForm.OnActivate event instead of the TForm.OnShow event
if not(Chromium1.Initialized) and
not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) then
Timer1.Enabled := True;
end;
procedure TForm1.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
begin
// continue closing the browser
aAction := cbaClose;
end;
procedure TForm1.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
begin
// We must wait until all browsers trigger the TChromium.OnBeforeClose event
// in order to close the application safely or we will have shutdown issues.
FCanClose := True;
SendCompMessage(CEF_BEFORECLOSE);
end;
procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
begin
// Now the browser is fully initialized we can initialize the UI.
SendCompMessage(CEF_AFTERCREATED);
end;
procedure TForm1.CEFLinkedWindowParent1Enter(Sender: TObject);
begin
If not(csDesigning in ComponentState) then Chromium1.SetFocus(True);
end;
procedure TForm1.CEFLinkedWindowParent1Exit(Sender: TObject);
begin
if not(csDesigning in ComponentState) then Chromium1.SendCaptureLostEvent;
end;
procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
begin
Caption := 'SubProcess Browser';
AddressPnl.Enabled := True;
end;
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
begin
Close;
end;
procedure TForm1.SendCompMessage(aMsg : cardinal);
begin
case aMsg of
CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreatedMsg, 0);
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
end;
end;
procedure TForm1.WMMove(var Message: TLMMove);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.WMSize(var Message: TLMSize);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.WMWindowPosChanged(var Message: TLMWindowPosChanged);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
end.

View File

@ -588,7 +588,7 @@ uses
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils, Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils,
{$IFDEF FPC} {$IFDEF FPC}
{$IFDEF MSWINDOWS}jwatlhelp32, jwapsapi,{$ENDIF} {$IFDEF MSWINDOWS}jwatlhelp32, jwapsapi,{$ENDIF}
{$IFDEF LINUX}lcltype, Forms,{$ENDIF} {$IFDEF LINUX}lcltype, Forms, InterfaceBase,{$ENDIF}
{$ELSE} {$ELSE}
TlHelp32, {$IFDEF MSWINDOWS}PSAPI,{$ENDIF} TlHelp32, {$IFDEF MSWINDOWS}PSAPI,{$ENDIF}
{$ENDIF} {$ENDIF}
@ -1483,7 +1483,12 @@ begin
MessageBox(0, PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK or MB_TOPMOST); MessageBox(0, PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK or MB_TOPMOST);
{$ELSE} {$ELSE}
{$IFDEF LINUX} {$IFDEF LINUX}
Application.MessageBox(PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK); {$IFDEF FPC}
if (WidgetSet <> nil) then
Application.MessageBox(PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK)
else
ShowX11Message(aError);
{$ENDIF}
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}
end; end;

View File

@ -60,10 +60,10 @@ uses
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF}
{$IFDEF DELPHI14_UP}Types, IOUtils,{$ENDIF} Classes, SysUtils, Math, {$IFDEF DELPHI14_UP}Types, IOUtils,{$ENDIF} Classes, SysUtils, Math,
{$IFDEF FPC}LCLType,{$IFNDEF MSWINDOWS}InterfaceBase, Forms,{$ENDIF}{$ENDIF} {$IFDEF FPC}LCLType,{$IFNDEF MSWINDOWS}InterfaceBase, Forms,{$ENDIF}{$ENDIF}
{$IFDEF LINUX}{$IFDEF FPC}{$IFDEF LCLGTK2} {$IFDEF LINUX}{$IFDEF FPC}
ctypes, keysym, gtk2, glib2, gdk2, gtk2proc, gtk2int, xf86keysym, ctypes, keysym, xf86keysym, x, xlib,
Gtk2Def, gdk2x, Gtk2Extra, {$IFDEF LCLGTK2}gtk2, glib2, gdk2, gtk2proc, gtk2int, Gtk2Def, gdk2x, Gtk2Extra,{$ENDIF}
{$ENDIF}{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
{$ENDIF} {$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler, uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
uCEFRegisterCDMCallback, uCEFConstants; uCEFRegisterCDMCallback, uCEFConstants;
@ -316,7 +316,9 @@ function GetCefStateModifiers(state : cuint) : integer;
function GdkEventToWindowsKeyCode(Event: PGdkEventKey) : integer; function GdkEventToWindowsKeyCode(Event: PGdkEventKey) : integer;
function GetWindowsKeyCodeWithoutLocation(key_code : integer) : integer; function GetWindowsKeyCodeWithoutLocation(key_code : integer) : integer;
function GetControlCharacter(windows_key_code : integer; shift : boolean) : integer; function GetControlCharacter(windows_key_code : integer; shift : boolean) : integer;
{$ENDIF}{$ENDIF}{$ENDIF} {$ENDIF}
procedure ShowX11Message(const aMessage : string);
{$ENDIF}{$ENDIF}
implementation implementation
@ -2934,6 +2936,55 @@ begin
else else
aCEFKeyEvent.character := aCEFKeyEvent.unmodified_character; aCEFKeyEvent.character := aCEFKeyEvent.unmodified_character;
end; end;
// This function is almost an identical copy of "ModalShowX11Window" available
// at https://wiki.lazarus.freepascal.org/X11
procedure ShowX11Message(const aMessage : string);
var
TempDisplay : PDisplay;
TempWindow : TWindow;
TempEvent : TXEvent;
TempMessage : PChar;
TempScreen : cint;
begin
TempMessage := PChar(trim(copy(aMessage, 1, pred(pos(#13, aMessage)))));
TempDisplay := XOpenDisplay(nil);
if (TempDisplay = nil) then
begin
WriteLn(aMessage);
exit;
end;
TempScreen := DefaultScreen(TempDisplay);
TempWindow := XCreateSimpleWindow(TempDisplay,
RootWindow(TempDisplay, TempScreen),
10, 10, 200, 100, 1,
BlackPixel(TempDisplay, TempScreen),
WhitePixel(TempDisplay, TempScreen));
XSelectInput(TempDisplay, TempWindow, ExposureMask or KeyPressMask);
XMapWindow(TempDisplay, TempWindow);
while (True) do
begin
XNextEvent(TempDisplay, @TempEvent);
if (TempEvent._type = Expose) then
XDrawString(TempDisplay,
TempWindow,
DefaultGC(TempDisplay, TempScreen),
40, 50,
TempMessage,
strlen(TempMessage));
if (TempEvent._type = KeyPress) then Break;
end;
XCloseDisplay(TempDisplay);
end;
{$ENDIF}{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}{$ENDIF}
end. end.

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 214, "InternalVersion" : 215,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "87.1.12.0" "Version" : "87.1.12.0"
} }