1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-13 10:22:04 +02:00

Added a preliminary version of the OSRExternalPumpBrowser for Linux

This commit is contained in:
Salvador Diaz Fau 2021-01-11 17:43:28 +01:00
parent 62753fa7f9
commit 1fca56f298
14 changed files with 2602 additions and 1 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,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="OSRExternalPumpBrowser"/>
<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="OSRExternalPumpBrowser.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uOSRExternalPumpBrowser"/>
</Unit1>
<Unit2>
<Filename Value="interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Interfaces"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/OSRExternalPumpBrowser"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dUseCthreads"/>
<OtherDefines Count="2">
<Define0 Value="UseCthreads"/>
<Define1 Value="EnabledGtkThreading"/>
</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,79 @@
// ************************************************************************
// ***************************** 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 OSRExternalPumpBrowser;
{$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, uOSRExternalPumpBrowser,
{ you can add units after this }
uCEFApplication, uCEFWorkScheduler;
{$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;
// The form needs to be destroyed *BEFORE* stopping the scheduler.
Form1.Free;
GlobalCEFWorkScheduler.StopScheduler;
CustomWidgetSetFinalization;
end;
DestroyGlobalCEFApp;
DestroyGlobalCEFWorkScheduler;
end.

View File

@ -0,0 +1,832 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="108">
<Unit0>
<Filename Value="OSRExternalPumpBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="30"/>
<CursorPos X="37" Y="51"/>
<UsageCount Value="82"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uOSRExternalPumpBrowser"/>
<IsVisibleTab Value="True"/>
<TopLine Value="221"/>
<CursorPos X="43" Y="250"/>
<UsageCount Value="82"/>
<Bookmarks Count="2">
<Item0 X="47" Y="222" ID="2"/>
<Item1 X="76" Y="520" ID="6"/>
</Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="interfaces.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Interfaces"/>
<EditorIndex Value="-1"/>
<CursorPos X="40" Y="20"/>
<UsageCount Value="78"/>
</Unit2>
<Unit3>
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lcltype.pp"/>
<UnitName Value="LCLType"/>
<EditorIndex Value="-1"/>
<TopLine Value="52"/>
<CursorPos X="3" Y="68"/>
<UsageCount Value="7"/>
</Unit3>
<Unit4>
<Filename Value="../../../../source/uCEFMiscFunctions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1889"/>
<CursorPos X="27" Y="1907"/>
<UsageCount Value="7"/>
</Unit4>
<Unit5>
<Filename Value="../../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="432"/>
<CursorPos X="29" Y="445"/>
<UsageCount Value="7"/>
</Unit5>
<Unit6>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/objpas/sysutils/finah.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="5"/>
<CursorPos X="10" Y="28"/>
<UsageCount Value="9"/>
</Unit6>
<Unit7>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/interfaces.pas"/>
<UnitName Value="Interfaces"/>
<EditorIndex Value="-1"/>
<CursorPos X="26" Y="25"/>
<UsageCount Value="7"/>
</Unit7>
<Unit8>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2disableliboverlay.pas"/>
<UnitName Value="gtk2DisableLibOverlay"/>
<EditorIndex Value="-1"/>
<UsageCount Value="7"/>
</Unit8>
<Unit9>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/winapi.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="290"/>
<CursorPos X="3" Y="292"/>
<UsageCount Value="9"/>
</Unit9>
<Unit10>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="184"/>
<CursorPos X="22" Y="211"/>
<UsageCount Value="15"/>
</Unit10>
<Unit11>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2int.pas"/>
<UnitName Value="Gtk2Int"/>
<EditorIndex Value="-1"/>
<TopLine Value="295"/>
<CursorPos X="72" Y="304"/>
<UsageCount Value="10"/>
</Unit11>
<Unit12>
<Filename Value="../../../source/uCEFChromium.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="62"/>
<CursorPos X="17" Y="86"/>
<UsageCount Value="8"/>
</Unit12>
<Unit13>
<Filename Value="../../../source/uCEFConstants.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="592"/>
<CursorPos X="70" Y="622"/>
<UsageCount Value="11"/>
</Unit13>
<Unit14>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/rasterimage.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="744"/>
<CursorPos X="3" Y="748"/>
<UsageCount Value="11"/>
</Unit14>
<Unit15>
<Filename Value="../../../source/uCEFBufferPanel.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="1043"/>
<CursorPos X="3" Y="71"/>
<UsageCount Value="29"/>
<Bookmarks Count="4">
<Item0 Y="1010" ID="9"/>
<Item1 X="63" Y="581" ID="8"/>
<Item2 X="5" Y="345" ID="7"/>
<Item3 X="5" Y="375" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit15>
<Unit16>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="-1"/>
<TopLine Value="684"/>
<CursorPos X="31" Y="711"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="340"/>
<CursorPos X="40" Y="377"/>
<UsageCount Value="10"/>
<Bookmarks Count="1">
<Item0 X="3" Y="2235" ID="3"/>
</Bookmarks>
</Unit17>
<Unit18>
<Filename Value="../../../source/uCEFApplication.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="9"/>
</Unit18>
<Unit19>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/fcl-base/src/syncobjs.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="122"/>
<CursorPos X="54" Y="146"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/threadh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="117"/>
<CursorPos X="11" Y="149"/>
<UsageCount Value="10"/>
</Unit20>
<Unit21>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/thread.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="220"/>
<CursorPos X="3" Y="223"/>
<UsageCount Value="10"/>
</Unit21>
<Unit22>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/controls.pp"/>
<UnitName Value="Controls"/>
<EditorIndex Value="-1"/>
<TopLine Value="1718"/>
<CursorPos X="29" Y="1745"/>
<UsageCount Value="16"/>
</Unit22>
<Unit23>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/extctrls.pp"/>
<UnitName Value="ExtCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="1025"/>
<CursorPos X="3" Y="1046"/>
<UsageCount Value="12"/>
</Unit23>
<Unit24>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="-1"/>
<TopLine Value="1218"/>
<CursorPos X="14" Y="1240"/>
<UsageCount Value="15"/>
</Unit24>
<Unit25>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/canvas.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="996"/>
<CursorPos X="3" Y="1004"/>
<UsageCount Value="9"/>
</Unit25>
<Unit26>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/fcl-image/src/fpcanvas.pp"/>
<UnitName Value="FPCanvas"/>
<EditorIndex Value="-1"/>
<TopLine Value="240"/>
<CursorPos X="15" Y="277"/>
<UsageCount Value="7"/>
</Unit26>
<Unit27>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/fcl-image/src/fpcanvas.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="575"/>
<CursorPos X="3" Y="578"/>
<UsageCount Value="7"/>
</Unit27>
<Unit28>
<Filename Value="../../../../../.cache/.fr-A0S8PI/gtk2_thread/unit1.pas"/>
<UnitName Value="Unit1"/>
<EditorIndex Value="-1"/>
<TopLine Value="72"/>
<UsageCount Value="7"/>
</Unit28>
<Unit29>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lclproc.pas"/>
<UnitName Value="LCLProc"/>
<EditorIndex Value="-1"/>
<UsageCount Value="7"/>
</Unit29>
<Unit30>
<Filename Value="/usr/share/lazarus/2.0.10/ide/lazarus.pp"/>
<UnitName Value="Lazarus"/>
<EditorIndex Value="-1"/>
<TopLine Value="124"/>
<CursorPos Y="165"/>
<UsageCount Value="7"/>
</Unit30>
<Unit31>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/custombitmap.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="51"/>
<CursorPos X="3" Y="62"/>
<UsageCount Value="7"/>
</Unit31>
<Unit32>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/graphtype.pp"/>
<UnitName Value="GraphType"/>
<EditorIndex Value="-1"/>
<TopLine Value="185"/>
<CursorPos X="3" Y="197"/>
<UsageCount Value="12"/>
</Unit32>
<Unit33>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/systemh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1494"/>
<CursorPos X="19" Y="1526"/>
<UsageCount Value="8"/>
</Unit33>
<Unit34>
<Filename Value="../../../../../Descargas/bgrabitmap-master/bgrabitmap/bgralclbitmap.pas"/>
<UnitName Value="BGRALCLBitmap"/>
<EditorIndex Value="-1"/>
<CursorPos X="123" Y="18"/>
<UsageCount Value="7"/>
</Unit34>
<Unit35>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfacebase.pp"/>
<UnitName Value="InterfaceBase"/>
<EditorIndex Value="-1"/>
<TopLine Value="113"/>
<CursorPos X="3" Y="122"/>
<UsageCount Value="10"/>
</Unit35>
<Unit36>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/lclintf.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="450"/>
<CursorPos Y="474"/>
<UsageCount Value="7"/>
</Unit36>
<Unit37>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2winapi.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7097"/>
<CursorPos X="15" Y="7124"/>
<UsageCount Value="9"/>
</Unit37>
<Unit38>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2widgetset.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1359"/>
<CursorPos X="31" Y="1401"/>
<UsageCount Value="12"/>
</Unit38>
<Unit39>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2devicecontext.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="759"/>
<CursorPos X="3" Y="767"/>
<UsageCount Value="9"/>
</Unit39>
<Unit40>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/graphic.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="124"/>
<CursorPos X="30" Y="130"/>
<UsageCount Value="11"/>
</Unit40>
<Unit41>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/fpimagebitmap.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="140"/>
<CursorPos X="3" Y="165"/>
<UsageCount Value="11"/>
</Unit41>
<Unit42>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/intfgraphics.pas"/>
<UnitName Value="IntfGraphics"/>
<EditorIndex Value="-1"/>
<TopLine Value="3644"/>
<CursorPos X="3" Y="3649"/>
<UsageCount Value="11"/>
</Unit42>
<Unit43>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="3393"/>
<CursorPos X="3" Y="3399"/>
<UsageCount Value="11"/>
</Unit43>
<Unit44>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/monitor.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos Y="34"/>
<UsageCount Value="8"/>
</Unit44>
<Unit45>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/winapih.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="76"/>
<CursorPos X="10" Y="103"/>
<UsageCount Value="9"/>
</Unit45>
<Unit46>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/screen.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="797"/>
<CursorPos X="3" Y="801"/>
<UsageCount Value="8"/>
</Unit46>
<Unit47>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/customdesigncontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="61"/>
<CursorPos X="3" Y="74"/>
<UsageCount Value="8"/>
</Unit47>
<Unit48>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/font.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="610"/>
<CursorPos X="3" Y="622"/>
<UsageCount Value="8"/>
</Unit48>
<Unit49>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lcltype.pp"/>
<UnitName Value="LCLType"/>
<EditorIndex Value="-1"/>
<TopLine Value="1293"/>
<CursorPos X="3" Y="1320"/>
<UsageCount Value="9"/>
</Unit49>
<Unit50>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/customimage.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="242"/>
<CursorPos X="3" Y="251"/>
<UsageCount Value="8"/>
</Unit50>
<Unit51>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/objpas/classes/classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2234"/>
<CursorPos X="3" Y="2263"/>
<UsageCount Value="9"/>
</Unit51>
<Unit52>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1122"/>
<CursorPos Y="1147"/>
<UsageCount Value="10"/>
</Unit52>
<Unit53>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/wincontrol.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7177"/>
<CursorPos Y="7204"/>
<UsageCount Value="13"/>
</Unit53>
<Unit54>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/objpas.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="618"/>
<CursorPos Y="638"/>
<UsageCount Value="12"/>
</Unit54>
<Unit55>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lmessages.pp"/>
<UnitName Value="LMessages"/>
<EditorIndex Value="-1"/>
<TopLine Value="294"/>
<CursorPos X="3" Y="308"/>
<UsageCount Value="9"/>
</Unit55>
<Unit56>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lclmessageglue.pas"/>
<UnitName Value="LCLMessageGlue"/>
<EditorIndex Value="-1"/>
<TopLine Value="88"/>
<CursorPos X="3" Y="92"/>
<UsageCount Value="9"/>
</Unit56>
<Unit57>
<Filename Value="../../Delphi_VCL/SimpleOSRBrowser/uSimpleOSRBrowser.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="262"/>
<CursorPos X="3" Y="267"/>
<UsageCount Value="11"/>
</Unit57>
<Unit58>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/application.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="230"/>
<CursorPos X="3" Y="235"/>
<UsageCount Value="8"/>
</Unit58>
<Unit59>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/dialogs.pp"/>
<UnitName Value="Dialogs"/>
<EditorIndex Value="-1"/>
<TopLine Value="846"/>
<CursorPos X="10" Y="848"/>
<UsageCount Value="8"/>
</Unit59>
<Unit60>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk3/gtk3bindings/lazgio2.pas"/>
<UnitName Value="LazGio2"/>
<EditorIndex Value="-1"/>
<TopLine Value="1299"/>
<CursorPos X="18" Y="1336"/>
<UsageCount Value="8"/>
</Unit60>
<Unit61>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/objpas/sysutils/fina.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="134"/>
<CursorPos Y="141"/>
<UsageCount Value="9"/>
</Unit61>
<Unit62>
<Filename Value="../../../source/uCEFLibFunctions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="60"/>
<CursorPos X="3" Y="113"/>
<UsageCount Value="9"/>
</Unit62>
<Unit63>
<Filename Value="/usr/share/fpcsrc/3.2.0/tests/bench/shootout/src/chameneos.pp"/>
<EditorIndex Value="-1"/>
<CursorPos X="39" Y="31"/>
<UsageCount Value="9"/>
</Unit63>
<Unit64>
<Filename Value="../../Lazarus_Windows/SimpleOSRBrowser/usimplelazosrbrowser.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="973"/>
<CursorPos X="131" Y="1002"/>
<UsageCount Value="8"/>
</Unit64>
<Unit65>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkwidgetset.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="133"/>
<CursorPos X="11" Y="179"/>
<UsageCount Value="10"/>
</Unit65>
<Unit66>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkproc.pp"/>
<UnitName Value="GTKProc"/>
<EditorIndex Value="-1"/>
<TopLine Value="99"/>
<CursorPos X="10" Y="126"/>
<UsageCount Value="10"/>
</Unit66>
<Unit67>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkcallback.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="878"/>
<CursorPos Y="880"/>
<UsageCount Value="10"/>
</Unit67>
<Unit68>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkproc.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1935"/>
<CursorPos Y="2265"/>
<UsageCount Value="10"/>
</Unit68>
<Unit69>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2proc.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="8852"/>
<CursorPos X="37" Y="8887"/>
<UsageCount Value="11"/>
<Bookmarks Count="2">
<Item0 X="91" Y="1895" ID="1"/>
<Item1 X="42" Y="2240" ID="2"/>
</Bookmarks>
</Unit69>
<Unit70>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2proc.pp"/>
<UnitName Value="Gtk2Proc"/>
<EditorIndex Value="-1"/>
<TopLine Value="697"/>
<CursorPos X="11" Y="724"/>
<UsageCount Value="12"/>
</Unit70>
<Unit71>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk1/src/gdk/gdktypes.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="903"/>
<CursorPos X="6" Y="930"/>
<UsageCount Value="10"/>
</Unit71>
<Unit72>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2callback.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="760"/>
<CursorPos Y="768"/>
<UsageCount Value="11"/>
</Unit72>
<Unit73>
<Filename Value="../../../../test-0006/ucefgdkconstants.pas"/>
<UnitName Value="uCEFGDKConstants"/>
<EditorIndex Value="-1"/>
<CursorPos X="22" Y="8"/>
<UsageCount Value="9"/>
</Unit73>
<Unit74>
<Filename Value="../../../../test-0006/ucefgdkmiscfunctions.pas"/>
<UnitName Value="uCEFGDKMiscFunctions"/>
<EditorIndex Value="-1"/>
<CursorPos X="22" Y="8"/>
<UsageCount Value="9"/>
</Unit74>
<Unit75>
<Filename Value="../../../../test-0006/unit1.pas"/>
<UnitName Value="Unit1"/>
<EditorIndex Value="-1"/>
<TopLine Value="24"/>
<CursorPos X="3" Y="38"/>
<UsageCount Value="9"/>
</Unit75>
<Unit76>
<Filename Value="../../../source/uCEFTypes.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1243"/>
<CursorPos X="9" Y="1271"/>
<UsageCount Value="9"/>
</Unit76>
<Unit77>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/objpash.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="179"/>
<CursorPos X="23" Y="206"/>
<UsageCount Value="9"/>
</Unit77>
<Unit78>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/libc/src/pthread.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="68"/>
<UsageCount Value="10"/>
</Unit78>
<Unit79>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/libc/src/pthreadh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos X="10" Y="102"/>
<UsageCount Value="9"/>
</Unit79>
<Unit80>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/unix/cthreads.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="347"/>
<CursorPos X="14" Y="642"/>
<UsageCount Value="9"/>
</Unit80>
<Unit81>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/linux/pthread.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="279"/>
<CursorPos X="11" Y="306"/>
<UsageCount Value="9"/>
</Unit81>
<Unit82>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/libmicrohttpd/examples/event_and_thread.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="3"/>
<CursorPos X="62" Y="48"/>
<UsageCount Value="10"/>
</Unit82>
<Unit83>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/linux/sysosh.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="14" Y="26"/>
<UsageCount Value="10"/>
</Unit83>
<Unit84>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/lclintf.pas"/>
<UnitName Value="LCLIntf"/>
<EditorIndex Value="-1"/>
<TopLine Value="198"/>
<UsageCount Value="9"/>
</Unit84>
<Unit85>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2def.pp"/>
<UnitName Value="Gtk2Def"/>
<EditorIndex Value="-1"/>
<TopLine Value="366"/>
<CursorPos X="14" Y="394"/>
<UsageCount Value="9"/>
</Unit85>
<Unit86>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/gtk+/gdk/gdk2.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="162"/>
<CursorPos X="11" Y="189"/>
<UsageCount Value="9"/>
</Unit86>
<Unit87>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/glib/gthread.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="91"/>
<CursorPos X="11" Y="119"/>
<UsageCount Value="9"/>
</Unit87>
<Unit88>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/glib/glib2.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="158"/>
<CursorPos X="11" Y="186"/>
<UsageCount Value="9"/>
</Unit88>
<Unit89>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/laztracer.pas"/>
<UnitName Value="LazTracer"/>
<EditorIndex Value="-1"/>
<TopLine Value="3"/>
<CursorPos Y="50"/>
<UsageCount Value="9"/>
</Unit89>
<Unit90>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk2/gtk2defines.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="47"/>
<CursorPos X="10" Y="93"/>
<UsageCount Value="9"/>
</Unit90>
<Unit91>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkdefines.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="44"/>
<CursorPos X="10" Y="96"/>
<UsageCount Value="9"/>
</Unit91>
<Unit92>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/interfaces/gtk/gtkwinapi.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7515"/>
<CursorPos X="15" Y="7542"/>
<UsageCount Value="9"/>
</Unit92>
<Unit93>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/bitmapcanvas.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7"/>
<CursorPos X="57" Y="31"/>
<UsageCount Value="9"/>
</Unit93>
<Unit94>
<Filename Value="../../../source/uCEFBitmapBitBuffer.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="153"/>
<CursorPos X="58" Y="183"/>
<UsageCount Value="13"/>
</Unit94>
<Unit95>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/LazLoggerIntf.inc"/>
<EditorIndex Value="-1"/>
<CursorPos X="11" Y="3"/>
<UsageCount Value="9"/>
</Unit95>
<Unit96>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/LazLoggerImpl.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="16"/>
<CursorPos X="3" Y="18"/>
<UsageCount Value="9"/>
</Unit96>
<Unit97>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/lazloggerbase.pas"/>
<UnitName Value="LazLoggerBase"/>
<EditorIndex Value="-1"/>
<TopLine Value="666"/>
<CursorPos X="134" Y="689"/>
<UsageCount Value="9"/>
</Unit97>
<Unit98>
<Filename Value="/usr/share/lazarus/2.0.10/test/lazutils/testlazloggercase.pas"/>
<UnitName Value="TestLazLoggerCase"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<CursorPos X="55" Y="47"/>
<UsageCount Value="9"/>
</Unit98>
<Unit99>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/customform.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="2389"/>
<CursorPos X="3" Y="2393"/>
<UsageCount Value="9"/>
</Unit99>
<Unit100>
<Filename Value="/usr/share/lazarus/2.0.10/components/lazutils/maps.pp"/>
<UnitName Value="Maps"/>
<EditorIndex Value="-1"/>
<TopLine Value="323"/>
<CursorPos Y="357"/>
<UsageCount Value="11"/>
</Unit100>
<Unit101>
<Filename Value="../../../source/uCEFUrlRequestClientComponent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="175"/>
<UsageCount Value="10"/>
</Unit101>
<Unit102>
<Filename Value="../../../source/uCEFUrlrequestClient.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="55"/>
<UsageCount Value="10"/>
</Unit102>
<Unit103>
<Filename Value="../../../source/uCEFServerEvents.pas"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
</Unit103>
<Unit104>
<Filename Value="../../../source/uCEFServerComponent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="329"/>
<UsageCount Value="10"/>
</Unit104>
<Unit105>
<Filename Value="../../../source/uCEFSentinel.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="73"/>
<CursorPos X="24" Y="101"/>
<UsageCount Value="10"/>
</Unit105>
<Unit106>
<Filename Value="../../../source/uCEFWorkScheduler.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="81"/>
<CursorPos X="17" Y="84"/>
<UsageCount Value="10"/>
</Unit106>
<Unit107>
<Filename Value="../../../source/uCEFLinkedWindowParent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="56"/>
<CursorPos X="77" Y="127"/>
<UsageCount Value="10"/>
</Unit107>
</Units>
<OtherDefines Count="2">
<Define0 Value="UseCthreads"/>
<Define1 Value="EnabledGtkThreading"/>
</OtherDefines>
<JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="56" Column="63" TopLine="51"/>
</Position1>
<Position2>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="234" TopLine="223"/>
</Position2>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
<Debugging>
<Watches Count="2">
<Item1>
<Expression Value="width"/>
</Item1>
<Item2>
<Expression Value="FBitmap.PixelFormat"/>
</Item2>
</Watches>
</Debugging>
</CONFIG>

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="OSRExternalPumpBrowser_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="OSRExternalPumpBrowser_sp.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="../../../bin/OSRExternalPumpBrowser_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,75 @@
// ************************************************************************
// ***************************** 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 OSRExternalPumpBrowser_sp;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
uCEFApplicationCore;
begin
GlobalCEFApp := TCefApplicationCore.Create;
GlobalCEFApp.WindowlessRenderingEnabled := True;
GlobalCEFApp.EnableHighDPISupport := True;
GlobalCEFApp.ExternalMessagePump := True;
GlobalCEFApp.MultiThreadedMessageLoop := False;
// 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 OSRExternalPumpBrowser
// and OSRExternalPumpBrowser_sp are in that directory or this demo won't work.
// In case you want to use custom directories for the CEF 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,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="OSRExternalPumpBrowser_sp.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<TopLine Value="28"/>
<CursorPos Y="54"/>
<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="4" HistoryIndex="3">
<Position1>
<Filename Value="OSRExternalPumpBrowser_sp.lpr"/>
<Caret Line="56" Column="23" TopLine="25"/>
</Position1>
<Position2>
<Filename Value="OSRExternalPumpBrowser_sp.lpr"/>
<Caret Line="46" Column="22" TopLine="27"/>
</Position2>
<Position3>
<Filename Value="OSRExternalPumpBrowser_sp.lpr"/>
<Caret Line="69" Column="5" TopLine="26"/>
</Position3>
<Position4>
<Filename Value="OSRExternalPumpBrowser_sp.lpr"/>
<Caret Line="49" Column="43" TopLine="29"/>
</Position4>
</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,116 @@
object Form1: TForm1
Left = 518
Height = 630
Top = 252
Width = 1000
Caption = ' Initializing browser. Please wait...'
ClientHeight = 630
ClientWidth = 1000
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
OnHide = FormHide
OnShow = FormShow
LCLVersion = '2.0.10.0'
object AddressPnl: TPanel
Left = 0
Height = 30
Top = 0
Width = 1000
Align = alTop
ClientHeight = 30
ClientWidth = 1000
TabOrder = 0
object AddressEdt: TEdit
Left = 1
Height = 28
Top = 1
Width = 932
Align = alClient
OnEnter = AddressEdtEnter
TabOrder = 0
Text = 'https://www.google.com'
end
object Panel2: TPanel
Left = 933
Height = 28
Top = 1
Width = 66
Align = alRight
ClientHeight = 28
ClientWidth = 66
TabOrder = 1
object GoBtn: TButton
Left = 1
Height = 26
Top = 1
Width = 31
Align = alLeft
Caption = 'Go'
OnClick = GoBtnClick
OnEnter = GoBtnEnter
TabOrder = 0
end
object SnapshotBtn: TButton
Left = 34
Height = 26
Top = 1
Width = 31
Align = alRight
Caption = 'µ'
Font.Height = -24
Font.Name = 'Webdings'
OnClick = SnapshotBtnClick
OnEnter = GoBtnEnter
ParentFont = False
TabOrder = 1
end
end
end
object Panel1: TBufferPanel
Left = 0
Height = 600
Top = 30
Width = 1000
Align = alClient
Caption = 'Panel1'
TabOrder = 1
OnClick = Panel1Click
OnEnter = Panel1Enter
OnExit = Panel1Exit
OnMouseDown = Panel1MouseDown
OnMouseMove = Panel1MouseMove
OnMouseUp = Panel1MouseUp
OnMouseWheel = Panel1MouseWheel
OnResize = Panel1Resize
end
object Chromium1: TChromium
OnTooltip = Chromium1Tooltip
OnCursorChange = Chromium1CursorChange
OnBeforePopup = Chromium1BeforePopup
OnAfterCreated = Chromium1AfterCreated
OnBeforeClose = Chromium1BeforeClose
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
OnGetViewRect = Chromium1GetViewRect
OnGetScreenPoint = Chromium1GetScreenPoint
OnGetScreenInfo = Chromium1GetScreenInfo
OnPopupShow = Chromium1PopupShow
OnPopupSize = Chromium1PopupSize
OnPaint = Chromium1Paint
Left = 48
Top = 72
end
object Timer1: TTimer
Enabled = False
OnTimer = Timer1Timer
Left = 48
Top = 144
end
object SaveDialog1: TSaveDialog
Title = 'Save screenshot bitmap as'
DefaultExt = '.bmp'
Filter = 'Bitmap file|*.bmp'
Left = 48
Top = 216
end
end

View File

@ -0,0 +1,799 @@
// ************************************************************************
// ***************************** 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 © 2021 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 uOSRExternalPumpBrowser;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
LCLType, ComCtrls, Types, SyncObjs,
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
uCEFChromiumEvents;
type
{ TForm1 }
TForm1 = class(TForm)
AddressEdt: TEdit;
SaveDialog1: TSaveDialog;
SnapshotBtn: TButton;
GoBtn: TButton;
Panel1: TBufferPanel;
Chromium1: TChromium;
AddressPnl: TPanel;
Panel2: TPanel;
Timer1: TTimer;
procedure Panel1Click(Sender: TObject);
procedure Panel1Enter(Sender: TObject);
procedure Panel1Exit(Sender: TObject);
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure Panel1Resize(Sender: TObject);
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
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 Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
procedure Chromium1GetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
procedure Chromium1GetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
procedure Chromium1Paint(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer);
procedure Chromium1PopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
procedure Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure GoBtnClick(Sender: TObject);
procedure GoBtnEnter(Sender: TObject);
procedure SnapshotBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure AddressEdtEnter(Sender: TObject);
private
protected
FPopUpRect : TRect;
FShowPopUp : boolean;
FResizing : boolean;
FPendingResize : boolean;
FCanClose : boolean;
FClosing : boolean;
FResizeCS : TCriticalSection;
FBrowserCS : TCriticalSection;
FPanelCursor : TCursor;
FPanelHint : ustring;
function GetPanelCursor : TCursor;
function GetPanelHint : ustring;
procedure SetPanelCursor(aValue : TCursor);
procedure SetPanelHint(const aValue : ustring);
procedure SendCompMessage(aMsg : cardinal);
function getModifiers(Shift: TShiftState): TCefEventFlags;
function GetButton(Button: TMouseButton): TCefMouseButtonType;
procedure DoResize;
procedure BrowserCreatedMsg(Data: PtrInt);
procedure BrowserCloseFormMsg(Data: PtrInt);
procedure PendingResizeMsg(Data: PtrInt);
procedure PendingInvalidateMsg(Data: PtrInt);
procedure PendingCursorUpdateMsg(Data: PtrInt);
procedure PendingHintUpdateMsg(Data: PtrInt);
property PanelCursor : TCursor read GetPanelCursor write SetPanelCursor;
property PanelHint : ustring read GetPanelHint write SetPanelHint;
public
procedure SendCEFKeyEvent(const aCefEvent : TCefKeyEvent);
end;
var
Form1: TForm1;
procedure CreateGlobalCEFApp;
implementation
{$R *.lfm}
// This is a simple CEF browser in "off-screen rendering" mode (a.k.a OSR mode)
// with a different executable for the Chromium subprocesses and an external
// message pump
// Chromium needs the key press data available in the GDK signals
// "key-press-event" and "key-release-event" but Lazarus doesn't expose that
// information so we have to call g_signal_connect to receive that information
// in the GTKKeyPress function.
// Chromium renders the web contents asynchronously. It uses multiple processes
// and threads which makes it complicated to keep the correct browser size.
// In one hand you have the main application thread where the form is resized by
// the user. On the other hand, Chromium renders the contents asynchronously
// with the last browser size available, which may have changed by the time
// Chromium renders the page.
// For this reason we need to keep checking the real size and call
// TChromium.WasResized when we detect that Chromium has an incorrect size.
// TChromium.WasResized triggers the TChromium.OnGetViewRect event to let CEF
// read the current browser size and then it triggers TChromium.OnPaint when the
// contents are finally rendered.
// TChromium.WasResized --> (time passes) --> TChromium.OnGetViewRect --> (time passes) --> TChromium.OnPaint
// You have to assume that the real browser size can change between those calls
// and events.
// This demo uses a couple of fields called "FResizing" and "FPendingResize" to
// reduce the number of TChromium.WasResized calls.
// FResizing is set to True before the TChromium.WasResized call and it's set to
// False at the end of the TChromium.OnPaint event.
// FPendingResize is set to True when the browser changed its size while
// FResizing was True. The FPendingResize value is checked at the end of
// TChromium.OnPaint to check the browser size again because it changed while
// Chromium was rendering the page.
// The TChromium.OnPaint event in the demo also calls
// TBufferPanel.UpdateBufferDimensions and TBufferPanel.BufferIsResized to check
// the width and height of the buffer parameter, and the internal buffer size in
// the TBufferPanel component.
// Lazarus usually initializes the GTK WidgetSet in the initialization section
// of the "Interfaces" unit which is included in the LPR file. This causes
// initialization problems in CEF and we need to call "CreateWidgetset" after
// the GlobalCEFApp.StartMainProcess call.
// Lazarus shows a warning if we remove the "Interfaces" unit from the LPR file
// so we created a custom unit with the same name that includes two procedures
// to initialize and finalize the WidgetSet at the right time.
// This is the destruction sequence in OSR mode :
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls Chromium1.CloseBrowser(True).
// 2- Chromium1.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
// set "Result" to false and CEF will destroy the internal browser immediately.
// 3- Chromium1.OnBeforeClose is triggered because the internal browser was destroyed.
// FCanClose is set to True and calls SendCompMessage(CEF_BEFORECLOSE) to
// close the form asynchronously.
uses
Math, gtk2, glib2, gdk2, gtk2proc, gtk2int,
uCEFMiscFunctions, uCEFApplication, uCEFBitmapBitBuffer, uCEFWorkScheduler;
const
CEF_UPDATE_CURSOR = $A0D;
CEF_UPDATE_HINT = $A0E;
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
begin
if (GlobalCEFWorkScheduler <> nil) then
GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
end;
procedure CreateGlobalCEFApp;
begin
// TCEFWorkScheduler will call cef_do_message_loop_work when
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
// GlobalCEFWorkScheduler needs to be created before the
// GlobalCEFApp.StartMainProcess call.
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.WindowlessRenderingEnabled := True;
GlobalCEFApp.EnableHighDPISupport := True;
GlobalCEFApp.BrowserSubprocessPath := 'OSRExternalPumpBrowser_sp';
GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
GlobalCEFApp.ExternalMessagePump := True;
GlobalCEFApp.MultiThreadedMessageLoop := False;
GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
// This is a workaround for the 'GPU is not usable error' issue :
// https://bitbucket.org/chromiumembedded/cef/issues/2964/gpu-is-not-usable-error-during-cef
GlobalCEFApp.DisableZygote := True; // this property adds the "--no-zygote" command line switch
//GlobalCEFApp.LogFile := 'debug.log';
//GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
end;
function GTKKeyPress(Widget: PGtkWidget; Event: PGdkEventKey; Data: gPointer) : GBoolean; cdecl;
var
TempCefEvent : TCefKeyEvent;
begin
GdkEventKeyToCEFKeyEvent(Event, TempCefEvent);
if (Event^._type = GDK_KEY_PRESS) then
begin
TempCefEvent.kind := KEYEVENT_RAWKEYDOWN;
Form1.SendCEFKeyEvent(TempCefEvent);
TempCefEvent.kind := KEYEVENT_CHAR;
Form1.SendCEFKeyEvent(TempCefEvent);
end
else
begin
TempCefEvent.kind := KEYEVENT_KEYUP;
Form1.SendCEFKeyEvent(TempCefEvent);
end;
Result := True;
end;
procedure ConnectKeyPressReleaseEvents(const aWidget : PGtkWidget);
begin
g_signal_connect(aWidget, 'key-press-event', TGTKSignalFunc(@GTKKeyPress), nil);
g_signal_connect(aWidget, 'key-release-event', TGTKSignalFunc(@GTKKeyPress), nil);
end;
{ TForm1 }
procedure TForm1.SendCEFKeyEvent(const aCefEvent : TCefKeyEvent);
begin
Chromium1.SendKeyEvent(@aCefEvent);
end;
procedure TForm1.GoBtnClick(Sender: TObject);
begin
FResizeCS.Acquire;
FResizing := False;
FPendingResize := False;
FResizeCS.Release;
Chromium1.LoadURL(AddressEdt.Text);
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.AddressEdtEnter(Sender: TObject);
begin
Chromium1.SendFocusEvent(False);
end;
procedure TForm1.Panel1Click(Sender: TObject);
begin
Panel1.SetFocus;
end;
procedure TForm1.Panel1Enter(Sender: TObject);
begin
Chromium1.SendFocusEvent(True);
end;
procedure TForm1.Panel1Exit(Sender: TObject);
begin
Chromium1.SendFocusEvent(False);
end;
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
Panel1.SetFocus;
TempEvent.x := X;
TempEvent.y := Y;
TempEvent.modifiers := getModifiers(Shift);
DeviceToLogical(TempEvent, Panel1.ScreenScale);
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
end;
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
TempEvent.x := x;
TempEvent.y := y;
TempEvent.modifiers := getModifiers(Shift);
DeviceToLogical(TempEvent, Panel1.ScreenScale);
Chromium1.SendMouseMoveEvent(@TempEvent, False);
end;
procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
TempEvent : TCefMouseEvent;
begin
TempEvent.x := X;
TempEvent.y := Y;
TempEvent.modifiers := getModifiers(Shift);
DeviceToLogical(TempEvent, Panel1.ScreenScale);
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
end;
procedure TForm1.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
var
TempEvent : TCefMouseEvent;
begin
TempEvent.x := MousePos.x;
TempEvent.y := MousePos.y;
TempEvent.modifiers := getModifiers(Shift);
DeviceToLogical(TempEvent, Panel1.ScreenScale);
Chromium1.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
end;
procedure TForm1.Panel1Resize(Sender: TObject);
begin
DoResize;
end;
function TForm1.getModifiers(Shift: TShiftState): TCefEventFlags;
begin
Result := EVENTFLAG_NONE;
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
end;
function TForm1.GetButton(Button: TMouseButton): TCefMouseButtonType;
begin
case Button of
TMouseButton.mbRight : Result := MBT_RIGHT;
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
else Result := MBT_LEFT;
end;
end;
procedure TForm1.Chromium1BeforeClose(Sender: TObject;
const browser: ICefBrowser);
begin
FCanClose := True;
SendCompMessage(CEF_BEFORECLOSE);
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.Chromium1CursorChange(Sender: TObject;
const browser: ICefBrowser; cursor_: TCefCursorHandle;
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
var aResult : boolean);
begin
PanelCursor := CefCursorToWindowsCursor(cursorType);
aResult := True;
SendCompMessage(CEF_UPDATE_CURSOR);
end;
procedure TForm1.Chromium1GetScreenInfo(Sender: TObject;
const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out
Result: Boolean);
var
TempRect : TCEFRect;
TempScale : single;
begin
TempScale := Panel1.ScreenScale;
TempRect.x := 0;
TempRect.y := 0;
TempRect.width := DeviceToLogical(Panel1.Width, TempScale);
TempRect.height := DeviceToLogical(Panel1.Height, TempScale);
screenInfo.device_scale_factor := TempScale;
screenInfo.depth := 0;
screenInfo.depth_per_component := 0;
screenInfo.is_monochrome := Ord(False);
screenInfo.rect := TempRect;
screenInfo.available_rect := TempRect;
Result := True;
end;
procedure TForm1.Chromium1GetScreenPoint(Sender: TObject;
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
screenY: Integer; out Result: Boolean);
var
TempScreenPt, TempViewPt : TPoint;
TempScale : single;
begin
TempScale := Panel1.ScreenScale;
TempViewPt.x := LogicalToDevice(viewX, TempScale);
TempViewPt.y := LogicalToDevice(viewY, TempScale);
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
screenX := TempScreenPt.x;
screenY := TempScreenPt.y;
Result := True;
end;
procedure TForm1.Chromium1GetViewRect(Sender: TObject;
const browser: ICefBrowser; var rect: TCefRect);
var
TempScale : single;
begin
TempScale := Panel1.ScreenScale;
rect.x := 0;
rect.y := 0;
rect.width := DeviceToLogical(Panel1.Width, TempScale);
rect.height := DeviceToLogical(Panel1.Height, TempScale);
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.Chromium1Paint(Sender: TObject; const browser: ICefBrowser;
type_: TCefPaintElementType; dirtyRectsCount: NativeUInt;
const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer
);
var
src, dst: PByte;
i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer;
n : NativeUInt;
TempWidth, TempHeight : integer;
TempBufferBits : Pointer;
TempForcedResize : boolean;
TempBitmap : TCEFBitmapBitBuffer;
TempSrcRect : TRect;
begin
try
FResizeCS.Acquire;
TempForcedResize := False;
if Panel1.BeginBufferDraw then
begin
if (type_ = PET_POPUP) then
begin
Panel1.UpdatePopupBufferDimensions(aWidth, aHeight);
TempBitmap := Panel1.PopupBuffer;
TempWidth := Panel1.PopupBufferWidth;
TempHeight := Panel1.PopupBufferHeight;
end
else
begin
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or
not(Panel1.BufferIsResized(False));
TempBitmap := Panel1.Buffer;
TempWidth := Panel1.BufferWidth;
TempHeight := Panel1.BufferHeight;
end;
SrcStride := aWidth * SizeOf(TRGBQuad);
n := 0;
while (n < dirtyRectsCount) do
begin
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
begin
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
if (TempLineSize > 0) then
begin
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
src := @PByte(buffer)[TempSrcOffset];
i := 0;
j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
while (i < j) do
begin
TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
dst := @PByte(TempBufferBits)[TempDstOffset];
Move(src^, dst^, TempLineSize);
Inc(src, SrcStride);
inc(i);
end;
end;
end;
inc(n);
end;
if FShowPopup then
begin
TempSrcRect := Rect(0, 0,
FPopUpRect.Right - FPopUpRect.Left,
FPopUpRect.Bottom - FPopUpRect.Top);
Panel1.DrawPopupBuffer(TempSrcRect, FPopUpRect);
end;
Panel1.EndBufferDraw;
SendCompMessage(CEF_PENDINGINVALIDATE);
if (type_ = PET_VIEW) then
begin
if TempForcedResize or FPendingResize then
SendCompMessage(CEF_PENDINGRESIZE);
FResizing := False;
FPendingResize := False;
end;
end;
finally
FResizeCS.Release;
end;
end;
procedure TForm1.Chromium1PopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
begin
if aShow then
FShowPopUp := True
else
begin
FShowPopUp := False;
FPopUpRect := rect(0, 0, 0, 0);
if (Chromium1 <> nil) then Chromium1.Invalidate(PET_VIEW);
end;
end;
procedure TForm1.Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
begin
LogicalToDevice(rect^, Panel1.ScreenScale);
FPopUpRect.Left := rect^.x;
FPopUpRect.Top := rect^.y;
FPopUpRect.Right := rect^.x + rect^.width - 1;
FPopUpRect.Bottom := rect^.y + rect^.height - 1;
end;
procedure TForm1.Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
begin
PanelHint := aText;
Result := True;
SendCompMessage(CEF_UPDATE_HINT);
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.FormCreate(Sender: TObject);
begin
FPopUpRect := rect(0, 0, 0, 0);
FShowPopUp := False;
FResizing := False;
FPendingResize := False;
FCanClose := False;
FClosing := False;
FResizeCS := TCriticalSection.Create;
FBrowserCS := TCriticalSection.Create;
ConnectKeyPressReleaseEvents(PGtkWidget(Panel1.Handle));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
if (FBrowserCS <> nil) then FreeAndNil(FBrowserCS);
end;
procedure TForm1.FormHide(Sender: TObject);
begin
Chromium1.SendFocusEvent(False);
Chromium1.WasHidden(True);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
if Chromium1.Initialized then
begin
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
end
else
begin
// We have to update the DeviceScaleFactor here to get the scale of the
// monitor where the main application form is located.
GlobalCEFApp.UpdateDeviceScaleFactor;
// opaque white background color
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
end;
end;
procedure TForm1.GoBtnEnter(Sender: TObject);
begin
Chromium1.SendFocusEvent(False);
end;
procedure TForm1.SnapshotBtnClick(Sender: TObject);
begin
if SaveDialog1.Execute then
Panel1.SaveToFile(SaveDialog1.FileName);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
if not(Chromium1.CreateBrowser) and not(Chromium1.Initialized) then
Timer1.Enabled := True;
end;
procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
begin
Caption := 'Simple OSR Browser';
AddressPnl.Enabled := True;
end;
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
begin
Close;
end;
procedure TForm1.PendingResizeMsg(Data: PtrInt);
begin
DoResize;
end;
procedure TForm1.PendingInvalidateMsg(Data: PtrInt);
begin
Panel1.Invalidate;
end;
procedure TForm1.PendingCursorUpdateMsg(Data: PtrInt);
begin
Panel1.Cursor := PanelCursor;
end;
procedure TForm1.PendingHintUpdateMsg(Data: PtrInt);
begin
Panel1.hint := PanelHint;
Panel1.ShowHint := (length(Panel1.hint) > 0);
end;
procedure TForm1.SendCompMessage(aMsg : cardinal);
begin
case aMsg of
CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreatedMsg, 0);
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
CEF_PENDINGRESIZE : Application.QueueAsyncCall(@PendingResizeMsg, 0);
CEF_PENDINGINVALIDATE : Application.QueueAsyncCall(@PendingInvalidateMsg, 0);
CEF_UPDATE_CURSOR : Application.QueueAsyncCall(@PendingCursorUpdateMsg, 0);
CEF_UPDATE_HINT : Application.QueueAsyncCall(@PendingHintUpdateMsg, 0);
end;
end;
procedure TForm1.DoResize;
begin
try
FResizeCS.Acquire;
if FResizing then
FPendingResize := True
else
if Panel1.BufferIsResized then
Chromium1.Invalidate(PET_VIEW)
else
begin
FResizing := True;
Chromium1.WasResized;
end;
finally
FResizeCS.Release;
end;
end;
function TForm1.GetPanelCursor : TCursor;
begin
try
FBrowserCS.Acquire;
Result := FPanelCursor;
finally
FBrowserCS.Release;
end;
end;
function TForm1.GetPanelHint : ustring;
begin
try
FBrowserCS.Acquire;
Result := FPanelHint;
finally
FBrowserCS.Release;
end;
end;
procedure TForm1.SetPanelCursor(aValue : TCursor);
begin
try
FBrowserCS.Acquire;
FPanelCursor := aValue;
finally
FBrowserCS.Release;
end;
end;
procedure TForm1.SetPanelHint(const aValue : ustring);
begin
try
FBrowserCS.Acquire;
FPanelHint := aValue;
finally
FBrowserCS.Release;
end;
end;
end.

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 227,
"InternalVersion" : 228,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "87.1.13.0"
}