mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Improved Linux support in Lazarus
- Fixed issue #255 - Changed GlobalCEFApp.DefaultEncoding property type to ustring - Changed GlobalCEFApp.OverrideSpellCheckLang property type to ustring
This commit is contained in:
parent
7ec49e1f95
commit
e7eae21105
@ -5,8 +5,10 @@ CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DC
|
||||
|
||||
CEF4Delphi uses CEF 87.1.12 which includes Chromium 87.0.4280.88.
|
||||
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
||||
* [32 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_windows32.tar.bz2)
|
||||
* [64 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_windows64.tar.bz2)
|
||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_windows32.tar.bz2)
|
||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_windows64.tar.bz2)
|
||||
* [Linux 32 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_linux32.tar.bz2)
|
||||
* [Linux 64 bits](https://cef-builds.spotifycdn.com/cef_binary_87.1.12%2Bg03f9336%2Bchromium-87.0.4280.88_linux64.tar.bz2)
|
||||
|
||||
|
||||
CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||
@ -14,7 +16,7 @@ CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in D
|
||||
## Links
|
||||
* [Installation instructions and more information about CEF4Delphi](https://www.briskbard.com/index.php?lang=en&pageid=cef)
|
||||
* [Developer Forums](https://www.briskbard.com/forum)
|
||||
* These components need Windows 7, 8, 8.1, 10 or newer to run. If you need Windows XP and Vista support use [OldCEF4Delphi](https://github.com/salvadordf/OldCEF4Delphi)
|
||||
* The Windows components need Windows 7, 8, 8.1, 10 or newer to run. If you need Windows XP and Vista support use [OldCEF4Delphi](https://github.com/salvadordf/OldCEF4Delphi)
|
||||
|
||||
## Stable releases
|
||||
This is the development branch and it may have issues. Use the [latest release](https://github.com/salvadordf/CEF4Delphi/releases/latest) if you need a stable component.
|
||||
|
30
demos/Lazarus_Linux/SimpleBrowser2/interfaces.pas
Normal file
30
demos/Lazarus_Linux/SimpleBrowser2/interfaces.pas
Normal 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.
|
@ -33,7 +33,7 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -46,6 +46,11 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleOSRBrowser"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="interfaces.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Interfaces"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -66,6 +71,10 @@
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dUseCthreads"/>
|
||||
<OtherDefines Count="2">
|
||||
<Define0 Value="UseCthreads"/>
|
||||
<Define1 Value="EnabledGtkThreading"/>
|
||||
</OtherDefines>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
|
@ -42,8 +42,9 @@ program SimpleOSRBrowser;
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cmem,
|
||||
{$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, uSimpleOSRBrowser,
|
||||
{ you can add units after this }
|
||||
@ -56,11 +57,15 @@ begin
|
||||
|
||||
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.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
CustomWidgetSetFinalization;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
|
@ -3,15 +3,15 @@
|
||||
<ProjectSession>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="6">
|
||||
<Units Count="101">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="13"/>
|
||||
<CursorPos X="8" Y="45"/>
|
||||
<UsageCount Value="23"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="18"/>
|
||||
<CursorPos X="57" Y="58"/>
|
||||
<UsageCount Value="78"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
@ -21,66 +21,877 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleOSRBrowser"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="165"/>
|
||||
<CursorPos X="32" Y="726"/>
|
||||
<UsageCount Value="23"/>
|
||||
<TopLine Value="595"/>
|
||||
<CursorPos Y="624"/>
|
||||
<UsageCount Value="78"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="47" Y="222" ID="2"/>
|
||||
<Item1 X="76" Y="501" ID="6"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="interfaces.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Interfaces"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="40" Y="20"/>
|
||||
<UsageCount Value="74"/>
|
||||
<Loaded Value="True"/>
|
||||
</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="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../../../source/uCEFMiscFunctions.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1889"/>
|
||||
<CursorPos X="27" Y="1907"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../../../source/uCEFApplicationCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="432"/>
|
||||
<CursorPos X="29" Y="445"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/objpas/sysutils/finah.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="10" Y="33"/>
|
||||
<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"/>
|
||||
</Unit5>
|
||||
</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="-1"/>
|
||||
<TopLine Value="363"/>
|
||||
<CursorPos Y="381"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Bookmarks Count="4">
|
||||
<Item0 Y="997" ID="9"/>
|
||||
<Item1 X="63" Y="579" ID="8"/>
|
||||
<Item2 X="5" Y="345" ID="7"/>
|
||||
<Item3 X="5" Y="375" ID="1"/>
|
||||
</Bookmarks>
|
||||
</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="1075"/>
|
||||
<CursorPos X="15" Y="1083"/>
|
||||
<UsageCount Value="14"/>
|
||||
</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="110"/>
|
||||
<CursorPos X="29" Y="126"/>
|
||||
<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>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<OtherDefines Count="2">
|
||||
<Define0 Value="UseCthreads"/>
|
||||
<Define1 Value="EnabledGtkThreading"/>
|
||||
</OtherDefines>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="137" Column="44" TopLine="124"/>
|
||||
<Caret Line="535" Column="58" TopLine="488"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="138" Column="30" TopLine="124"/>
|
||||
<Caret Line="543" Column="51" TopLine="496"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="389" Column="18" TopLine="360"/>
|
||||
<Caret Line="75" Column="32" TopLine="56"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="575" Column="48" TopLine="555"/>
|
||||
<Caret Line="320" Column="3" TopLine="314"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="581" Column="30" TopLine="555"/>
|
||||
<Caret Line="75" Column="15" TopLine="48"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="320" Column="3" TopLine="315"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="83" Column="28" TopLine="75"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="511" Column="3" TopLine="508"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="112" Column="23" TopLine="87"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="618" Column="3" TopLine="593"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="112" Column="29" TopLine="97"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="628" Column="84" TopLine="597"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="120" Column="31" TopLine="94"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="669" Column="24" TopLine="620"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="112" Column="25" TopLine="84"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="479" Column="50" TopLine="447"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="75" Column="15" TopLine="52"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="338" Column="59" TopLine="318"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="75" Column="31" TopLine="51"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="341" Column="3" TopLine="332"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="83" Column="15" TopLine="49"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="552" Column="57" TopLine="524"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="118" Column="30" TopLine="88"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="73" Column="31" TopLine="71"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<Caret Line="58" Column="57" TopLine="18"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="101" Column="55" TopLine="81"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="625" Column="10" TopLine="578"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="100" Column="12" TopLine="74"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="625" Column="10" TopLine="578"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="100" TopLine="74"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
<Debugging>
|
||||
<Watches Count="1">
|
||||
<Item1>
|
||||
<Expression Value="width"/>
|
||||
</Item1>
|
||||
</Watches>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
|
30
demos/Lazarus_Linux/SimpleOSRBrowser/interfaces.pas
Normal file
30
demos/Lazarus_Linux/SimpleOSRBrowser/interfaces.pas
Normal 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.
|
@ -1,55 +1,78 @@
|
||||
object Form1: TForm1
|
||||
Left = 393
|
||||
Height = 622
|
||||
Top = 250
|
||||
Width = 972
|
||||
Left = 518
|
||||
Height = 630
|
||||
Top = 252
|
||||
Width = 1000
|
||||
Caption = ' Initializing browser. Please wait...'
|
||||
ClientHeight = 622
|
||||
ClientWidth = 972
|
||||
ClientHeight = 630
|
||||
ClientWidth = 1000
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnHide = FormHide
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.0.6.0'
|
||||
LCLVersion = '2.0.10.0'
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
Height = 30
|
||||
Top = 0
|
||||
Width = 972
|
||||
Width = 1000
|
||||
Align = alTop
|
||||
ClientHeight = 21
|
||||
ClientWidth = 972
|
||||
ClientHeight = 30
|
||||
ClientWidth = 1000
|
||||
TabOrder = 0
|
||||
object GoBtn: TButton
|
||||
Left = 940
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 31
|
||||
Align = alRight
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
OnEnter = GoBtnEnter
|
||||
TabOrder = 0
|
||||
end
|
||||
object AddressEdt: TEdit
|
||||
Left = 1
|
||||
Height = 19
|
||||
Height = 28
|
||||
Top = 1
|
||||
Width = 939
|
||||
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
|
||||
Text = 'AddressEdt'
|
||||
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 = 601
|
||||
Top = 21
|
||||
Width = 972
|
||||
Height = 600
|
||||
Top = 30
|
||||
Width = 1000
|
||||
Align = alClient
|
||||
OnUTF8KeyPress = Panel1UTF8KeyPress
|
||||
Caption = 'Panel1'
|
||||
TabOrder = 1
|
||||
OnClick = Panel1Click
|
||||
@ -59,12 +82,11 @@ object Form1: TForm1
|
||||
OnMouseMove = Panel1MouseMove
|
||||
OnMouseUp = Panel1MouseUp
|
||||
OnMouseWheel = Panel1MouseWheel
|
||||
OnKeyDown = Panel1KeyDown
|
||||
OnKeyUp = Panel1KeyUp
|
||||
OnResize = Panel1Resize
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnTooltip = Chromium1Tooltip
|
||||
OnCursorChange = Chromium1CursorChange
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
@ -75,14 +97,20 @@ object Form1: TForm1
|
||||
OnPopupShow = Chromium1PopupShow
|
||||
OnPopupSize = Chromium1PopupSize
|
||||
OnPaint = Chromium1Paint
|
||||
OnCursorChange = Chromium1CursorChange
|
||||
left = 48
|
||||
top = 72
|
||||
Left = 48
|
||||
Top = 72
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
OnTimer = Timer1Timer
|
||||
left = 48
|
||||
top = 144
|
||||
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
|
||||
|
@ -43,109 +43,94 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
LCLType, Types, SyncObjs,
|
||||
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;
|
||||
GoBtn: TButton;
|
||||
AddressPnl: TPanel;
|
||||
Panel2: TPanel;
|
||||
Timer1: TTimer;
|
||||
procedure AddressEdtEnter(Sender: TObject);
|
||||
|
||||
procedure Panel1Click(Sender: TObject);
|
||||
procedure Panel1Enter(Sender: TObject);
|
||||
procedure Panel1Exit(Sender: TObject);
|
||||
procedure Panel1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure Panel1KeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
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 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 Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser
|
||||
);
|
||||
|
||||
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 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 Timer1Timer(Sender: TObject);
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure AddressEdtEnter(Sender: TObject);
|
||||
private
|
||||
|
||||
protected
|
||||
FbFirst : boolean;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
FDeviceBounds : TCefRectDynArray;
|
||||
FSelectedRange : TCefRange;
|
||||
FResizeCS : TCriticalSection;
|
||||
FBrowserCS : TCriticalSection;
|
||||
FPanelCursor : TCursor;
|
||||
FPanelHint : ustring;
|
||||
|
||||
function SendCompMessage(aMsg : cardinal) : boolean;
|
||||
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 BrowserCreated;
|
||||
procedure BrowserCreatedMsg(Data: PtrInt);
|
||||
procedure BrowserCloseFormMsg(Data: PtrInt);
|
||||
procedure PendingResizeMsg(Data: PtrInt);
|
||||
procedure PendingInvalidateMsg(Data: PtrInt);
|
||||
public
|
||||
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
|
||||
@ -157,36 +142,136 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
// This is a simple CEF browser in "off-screen rendering" mode (a.k.a OSR mode)
|
||||
|
||||
// It uses the default CEF configuration with a multithreaded message loop and
|
||||
// that means that the TChromium events are executed in a CEF thread.
|
||||
|
||||
// GTK is not thread safe so we have to save all the information given in the
|
||||
// TChromium events and use it later in the main application thread. We use
|
||||
// critical sections to protect all that information.
|
||||
|
||||
// For example, the browser updates the mouse cursor in the
|
||||
// TChromium.OnCursorChange event so we have to save the cursor in FPanelCursor
|
||||
// and use Application.QueueAsyncCall to update the Panel1.Cursor value in the
|
||||
// main application thread.
|
||||
|
||||
// The raw bitmap information given in the TChromium.OnPaint event also needs to
|
||||
// be stored in a TCEFBitmapBitBuffer class instead of a simple TBitmap to avoid
|
||||
// issues with GTK.
|
||||
|
||||
// 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- chrmosr.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,
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
Math, gtk2, glib2, gdk2, gtk2proc, gtk2int,
|
||||
uCEFMiscFunctions, uCEFApplication, uCEFBitmapBitBuffer;
|
||||
|
||||
const
|
||||
CEF_UPDATE_CURSOR = $A0D;
|
||||
CEF_UPDATE_HINT = $A0E;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
var
|
||||
TempHome, TempBinDir : ustring;
|
||||
begin
|
||||
TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
|
||||
TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
|
||||
if DirectoryExists(TempBinDir) then
|
||||
//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
|
||||
GlobalCEFApp.FrameworkDirPath := TempBinDir;
|
||||
GlobalCEFApp.ResourcesDirPath := TempBinDir;
|
||||
GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
|
||||
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;
|
||||
|
||||
// Add a debug log in the BIN directory
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
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;
|
||||
@ -197,37 +282,10 @@ begin
|
||||
Chromium1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1AfterCreated(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
// Now the browser is fully initialized we can initialize the UI.
|
||||
TThread.Queue(nil, @BrowserCreated);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1UTF8KeyPress(Sender: TObject;
|
||||
var UTF8Key: TUTF8Char);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
TempString : UnicodeString;
|
||||
begin
|
||||
if Panel1.Focused then
|
||||
begin
|
||||
TempString := UTF8Decode(UTF8Key);
|
||||
|
||||
if (length(TempString) > 0) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := EVENTFLAG_NONE;
|
||||
TempKeyEvent.windows_key_code := ord(TempString[1]);
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
SendCompMessage(CEF_AFTERCREATED);
|
||||
end;
|
||||
|
||||
procedure TForm1.AddressEdtEnter(Sender: TObject);
|
||||
@ -250,64 +308,19 @@ begin
|
||||
Chromium1.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
|
||||
if (Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then Key := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
Panel1.SetFocus;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
end;
|
||||
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,
|
||||
@ -316,14 +329,11 @@ var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := x;
|
||||
TempEvent.y := y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseMoveEvent(@TempEvent, False);
|
||||
end;
|
||||
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;
|
||||
@ -331,14 +341,11 @@ procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
end;
|
||||
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;
|
||||
@ -346,14 +353,11 @@ procedure TForm1.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := MousePos.x;
|
||||
TempEvent.y := MousePos.y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
|
||||
end;
|
||||
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);
|
||||
@ -406,34 +410,33 @@ procedure TForm1.Chromium1CursorChange(Sender: TObject;
|
||||
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
|
||||
var aResult : boolean);
|
||||
begin
|
||||
Panel1.Cursor := CefCursorToWindowsCursor(cursorType);
|
||||
aResult := True;
|
||||
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;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempRect.x := 0;
|
||||
TempRect.y := 0;
|
||||
TempRect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempRect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
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 := GlobalCEFApp.DeviceScaleFactor;
|
||||
screenInfo.depth := 0;
|
||||
screenInfo.depth_per_component := 0;
|
||||
screenInfo.is_monochrome := Ord(False);
|
||||
screenInfo.rect := TempRect;
|
||||
screenInfo.available_rect := TempRect;
|
||||
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
|
||||
else
|
||||
Result := False;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1GetScreenPoint(Sender: TObject;
|
||||
@ -441,30 +444,27 @@ procedure TForm1.Chromium1GetScreenPoint(Sender: TObject;
|
||||
screenY: Integer; out Result: Boolean);
|
||||
var
|
||||
TempScreenPt, TempViewPt : TPoint;
|
||||
TempScale : single;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempViewPt.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempViewPt.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
||||
screenX := TempScreenPt.x;
|
||||
screenY := TempScreenPt.y;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
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);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
rect.x := 0;
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
end;
|
||||
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;
|
||||
@ -487,7 +487,8 @@ var
|
||||
TempWidth, TempHeight : integer;
|
||||
TempBufferBits : Pointer;
|
||||
TempForcedResize : boolean;
|
||||
TempBitmap : TBitmap;
|
||||
TempBitmap : TCEFBitmapBitBuffer;
|
||||
TempSrcRect : TRect;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
@ -497,87 +498,73 @@ begin
|
||||
begin
|
||||
if (type_ = PET_POPUP) then
|
||||
begin
|
||||
if (FPopUpBitmap = nil) or
|
||||
(aWidth <> FPopUpBitmap.Width) or
|
||||
(aHeight <> FPopUpBitmap.Height) then
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FPopUpBitmap.Free;
|
||||
Panel1.UpdatePopupBufferDimensions(aWidth, aHeight);
|
||||
|
||||
FPopUpBitmap := TBitmap.Create;
|
||||
FPopUpBitmap.PixelFormat := pf32bit;
|
||||
FPopUpBitmap.HandleType := bmDIB;
|
||||
FPopUpBitmap.Width := aWidth;
|
||||
FPopUpBitmap.Height := aHeight;
|
||||
end;
|
||||
|
||||
TempBitmap := FPopUpBitmap;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := FPopUpBitmap.Width;
|
||||
TempHeight := FPopUpBitmap.Height;
|
||||
TempBitmap := Panel1.PopupBuffer;
|
||||
TempWidth := Panel1.PopupBufferWidth;
|
||||
TempHeight := Panel1.PopupBufferHeight;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
|
||||
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or
|
||||
not(Panel1.BufferIsResized(False));
|
||||
|
||||
TempBitmap := Panel1.Buffer;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := Panel1.BufferWidth;
|
||||
TempHeight := Panel1.BufferHeight;
|
||||
end;
|
||||
|
||||
if (TempBufferBits <> nil) then
|
||||
SrcStride := aWidth * SizeOf(TRGBQuad);
|
||||
n := 0;
|
||||
|
||||
while (n < dirtyRectsCount) do
|
||||
begin
|
||||
SrcStride := aWidth * SizeOf(TRGBQuad);
|
||||
n := 0;
|
||||
|
||||
while (n < dirtyRectsCount) do
|
||||
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
|
||||
begin
|
||||
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
|
||||
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
|
||||
if (TempLineSize > 0) then
|
||||
begin
|
||||
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
|
||||
|
||||
if (TempLineSize > 0) then
|
||||
src := @PByte(buffer)[TempSrcOffset];
|
||||
|
||||
i := 0;
|
||||
j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
|
||||
|
||||
while (i < j) do
|
||||
begin
|
||||
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
|
||||
TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
|
||||
dst := @PByte(TempBufferBits)[TempDstOffset];
|
||||
|
||||
src := @PByte(buffer)[TempSrcOffset];
|
||||
Move(src^, dst^, TempLineSize);
|
||||
|
||||
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;
|
||||
Inc(src, SrcStride);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
TempBitmap.EndUpdate;
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
if FShowPopup and (FPopUpBitmap <> nil) then
|
||||
Panel1.BufferDraw(FPopUpRect.Left, FPopUpRect.Top, FPopUpBitmap);
|
||||
if FShowPopup then
|
||||
begin
|
||||
TempSrcRect := Rect(0, 0,
|
||||
FPopUpRect.Right - FPopUpRect.Left,
|
||||
FPopUpRect.Bottom - FPopUpRect.Top);
|
||||
|
||||
Panel1.DrawPopupBuffer(TempSrcRect, FPopUpRect);
|
||||
end;
|
||||
|
||||
Panel1.EndBufferDraw;
|
||||
|
||||
if HandleAllocated then SendCompMessage(CEF_PENDINGINVALIDATE);
|
||||
SendCompMessage(CEF_PENDINGINVALIDATE);
|
||||
|
||||
if (type_ = PET_VIEW) then
|
||||
begin
|
||||
if (TempForcedResize or FPendingResize) and
|
||||
HandleAllocated then
|
||||
if TempForcedResize or FPendingResize then
|
||||
SendCompMessage(CEF_PENDINGRESIZE);
|
||||
|
||||
FResizing := False;
|
||||
@ -589,8 +576,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1PopupShow(Sender: TObject;
|
||||
const browser: ICefBrowser; aShow: Boolean);
|
||||
procedure TForm1.Chromium1PopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
|
||||
begin
|
||||
if aShow then
|
||||
FShowPopUp := True
|
||||
@ -603,26 +589,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1PopupSize(Sender: TObject;
|
||||
const browser: ICefBrowser; const rect: PCefRect);
|
||||
procedure TForm1.Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
LogicalToDevice(rect^, GlobalCEFApp.DeviceScaleFactor);
|
||||
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;
|
||||
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);
|
||||
procedure TForm1.Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||
begin
|
||||
Panel1.hint := aText;
|
||||
Panel1.ShowHint := (length(aText) > 0);
|
||||
Result := True;
|
||||
PanelHint := aText;
|
||||
Result := True;
|
||||
|
||||
SendCompMessage(CEF_UPDATE_HINT);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
@ -639,31 +621,22 @@ end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FbFirst := False;
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
FShowPopUp := False;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FDeviceBounds := nil;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
FBrowserCS := TCriticalSection.Create;
|
||||
|
||||
FSelectedRange.from := 0;
|
||||
FSelectedRange.to_ := 0;
|
||||
ConnectKeyPressReleaseEvents(PGtkWidget(Panel1.Handle));
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
|
||||
if (FDeviceBounds <> nil) then
|
||||
begin
|
||||
Finalize(FDeviceBounds);
|
||||
FDeviceBounds := nil;
|
||||
end;
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
if (FBrowserCS <> nil) then FreeAndNil(FBrowserCS);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormHide(Sender: TObject);
|
||||
@ -681,11 +654,15 @@ begin
|
||||
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);
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
|
||||
if not(Chromium1.CreateBrowser(nil, '')) then Timer1.Enabled := True;
|
||||
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -694,15 +671,21 @@ 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(nil, '')) and not(Chromium1.Initialized) then
|
||||
if not(Chromium1.CreateBrowser) and not(Chromium1.Initialized) then
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCreated;
|
||||
procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
|
||||
begin
|
||||
Caption := 'Simple OSR Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
@ -723,12 +706,26 @@ begin
|
||||
Panel1.Invalidate;
|
||||
end;
|
||||
|
||||
function TForm1.SendCompMessage(aMsg : cardinal) : boolean;
|
||||
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;
|
||||
|
||||
@ -750,6 +747,46 @@ begin
|
||||
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.
|
||||
|
@ -8,6 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="38"/>
|
||||
<CursorPos X="11" Y="46"/>
|
||||
<UsageCount Value="20"/>
|
||||
@ -36,10 +37,9 @@
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="804"/>
|
||||
<CursorPos X="70" Y="818"/>
|
||||
<TopLine Value="803"/>
|
||||
<CursorPos X="72" Y="824"/>
|
||||
<UsageCount Value="42"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="40" Y="302" ID="4"/>
|
||||
|
@ -217,7 +217,8 @@ contains
|
||||
uCEFAudioHandler in '..\source\uCEFAudioHandler.pas',
|
||||
uCEFDevToolsMessageObserver in '..\source\uCEFDevToolsMessageObserver.pas',
|
||||
uCEFMediaSinkDeviceInfoCallback in '..\source\uCEFMediaSinkDeviceInfoCallback.pas',
|
||||
uCEFJson in '..\source\uCEFJson.pas';
|
||||
uCEFJson in '..\source\uCEFJson.pas',
|
||||
uCEFBitmapBitBuffer in '..\source\uCEFBitmapBitBuffer.pas';
|
||||
|
||||
end.
|
||||
|
||||
|
@ -214,6 +214,7 @@ contains
|
||||
uCEFAudioHandler in '..\source\uCEFAudioHandler.pas',
|
||||
uCEFDevToolsMessageObserver in '..\source\uCEFDevToolsMessageObserver.pas',
|
||||
uCEFMediaSinkDeviceInfoCallback in '..\source\uCEFMediaSinkDeviceInfoCallback.pas',
|
||||
uCEFJson in '..\source\uCEFJson.pas';
|
||||
uCEFJson in '..\source\uCEFJson.pas',
|
||||
uCEFBitmapBitBuffer in '..\source\uCEFBitmapBitBuffer.pas';
|
||||
|
||||
end.
|
||||
|
@ -222,7 +222,8 @@ contains
|
||||
uCEFAudioHandler in '..\source\uCEFAudioHandler.pas',
|
||||
uCEFDevToolsMessageObserver in '..\source\uCEFDevToolsMessageObserver.pas',
|
||||
uCEFMediaSinkDeviceInfoCallback in '..\source\uCEFMediaSinkDeviceInfoCallback.pas',
|
||||
uCEFJson in '..\source\uCEFJson.pas';
|
||||
uCEFJson in '..\source\uCEFJson.pas',
|
||||
uCEFBitmapBitBuffer in '..\source\uCEFBitmapBitBuffer.pas';
|
||||
|
||||
end.
|
||||
|
||||
|
@ -146,198 +146,6 @@
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="rtl.dcp"/>
|
||||
<DCCReference Include="vcl.dcp"/>
|
||||
<DCCReference Include="fmx.dcp"/>
|
||||
<DCCReference Include="CEF4Delphi_FMX_Register.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFindHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFConstants.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTypes.pas"/>
|
||||
<DCCReference Include="..\source\uCEFInterfaces.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMiscFunctions.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLibFunctions.pas"/>
|
||||
<DCCReference Include="..\source\uCEFApplication.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSchemeRegistrar.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCommandLine.pas"/>
|
||||
<DCCReference Include="..\source\uCEFClient.pas"/>
|
||||
<DCCReference Include="..\source\uCEFProcessMessage.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBrowser.pas"/>
|
||||
<DCCReference Include="..\source\uCEFListValue.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBinaryValue.pas"/>
|
||||
<DCCReference Include="..\source\uCEFValue.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDictionaryValue.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDownloadImageCallBack.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFrame.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPDFPrintCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRunFileDialogCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRequestContext.pas"/>
|
||||
<DCCReference Include="..\source\uCEFNavigationEntryVisitor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStringVisitor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Context.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDomVisitor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFNavigationEntry.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCookieManager.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCompletionCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRequestContextHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWebPluginInfo.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDomDocument.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDomNode.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Value.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Accessor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLoadHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFocusHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFContextMenuHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDialogHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFKeyboardHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDisplayHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDownloadHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFJsDialogHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLifeSpanHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRequestHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRenderHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDragHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPostData.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPostDataElement.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRequest.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStreamReader.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWriteHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStreamWriter.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8StackFrame.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8StackTrace.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Handler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRequestCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCustomStreamReader.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSchemeHandlerFactory.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTask.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTaskRunner.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStringMap.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStringMultimap.pas"/>
|
||||
<DCCReference Include="..\source\uCEFXmlReader.pas"/>
|
||||
<DCCReference Include="..\source\uCEFZipReader.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResponse.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCookieVisitor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Exception.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceBundleHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSetCookieCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDeleteCookiesCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDownLoadItem.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBeforeDownloadCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDownloadItemCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFAuthCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFJsDialogCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFContextMenuParams.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuModel.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBrowserProcessHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRenderProcessHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlrequestClient.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequest.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWebPluginInfoVisitor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWebPluginUnstableCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFEndTracingCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFileDialogCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDragData.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResolveCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPrintSettings.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSslInfo.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRunContextMenuCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceBundle.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResponseFilter.pas"/>
|
||||
<DCCReference Include="..\source\uCEFImage.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuModelDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWindowParent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromiumCore.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromium.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromiumEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromiumOptions.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromiumFontOptions.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPDFPrintOptions.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRegisterCDMCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFThread.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8Interceptor.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWaitableEvent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFX509CertPrincipal.pas"/>
|
||||
<DCCReference Include="..\source\uCEFX509Certificate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSSLStatus.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSelectClientCertificateCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFChromiumWindow.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBaseRefCounted.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBaseScopedWrapper.pas"/>
|
||||
<DCCReference Include="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFOLEDragAndDrop.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDragAndDropMgr.pas"/>
|
||||
<DCCReference Include="..\source\uCEFGetExtensionResourceCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFExtension.pas"/>
|
||||
<DCCReference Include="..\source\uCEFExtensionHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBufferPanel.pas"/>
|
||||
<DCCReference Include="..\source\uCEFApp.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWorkScheduler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWorkSchedulerThread.pas"/>
|
||||
<DCCReference Include="..\source\uCEFServer.pas"/>
|
||||
<DCCReference Include="..\source\uCEFServerHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFServerEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFServerComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFMXBufferPanel.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFMXChromium.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFMXWorkScheduler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFStringList.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFMXWindowParent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFv8ArrayBufferReleaseCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWinControl.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLinkedWindowParent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFOSRIMEHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFCookieAccessFilter.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceRequestHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceSkipCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFResourceReadCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFSentinel.pas"/>
|
||||
<DCCReference Include="..\source\uCEFApplicationCore.pas"/>
|
||||
<DCCReference Include="..\source\uCEFOAuth2Helper.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaSource.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaSink.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaRouteCreateCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaRoute.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaObserver.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaRouter.pas"/>
|
||||
<DCCReference Include="..\source\uCEFRegistration.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDisplay.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLayout.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBoxLayout.pas"/>
|
||||
<DCCReference Include="..\source\uCEFFillLayout.pas"/>
|
||||
<DCCReference Include="..\source\uCEFView.pas"/>
|
||||
<DCCReference Include="..\source\uCEFViewDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTextfield.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTextfieldDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFScrollView.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPanel.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPanelDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBrowserView.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBrowserViewDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFButton.pas"/>
|
||||
<DCCReference Include="..\source\uCEFButtonDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLabelButton.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuButton.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuButtonPressedLock.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuButtonDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWindow.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWindowDelegate.pas"/>
|
||||
<DCCReference Include="..\source\uCEFViewsFrameworkEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFViewComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFTextfieldComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFScrollViewComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFPanelComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWindowComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFBrowserViewComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFButtonComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLabelButtonComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMenuButtonComponent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFAudioHandler.pas"/>
|
||||
<DCCReference Include="..\source\uCEFDevToolsMessageObserver.pas"/>
|
||||
<DCCReference Include="..\source\uCEFMediaSinkDeviceInfoCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFJson.pas"/>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
|
||||
<License Value="MPL 1.1"/>
|
||||
<Version Major="87" Minor="1" Release="12"/>
|
||||
<Files Count="189">
|
||||
<Files Count="190">
|
||||
<Item1>
|
||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
<UnitName Value="uCEFAccessibilityHandler"/>
|
||||
@ -795,6 +795,10 @@
|
||||
<Filename Value="..\source\uCEFJson.pas"/>
|
||||
<UnitName Value="uCEFJson"/>
|
||||
</Item189>
|
||||
<Item190>
|
||||
<Filename Value="..\source\uCEFBitmapBitBuffer.pas"/>
|
||||
<UnitName Value="uCEFBitmapBitBuffer"/>
|
||||
</Item190>
|
||||
</Files>
|
||||
<RequiredPkgs Count="4">
|
||||
<Item1>
|
||||
|
@ -62,7 +62,8 @@ uses
|
||||
uCEFBrowserViewComponent, uCEFWindowComponent, uCEFPanelComponent,
|
||||
uCEFScrollViewComponent, uCEFTextfieldComponent, uCEFViewComponent,
|
||||
uCEFViewsFrameworkEvents, uCEFAudioHandler, uCEFDevToolsMessageObserver,
|
||||
uCEFMediaSinkDeviceInfoCallback, uCEFJson, LazarusPackageIntf;
|
||||
uCEFMediaSinkDeviceInfoCallback, uCEFJson, uCEFBitmapBitBuffer,
|
||||
LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -173,7 +173,7 @@ type
|
||||
FForcedDeviceScaleFactor : single;
|
||||
|
||||
FPluginPolicy : TCefPluginPolicySwitch;
|
||||
FDefaultEncoding : string;
|
||||
FDefaultEncoding : ustring;
|
||||
FDisableJavascript : boolean;
|
||||
FDisableJavascriptCloseWindows : boolean;
|
||||
FDisableJavascriptAccessClipboard : boolean;
|
||||
@ -186,7 +186,7 @@ type
|
||||
FDisablePlugins : boolean;
|
||||
FEnableProfanityFilter : boolean;
|
||||
FDisableSpellChecking : boolean;
|
||||
FOverrideSpellCheckLang : string;
|
||||
FOverrideSpellCheckLang : ustring;
|
||||
FEnablePrintPreview : boolean;
|
||||
FTouchEvents : TCefState;
|
||||
FDisableReadingFromCanvas : boolean;
|
||||
@ -430,7 +430,7 @@ type
|
||||
property AllowRunningInsecureContent : boolean read FAllowRunningInsecureContent write FAllowRunningInsecureContent; // --allow-running-insecure-content
|
||||
property EnablePrintPreview : boolean read FEnablePrintPreview write FEnablePrintPreview; // --enable-print-preview
|
||||
property PluginPolicy : TCefPluginPolicySwitch read FPluginPolicy write FPluginPolicy; // --plugin-policy
|
||||
property DefaultEncoding : string read FDefaultEncoding write FDefaultEncoding; // --default-encoding
|
||||
property DefaultEncoding : ustring read FDefaultEncoding write FDefaultEncoding; // --default-encoding
|
||||
property DisableJavascript : boolean read FDisableJavascript write FDisableJavascript; // --disable-javascript
|
||||
property DisableJavascriptCloseWindows : boolean read FDisableJavascriptCloseWindows write FDisableJavascriptCloseWindows; // --disable-javascript-close-windows
|
||||
property DisableJavascriptAccessClipboard : boolean read FDisableJavascriptAccessClipboard write FDisableJavascriptAccessClipboard; // --disable-javascript-access-clipboard
|
||||
@ -443,7 +443,7 @@ type
|
||||
property DisablePlugins : boolean read FDisablePlugins write FDisablePlugins; // --disable-plugins
|
||||
property EnableProfanityFilter : boolean read FEnableProfanityFilter write FEnableProfanityFilter; // --enable-profanity-filter
|
||||
property DisableSpellChecking : boolean read FDisableSpellChecking write FDisableSpellChecking; // --disable-spell-checking
|
||||
property OverrideSpellCheckLang : string read FOverrideSpellCheckLang write FOverrideSpellCheckLang; // --override-spell-check-lang
|
||||
property OverrideSpellCheckLang : ustring read FOverrideSpellCheckLang write FOverrideSpellCheckLang; // --override-spell-check-lang
|
||||
property TouchEvents : TCefState read FTouchEvents write FTouchEvents; // --touch-events
|
||||
property DisableReadingFromCanvas : boolean read FDisableReadingFromCanvas write FDisableReadingFromCanvas; // --disable-reading-from-canvas
|
||||
property HyperlinkAuditing : boolean read FHyperlinkAuditing write FHyperlinkAuditing; // --no-pings
|
||||
@ -581,6 +581,7 @@ uses
|
||||
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils,
|
||||
{$IFDEF FPC}
|
||||
{$IFDEF MSWINDOWS}jwatlhelp32, jwapsapi,{$ENDIF}
|
||||
{$IFDEF LINUX}lcltype, Forms,{$ENDIF}
|
||||
{$ELSE}
|
||||
TlHelp32, {$IFDEF MSWINDOWS}PSAPI,{$ENDIF}
|
||||
{$ENDIF}
|
||||
@ -885,7 +886,13 @@ begin
|
||||
if (length(FFrameworkDirPath) > 0) then
|
||||
Result := IncludeTrailingPathDelimiter(FFrameworkDirPath) + LIBCEF_DLL
|
||||
else
|
||||
Result := LIBCEF_DLL;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
Result := GetModulePath + LIBCEF_DLL;
|
||||
{$ELSE}
|
||||
Result := LIBCEF_DLL;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCefApplicationCore.GetChromeElfPath : ustring;
|
||||
@ -1177,13 +1184,18 @@ begin
|
||||
TempArgs.argc := argc;
|
||||
TempArgs.argv := argv;
|
||||
{$ELSE}
|
||||
// TODO: Find a way to set the TCefMainArgs values in Delphi FMX for Linux
|
||||
TempArgs.argc := ArgCount;
|
||||
TempArgs.argv := PPWideChar(ArgValues);
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
// TODO: Find a way to pass the arguments in MacOS
|
||||
{$IFDEF FPC}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ELSE}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
@ -1263,13 +1275,18 @@ begin
|
||||
TempArgs.argc := argc;
|
||||
TempArgs.argv := argv;
|
||||
{$ELSE}
|
||||
// TODO: Find a way to set the TCefMainArgs values in Delphi FMX for Linux
|
||||
TempArgs.argc := ArgCount;
|
||||
TempArgs.argv := PPWideChar(ArgValues);
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
// TODO: Find a way to pass the arguments in MacOS
|
||||
{$IFDEF FPC}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ELSE}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
TempArgs.argc := 0;
|
||||
TempArgs.argv := 0;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
@ -1457,6 +1474,10 @@ begin
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
MessageBox(0, PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK or MB_TOPMOST);
|
||||
{$ELSE}
|
||||
{$IFDEF LINUX}
|
||||
Application.MessageBox(PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK);
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -2233,11 +2254,11 @@ begin
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
TempError := GetLastError;
|
||||
TempString := 'Error loading libcef.dll' + CRLF + CRLF +
|
||||
TempString := 'Error loading ' + LIBCEF_DLL + CRLF + CRLF +
|
||||
'Error code : 0x' + inttohex(TempError, 8) + CRLF +
|
||||
SysErrorMessage(TempError);
|
||||
{$ELSE}
|
||||
TempString := 'Error loading the CEF binaries';
|
||||
TempString := 'Error loading ' + LIBCEF_DLL;
|
||||
{$ENDIF}
|
||||
|
||||
ShowErrorMessageDlg(TempString);
|
||||
|
165
source/uCEFBitmapBitBuffer.pas
Normal file
165
source/uCEFBitmapBitBuffer.pas
Normal file
@ -0,0 +1,165 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 uCEFBitmapBitBuffer;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
System.Classes, System.SysUtils;
|
||||
{$ELSE}
|
||||
Classes, SysUtils;
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
TCEFBitmapBitBuffer = class
|
||||
protected
|
||||
FBuffer : pointer;
|
||||
FWidth : integer;
|
||||
FHeight : integer;
|
||||
|
||||
function GetScanlineSize : integer;
|
||||
function GetBufferLength : integer;
|
||||
function GetEmpty : boolean;
|
||||
function GetScanline(y : integer) : PByte;
|
||||
|
||||
procedure CreateBuffer;
|
||||
procedure DestroyBuffer;
|
||||
|
||||
public
|
||||
constructor Create(aWidth, aHeight : integer);
|
||||
destructor Destroy; override;
|
||||
|
||||
property Width : integer read FWidth;
|
||||
property Height : integer read FHeight;
|
||||
property BufferLength : integer read GetBufferLength;
|
||||
property Empty : boolean read GetEmpty;
|
||||
property Scanline[y : integer] : PByte read GetScanline;
|
||||
property ScanlineSize : integer read GetScanlineSize;
|
||||
property BufferBits : pointer read FBuffer;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
RGBQUAD_SIZE = 4;
|
||||
|
||||
constructor TCEFBitmapBitBuffer.Create(aWidth, aHeight : integer);
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
if (aWidth > 0) and (aHeight > 0) then
|
||||
begin
|
||||
FWidth := aWidth;
|
||||
FHeight := aHeight;
|
||||
|
||||
CreateBuffer;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FWidth := 0;
|
||||
FHeight := 0;
|
||||
FBuffer := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TCEFBitmapBitBuffer.Destroy;
|
||||
begin
|
||||
DestroyBuffer;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCEFBitmapBitBuffer.DestroyBuffer;
|
||||
begin
|
||||
if (FBuffer <> nil) then
|
||||
begin
|
||||
FreeMem(FBuffer);
|
||||
FBuffer := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCEFBitmapBitBuffer.GetScanlineSize : integer;
|
||||
begin
|
||||
Result := FWidth * RGBQUAD_SIZE;
|
||||
end;
|
||||
|
||||
function TCEFBitmapBitBuffer.GetBufferLength : integer;
|
||||
begin
|
||||
Result := FHeight * ScanlineSize;
|
||||
end;
|
||||
|
||||
function TCEFBitmapBitBuffer.GetEmpty : boolean;
|
||||
begin
|
||||
Result := (BufferLength = 0) or (FBuffer = nil);
|
||||
end;
|
||||
|
||||
function TCEFBitmapBitBuffer.GetScanline(y : integer) : PByte;
|
||||
begin
|
||||
if (FBuffer = nil) or (y >= FHeight) then
|
||||
Result := nil
|
||||
else
|
||||
begin
|
||||
Result := PByte(FBuffer);
|
||||
if (y > 0) then inc(Result, y * ScanlineSize);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEFBitmapBitBuffer.CreateBuffer;
|
||||
var
|
||||
TempLen : integer;
|
||||
begin
|
||||
TempLen := BufferLength;
|
||||
|
||||
if (TempLen > 0) then
|
||||
begin
|
||||
GetMem(FBuffer, TempLen);
|
||||
FillChar(FBuffer^, TempLen, $FF);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
@ -58,7 +58,7 @@ uses
|
||||
{$ENDIF}
|
||||
ExtCtrls, SyncObjs, SysUtils,
|
||||
{$ENDIF}
|
||||
{$IFDEF MSWINDOWS}uCEFOSRIMEHandler,{$ENDIF} uCEFConstants, uCEFTypes;
|
||||
{$IFDEF MSWINDOWS}uCEFOSRIMEHandler,{$ENDIF} uCEFConstants, uCEFTypes, uCEFBitmapBitBuffer;
|
||||
|
||||
type
|
||||
TOnIMECommitTextEvent = procedure(Sender: TObject; const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer) of object;
|
||||
@ -70,13 +70,13 @@ type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
|
||||
TBufferPanel = class(TCustomPanel)
|
||||
protected
|
||||
FMutex : THandle;
|
||||
FBuffer : TBitmap;
|
||||
FScanlineSize : integer;
|
||||
FTransparent : boolean;
|
||||
FOnPaintParentBkg : TNotifyEvent;
|
||||
FForcedDeviceScaleFactor : single;
|
||||
{$IFDEF MSWINDOWS}
|
||||
FBuffer : TBitmap;
|
||||
FSyncObj : THandle;
|
||||
FIMEHandler : TCEFOSRIMEHandler;
|
||||
FOnIMECancelComposition : TNotifyEvent;
|
||||
FOnIMECommitText : TOnIMECommitTextEvent;
|
||||
@ -85,6 +85,12 @@ type
|
||||
FOnPointerDown : TOnHandledMessageEvent;
|
||||
FOnPointerUp : TOnHandledMessageEvent;
|
||||
FOnPointerUpdate : TOnHandledMessageEvent;
|
||||
{$ELSE}
|
||||
FBuffer : TCEFBitmapBitBuffer;
|
||||
FPopupBuffer : TCEFBitmapBitBuffer;
|
||||
FBitmap : TBitmap;
|
||||
FSyncObj : TCriticalSection;
|
||||
FPopupScanlineSize : integer;
|
||||
{$ENDIF}
|
||||
|
||||
procedure CreateSyncObj;
|
||||
@ -100,6 +106,10 @@ type
|
||||
{$IFDEF MSWINDOWS}
|
||||
function GetParentFormHandle : TCefWindowHandle;
|
||||
function GetParentForm : TCustomForm;
|
||||
{$ELSE}
|
||||
function GetPopupBufferBits : pointer;
|
||||
function GetPopupBufferWidth : integer;
|
||||
function GetPopupBufferHeight : integer;
|
||||
{$ENDIF}
|
||||
|
||||
procedure SetTransparent(aValue : boolean);
|
||||
@ -136,17 +146,28 @@ type
|
||||
function BufferIsResized(aUseMutex : boolean = True) : boolean;
|
||||
procedure CreateIMEHandler;
|
||||
procedure ChangeCompositionRange(const selection_range : TCefRange; const character_bounds : TCefRectDynArray);
|
||||
{$IFNDEF MSWINDOWS}
|
||||
procedure DrawPopupBuffer(const aSrcRect, aDstRect : TRect);
|
||||
function UpdatePopupBufferDimensions(aWidth, aHeight : integer) : boolean;
|
||||
{$ENDIF}
|
||||
|
||||
property Buffer : TBitmap read FBuffer;
|
||||
property ScanlineSize : integer read FScanlineSize;
|
||||
property BufferWidth : integer read GetBufferWidth;
|
||||
property BufferHeight : integer read GetBufferHeight;
|
||||
property BufferBits : pointer read GetBufferBits;
|
||||
property ScreenScale : single read GetScreenScale;
|
||||
property ForcedDeviceScaleFactor : single read FForcedDeviceScaleFactor write FForcedDeviceScaleFactor;
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$IFDEF MSWINDOWS}
|
||||
property Buffer : TBitmap read FBuffer;
|
||||
property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;
|
||||
property ParentForm : TCustomForm read GetParentForm;
|
||||
{$ELSE}
|
||||
property Buffer : TCEFBitmapBitBuffer read FBuffer;
|
||||
property PopupBuffer : TCEFBitmapBitBuffer read FPopupBuffer;
|
||||
property PopupBufferWidth : integer read GetPopupBufferWidth;
|
||||
property PopupBufferHeight : integer read GetPopupBufferHeight;
|
||||
property PopupBufferBits : pointer read GetPopupBufferBits;
|
||||
property PopupScanlineSize : integer read FPopupScanlineSize;
|
||||
{$ENDIF}
|
||||
|
||||
property DockManager;
|
||||
@ -263,23 +284,29 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
System.Math,
|
||||
{$ELSE}
|
||||
Math,
|
||||
{$ENDIF}
|
||||
uCEFMiscFunctions, uCEFApplicationCore;
|
||||
|
||||
constructor TBufferPanel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
FMutex := 0;
|
||||
FBuffer := nil;
|
||||
FTransparent := False;
|
||||
FOnPaintParentBkg := nil;
|
||||
FScanlineSize := 0;
|
||||
|
||||
if (GlobalCEFApp <> nil) and (GlobalCEFApp.ForcedDeviceScaleFactor <> 0) then
|
||||
FForcedDeviceScaleFactor := GlobalCEFApp.ForcedDeviceScaleFactor
|
||||
else
|
||||
FForcedDeviceScaleFactor := 0;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$IFDEF MSWINDOWS}
|
||||
FSyncObj := 0;
|
||||
FIMEHandler := nil;
|
||||
FOnIMECancelComposition := nil;
|
||||
FOnIMECommitText := nil;
|
||||
@ -288,6 +315,11 @@ begin
|
||||
FOnPointerDown := nil;
|
||||
FOnPointerUp := nil;
|
||||
FOnPointerUpdate := nil;
|
||||
{$ELSE}
|
||||
FSyncObj := nil;
|
||||
FBitmap := nil;
|
||||
FPopupBuffer := nil;
|
||||
FPopupScanlineSize := 0;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -298,6 +330,8 @@ begin
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FIMEHandler <> nil) then FreeAndNil(FIMEHandler);
|
||||
{$ELSE}
|
||||
if (FBitmap <> nil) then FreeAndNil(FBitmap);
|
||||
{$ENDIF}
|
||||
|
||||
inherited Destroy;
|
||||
@ -334,21 +368,65 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
procedure TBufferPanel.DrawPopupBuffer(const aSrcRect, aDstRect : TRect);
|
||||
var
|
||||
src_y, dst_y, TempWidth : integer;
|
||||
src, dst : pointer;
|
||||
begin
|
||||
if (FBuffer = nil) or (FPopupBuffer = nil) then exit;
|
||||
|
||||
src_y := aSrcRect.Top;
|
||||
dst_y := aDstRect.Top;
|
||||
|
||||
TempWidth := min(aSrcRect.Right - aSrcRect.Left + 1,
|
||||
aDstRect.Right - aDstRect.Left + 1);
|
||||
|
||||
if (aSrcRect.Left + TempWidth >= FPopupBuffer.Width) then
|
||||
TempWidth := FPopupBuffer.Width - aSrcRect.Left;
|
||||
|
||||
if (aDstRect.Left + TempWidth >= FBuffer.Width) then
|
||||
TempWidth := FBuffer.Width - aDstRect.Left;
|
||||
|
||||
while (src_y <= aSrcRect.Bottom) and (src_y < FPopupBuffer.Height) and
|
||||
(dst_y <= aDstRect.Bottom) and (dst_y < FBuffer.Height) do
|
||||
begin
|
||||
src := FPopupBuffer.ScanLine[src_y];
|
||||
dst := FBuffer.ScanLine[dst_y];
|
||||
|
||||
if (aSrcRect.Left > 0) then
|
||||
inc(src, aSrcRect.Left * SizeOf(TRGBQuad));
|
||||
|
||||
if (aDstRect.Left > 0) then
|
||||
inc(dst, aDstRect.Left * SizeOf(TRGBQuad));
|
||||
|
||||
move(src^, dst^, TempWidth * SizeOf(TRGBQuad));
|
||||
|
||||
inc(src_y);
|
||||
inc(dst_y);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TBufferPanel.CreateSyncObj;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
FMutex := CreateMutex(nil, False, nil);
|
||||
FSyncObj := CreateMutex(nil, False, nil);
|
||||
{$ELSE}
|
||||
FSyncObj := TCriticalSection.Create;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TBufferPanel.DestroySyncObj;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FMutex <> 0) then
|
||||
if (FSyncObj <> 0) then
|
||||
begin
|
||||
CloseHandle(FMutex);
|
||||
FMutex := 0;
|
||||
CloseHandle(FSyncObj);
|
||||
FSyncObj := 0;
|
||||
end;
|
||||
{$ELSE}
|
||||
if (FSyncObj <> nil) then FreeAndNil(FSyncObj);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -356,7 +434,10 @@ procedure TBufferPanel.DestroyBuffer;
|
||||
begin
|
||||
if BeginBufferDraw then
|
||||
begin
|
||||
if (FBuffer <> nil) then FreeAndNil(FBuffer);
|
||||
if (FBuffer <> nil) then FreeAndNil(FBuffer);
|
||||
{$IFNDEF MSWINDOWS}
|
||||
if (FPopupBuffer <> nil) then FreeAndNil(FPopupBuffer);
|
||||
{$ENDIF}
|
||||
EndBufferDraw;
|
||||
end;
|
||||
end;
|
||||
@ -364,13 +445,20 @@ end;
|
||||
function TBufferPanel.SaveBufferToFile(const aFilename : string) : boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FBuffer <> nil) then
|
||||
begin
|
||||
FBuffer.SaveToFile(aFilename);
|
||||
Result := True;
|
||||
end;
|
||||
{$ELSE}
|
||||
if (FBitmap <> nil) then
|
||||
begin
|
||||
FBitmap.SaveToFile(aFilename);
|
||||
Result := True;
|
||||
end;
|
||||
{$ENDIF}
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TBufferPanel.SaveBufferToFile', e) then raise;
|
||||
@ -392,62 +480,116 @@ function TBufferPanel.InvalidatePanel : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
Result := HandleAllocated and PostMessage(Handle, CM_INVALIDATE, 0, 0);
|
||||
{$ELSE}
|
||||
Result := True;
|
||||
TThread.Queue(nil, @Invalidate);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBufferPanel.BeginBufferDraw : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
Result := (FMutex <> 0) and (WaitForSingleObject(FMutex, 5000) = WAIT_OBJECT_0);
|
||||
Result := (FSyncObj <> 0) and (WaitForSingleObject(FSyncObj, 5000) = WAIT_OBJECT_0);
|
||||
{$ELSE}
|
||||
if (FSyncObj <> nil) then
|
||||
begin
|
||||
FSyncObj.Acquire;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TBufferPanel.EndBufferDraw;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FMutex <> 0) then ReleaseMutex(FMutex);
|
||||
if (FSyncObj <> 0) then ReleaseMutex(FSyncObj);
|
||||
{$ELSE}
|
||||
if (FSyncObj <> nil) then FSyncObj.Release;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBufferPanel.CopyBuffer : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
{$IFDEF MSWINDOWS}
|
||||
TempFunction : TBlendFunction;
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
y : integer;
|
||||
src, dst : pointer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
if BeginBufferDraw then
|
||||
try
|
||||
if (FBuffer <> nil) then
|
||||
if (FBuffer <> nil) and (FBuffer.Width <> 0) and (FBuffer.Height <> 0) then
|
||||
begin
|
||||
if FTransparent then
|
||||
begin
|
||||
// TODO : To avoid flickering we should be using another bitmap
|
||||
// for the background image. We should blend "FBuffer" with the
|
||||
// "background bitmap" and then blit the result to the canvas.
|
||||
{$IFDEF MSWINDOWS}
|
||||
if FTransparent then
|
||||
begin
|
||||
// TODO : To avoid flickering we should be using another bitmap
|
||||
// for the background image. We should blend "FBuffer" with the
|
||||
// "background bitmap" and then blit the result to the canvas.
|
||||
|
||||
if assigned(FOnPaintParentBkg) then FOnPaintParentBkg(self);
|
||||
if assigned(FOnPaintParentBkg) then FOnPaintParentBkg(self);
|
||||
|
||||
TempFunction.BlendOp := AC_SRC_OVER;
|
||||
TempFunction.BlendFlags := 0;
|
||||
TempFunction.SourceConstantAlpha := 255;
|
||||
TempFunction.AlphaFormat := AC_SRC_ALPHA;
|
||||
TempFunction.BlendOp := AC_SRC_OVER;
|
||||
TempFunction.BlendFlags := 0;
|
||||
TempFunction.SourceConstantAlpha := 255;
|
||||
TempFunction.AlphaFormat := AC_SRC_ALPHA;
|
||||
|
||||
Result := AlphaBlend(Canvas.Handle, 0, 0, Width, Height,
|
||||
FBuffer.Canvas.Handle, 0, 0, FBuffer.Width, FBuffer.Height,
|
||||
TempFunction);
|
||||
end
|
||||
else
|
||||
Result := BitBlt(Canvas.Handle, 0, 0, Width, Height,
|
||||
FBuffer.Canvas.Handle, 0, 0,
|
||||
SrcCopy);
|
||||
Result := AlphaBlend(Canvas.Handle, 0, 0, Width, Height,
|
||||
FBuffer.Canvas.Handle, 0, 0, FBuffer.Width, FBuffer.Height,
|
||||
TempFunction);
|
||||
end
|
||||
else
|
||||
Result := BitBlt(Canvas.Handle, 0, 0, Width, Height,
|
||||
FBuffer.Canvas.Handle, 0, 0,
|
||||
SrcCopy);
|
||||
{$ELSE}
|
||||
try
|
||||
Canvas.Lock;
|
||||
|
||||
if (FBitmap = nil) then
|
||||
begin
|
||||
FBitmap := TBitmap.Create;
|
||||
FBitmap.PixelFormat := pf32bit;
|
||||
FBitmap.HandleType := bmDIB;
|
||||
FBitmap.Width := 1;
|
||||
FBitmap.Height := 1;
|
||||
end;
|
||||
|
||||
if (FBitmap.Width <> FBuffer.Width) or
|
||||
(FBitmap.Height <> FBuffer.Height) then
|
||||
begin
|
||||
FBitmap.Width := FBuffer.Width;
|
||||
FBitmap.Height := FBuffer.Height;
|
||||
FBitmap.Canvas.Brush.Color := clWhite;
|
||||
FBitmap.Canvas.FillRect(0, 0, FBitmap.Width, FBitmap.Height);
|
||||
end;
|
||||
|
||||
FBitmap.BeginUpdate;
|
||||
y := 0;
|
||||
while (y < FBitmap.Height) do
|
||||
begin
|
||||
src := FBuffer.ScanLine[y];
|
||||
dst := FBitmap.ScanLine[y];
|
||||
move(src^, dst^, FBuffer.ScanLineSize);
|
||||
inc(y);
|
||||
end;
|
||||
FBitmap.EndUpdate;
|
||||
|
||||
Canvas.Draw(0, 0, FBitmap);
|
||||
Result := True;
|
||||
finally
|
||||
Canvas.Unlock;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
finally
|
||||
EndBufferDraw;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TBufferPanel.Paint;
|
||||
@ -649,7 +791,13 @@ end;
|
||||
function TBufferPanel.GetBufferBits : pointer;
|
||||
begin
|
||||
if (FBuffer <> nil) then
|
||||
Result := FBuffer.Scanline[pred(FBuffer.Height)]
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
Result := FBuffer.Scanline[pred(FBuffer.Height)];
|
||||
{$ELSE}
|
||||
Result := FBuffer.BufferBits;
|
||||
{$ENDIF}
|
||||
end
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
@ -670,13 +818,46 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
function TBufferPanel.GetPopupBufferBits : pointer;
|
||||
begin
|
||||
if (FPopupBuffer <> nil) then
|
||||
Result := FPopupBuffer.BufferBits
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TBufferPanel.GetPopupBufferWidth : integer;
|
||||
begin
|
||||
if (FPopupBuffer <> nil) then
|
||||
Result := FPopupBuffer.Width
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TBufferPanel.GetPopupBufferHeight : integer;
|
||||
begin
|
||||
if (FPopupBuffer <> nil) then
|
||||
Result := FPopupBuffer.Height
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TBufferPanel.GetRealScreenScale(var aResultScale : single) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
{$IFDEF MSWINDOWS}
|
||||
TempHandle : TCefWindowHandle;
|
||||
TempDC : HDC;
|
||||
TempDPI : UINT;
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF FPC}
|
||||
TempForm : TCustomForm;
|
||||
TempMonitor : TMonitor;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
aResultScale := 1;
|
||||
@ -697,6 +878,26 @@ begin
|
||||
ReleaseDC(TempHandle, TempDC);
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF FPC}
|
||||
if (MainThreadID = GetCurrentThreadId()) then
|
||||
begin
|
||||
TempForm := GetParentForm(self, True);
|
||||
|
||||
if (TempForm <> nil) then
|
||||
begin
|
||||
TempMonitor := TempForm.Monitor;
|
||||
|
||||
if (TempMonitor <> nil) then
|
||||
begin
|
||||
aResultScale := TempMonitor.PixelsPerInch / USER_DEFAULT_SCREEN_DPI;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -764,12 +965,16 @@ end;
|
||||
|
||||
procedure TBufferPanel.BufferDraw(x, y : integer; const aBitmap : TBitmap);
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FBuffer <> nil) then FBuffer.Canvas.Draw(x, y, aBitmap);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TBufferPanel.BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect);
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (FBuffer <> nil) then FBuffer.Canvas.CopyRect(aDstRect, aBitmap.Canvas, aSrcRect);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TBufferPanel.UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
|
||||
@ -782,16 +987,39 @@ begin
|
||||
begin
|
||||
if (FBuffer <> nil) then FreeAndNil(FBuffer);
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
FBuffer := TBitmap.Create;
|
||||
FBuffer.PixelFormat := pf32bit;
|
||||
FBuffer.HandleType := bmDIB;
|
||||
FBuffer.HandleType := bmDIB;
|
||||
FBuffer.Width := aWidth;
|
||||
FBuffer.Height := aHeight;
|
||||
FScanlineSize := aWidth * SizeOf(TRGBQuad);
|
||||
{$ELSE}
|
||||
FBuffer := TCEFBitmapBitBuffer.Create(aWidth, aHeight);
|
||||
FScanlineSize := FBuffer.ScanlineSize;
|
||||
{$ENDIF}
|
||||
|
||||
FScanlineSize := FBuffer.Width * SizeOf(TRGBQuad);
|
||||
Result := True;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
function TBufferPanel.UpdatePopupBufferDimensions(aWidth, aHeight : integer) : boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if ((FPopupBuffer = nil) or
|
||||
(FPopupBuffer.Width <> aWidth) or
|
||||
(FPopupBuffer.Height <> aHeight)) then
|
||||
begin
|
||||
if (FPopupBuffer <> nil) then FreeAndNil(FPopupBuffer);
|
||||
|
||||
FPopupBuffer := TCEFBitmapBitBuffer.Create(aWidth, aHeight);
|
||||
FPopupScanlineSize := FPopupBuffer.ScanlineSize;
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TBufferPanel.BufferIsResized(aUseMutex : boolean) : boolean;
|
||||
var
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,6 +60,9 @@ uses
|
||||
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF}
|
||||
{$IFDEF DELPHI14_UP}Types, IOUtils,{$ENDIF} Classes, SysUtils, Math,
|
||||
{$IFDEF FPC}LCLType,{$IFNDEF MSWINDOWS}InterfaceBase, Forms,{$ENDIF}{$ENDIF}
|
||||
{$IFDEF LINUX}{$IFDEF FPC}{$IFDEF LCLGTK2}
|
||||
ctypes, keysym, gdk2, gtk2proc, gtk2int, xf86keysym,
|
||||
{$ENDIF}{$ENDIF}{$ENDIF}
|
||||
{$ENDIF}
|
||||
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
|
||||
uCEFRegisterCDMCallback, uCEFConstants;
|
||||
@ -305,6 +308,15 @@ function CefGetDataURI(aData : pointer; aSize : integer; const aMimeType : ustri
|
||||
function ValidCefWindowHandle(aHandle : TCefWindowHandle) : boolean;
|
||||
procedure InitializeWindowHandle(var aHandle : TCefWindowHandle);
|
||||
|
||||
{$IFDEF LINUX}{$IFDEF FPC}{$IFDEF LCLGTK2}
|
||||
procedure GdkEventKeyToCEFKeyEvent(GdkEvent: PGdkEventKey; var aCEFKeyEvent : TCEFKeyEvent);
|
||||
function KeyboardCodeFromXKeysym(keysym : cuint) : integer;
|
||||
function GetCefStateModifiers(state : cuint) : integer;
|
||||
function GdkEventToWindowsKeyCode(Event: PGdkEventKey) : integer;
|
||||
function GetWindowsKeyCodeWithoutLocation(key_code : integer) : integer;
|
||||
function GetControlCharacter(windows_key_code : integer; shift : boolean) : integer;
|
||||
{$ENDIF}{$ENDIF}{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -2257,10 +2269,23 @@ begin
|
||||
Result := trunc(MainScreen.backingScaleFactor);
|
||||
{$ELSE}
|
||||
{$IFDEF FPC}
|
||||
Result := screen.PrimaryMonitor.PixelsPerInch;
|
||||
if (Application <> nil) and
|
||||
(Application.MainForm <> nil) and
|
||||
(Application.MainForm.Monitor <> nil) then
|
||||
Result := Application.MainForm.Monitor.PixelsPerInch
|
||||
else
|
||||
if (screen <> nil) then
|
||||
begin
|
||||
if (WidgetSet <> nil) and (screen.PrimaryMonitor <> nil) then
|
||||
Result := screen.PrimaryMonitor.PixelsPerInch
|
||||
else
|
||||
Result := screen.PixelsPerInch;
|
||||
end
|
||||
else
|
||||
Result := USER_DEFAULT_SCREEN_DPI;
|
||||
{$ELSE}
|
||||
// TODO: Find a way to get the screen scale in Delphi FMX for Linux
|
||||
Result := 96;
|
||||
Result := USER_DEFAULT_SCREEN_DPI;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
@ -2418,4 +2443,496 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{$IFDEF LINUX}{$IFDEF FPC}{$IFDEF LCLGTK2}
|
||||
function KeyboardCodeFromXKeysym(keysym : cuint) : integer;
|
||||
begin
|
||||
case keysym of
|
||||
XK_BackSpace:
|
||||
Result := VKEY_BACK;
|
||||
XK_Delete,
|
||||
XK_KP_Delete:
|
||||
Result := VKEY_DELETE;
|
||||
XK_Tab,
|
||||
XK_KP_Tab,
|
||||
XK_ISO_Left_Tab,
|
||||
XK_3270_BackTab:
|
||||
Result := VKEY_TAB;
|
||||
XK_Linefeed,
|
||||
XK_Return,
|
||||
XK_KP_Enter,
|
||||
XK_ISO_Enter:
|
||||
Result := VKEY_Return;
|
||||
XK_Clear,
|
||||
XK_KP_Begin:
|
||||
Result := VKEY_CLEAR;
|
||||
XK_KP_Space,
|
||||
XK_space:
|
||||
Result := VKEY_SPACE;
|
||||
XK_Home,
|
||||
XK_KP_Home:
|
||||
Result := VKEY_HOME;
|
||||
XK_End,
|
||||
XK_KP_End:
|
||||
Result := VKEY_END;
|
||||
XK_Page_Up,
|
||||
XK_KP_Page_Up:
|
||||
Result := VKEY_PRIOR;
|
||||
XK_Page_Down,
|
||||
XK_KP_Page_Down:
|
||||
Result := VKEY_NEXT;
|
||||
XK_Left,
|
||||
XK_KP_Left:
|
||||
Result := VKEY_LEFT;
|
||||
XK_Right,
|
||||
XK_KP_Right:
|
||||
Result := VKEY_RIGHT;
|
||||
XK_Down,
|
||||
XK_KP_Down:
|
||||
Result := VKEY_DOWN;
|
||||
XK_Up,
|
||||
XK_KP_Up:
|
||||
Result := VKEY_UP;
|
||||
XK_Escape:
|
||||
Result := VKEY_ESCAPE;
|
||||
XK_Kana_Lock,
|
||||
XK_Kana_Shift:
|
||||
Result := VKEY_KANA;
|
||||
XK_Hangul:
|
||||
Result := VKEY_HANGUL;
|
||||
XK_Hangul_Hanja:
|
||||
Result := VKEY_HANJA;
|
||||
XK_Kanji:
|
||||
Result := VKEY_KANJI;
|
||||
XK_Henkan:
|
||||
Result := VKEY_CONVERT;
|
||||
XK_Muhenkan:
|
||||
Result := VKEY_NONCONVERT;
|
||||
XK_Zenkaku_Hankaku:
|
||||
Result := VKEY_DBE_DBCSCHAR;
|
||||
XKc_A,
|
||||
XK_a:
|
||||
Result := VKEY_A;
|
||||
XKc_B,
|
||||
XK_b:
|
||||
Result := VKEY_B;
|
||||
XKc_C,
|
||||
XK_c:
|
||||
Result := VKEY_C;
|
||||
XKc_D,
|
||||
XK_d:
|
||||
Result := VKEY_D;
|
||||
XKc_E,
|
||||
XK_e:
|
||||
Result := VKEY_E;
|
||||
XKc_F,
|
||||
XK_f:
|
||||
Result := VKEY_F;
|
||||
XKc_G,
|
||||
XK_g:
|
||||
Result := VKEY_G;
|
||||
XKc_H,
|
||||
XK_h:
|
||||
Result := VKEY_H;
|
||||
XKc_I,
|
||||
XK_i:
|
||||
Result := VKEY_I;
|
||||
XKc_J,
|
||||
XK_j:
|
||||
Result := VKEY_J;
|
||||
XKc_K,
|
||||
XK_k:
|
||||
Result := VKEY_K;
|
||||
XKc_L,
|
||||
XK_l:
|
||||
Result := VKEY_L;
|
||||
XKc_M,
|
||||
XK_m:
|
||||
Result := VKEY_M;
|
||||
XKc_N,
|
||||
XK_n:
|
||||
Result := VKEY_N;
|
||||
XKc_O,
|
||||
XK_o:
|
||||
Result := VKEY_O;
|
||||
XKc_P,
|
||||
XK_p:
|
||||
Result := VKEY_P;
|
||||
XKc_Q,
|
||||
XK_q:
|
||||
Result := VKEY_Q;
|
||||
XKc_R,
|
||||
XK_r:
|
||||
Result := VKEY_R;
|
||||
XKc_S,
|
||||
XK_s:
|
||||
Result := VKEY_S;
|
||||
XKc_T,
|
||||
XK_t:
|
||||
Result := VKEY_T;
|
||||
XKc_U,
|
||||
XK_u:
|
||||
Result := VKEY_U;
|
||||
XKc_V,
|
||||
XK_v:
|
||||
Result := VKEY_V;
|
||||
XKc_W,
|
||||
XK_w:
|
||||
Result := VKEY_W;
|
||||
XKc_X,
|
||||
XK_x:
|
||||
Result := VKEY_X;
|
||||
XKc_Y,
|
||||
XK_y:
|
||||
Result := VKEY_Y;
|
||||
XKc_Z,
|
||||
XK_z:
|
||||
Result := VKEY_Z;
|
||||
XK_0,
|
||||
XK_1,
|
||||
XK_2,
|
||||
XK_3,
|
||||
XK_4,
|
||||
XK_5,
|
||||
XK_6,
|
||||
XK_7,
|
||||
XK_8,
|
||||
XK_9:
|
||||
Result := VKEY_0 + (keysym - XK_0);
|
||||
XK_parenright:
|
||||
Result := VKEY_0;
|
||||
XK_exclam:
|
||||
Result := VKEY_1;
|
||||
XK_at:
|
||||
Result := VKEY_2;
|
||||
XK_numbersign:
|
||||
Result := VKEY_3;
|
||||
XK_dollar:
|
||||
Result := VKEY_4;
|
||||
XK_percent:
|
||||
Result := VKEY_5;
|
||||
XK_asciicircum:
|
||||
Result := VKEY_6;
|
||||
XK_ampersand:
|
||||
Result := VKEY_7;
|
||||
XK_asterisk:
|
||||
Result := VKEY_8;
|
||||
XK_parenleft:
|
||||
Result := VKEY_9;
|
||||
XK_KP_0,
|
||||
XK_KP_1,
|
||||
XK_KP_2,
|
||||
XK_KP_3,
|
||||
XK_KP_4,
|
||||
XK_KP_5,
|
||||
XK_KP_6,
|
||||
XK_KP_7,
|
||||
XK_KP_8,
|
||||
XK_KP_9:
|
||||
Result := VKEY_NUMPAD0 + (keysym - XK_KP_0);
|
||||
XK_multiply,
|
||||
XK_KP_Multiply:
|
||||
Result := VKEY_MULTIPLY;
|
||||
XK_KP_Add:
|
||||
Result := VKEY_ADD;
|
||||
XK_KP_Separator:
|
||||
Result := VKEY_SEPARATOR;
|
||||
XK_KP_Subtract:
|
||||
Result := VKEY_SUBTRACT;
|
||||
XK_KP_Decimal:
|
||||
Result := VKEY_DECIMAL;
|
||||
XK_KP_Divide:
|
||||
Result := VKEY_DIVIDE;
|
||||
XK_KP_Equal,
|
||||
XK_equal,
|
||||
XK_plus:
|
||||
Result := VKEY_OEM_PLUS;
|
||||
XK_comma,
|
||||
XK_less:
|
||||
Result := VKEY_OEM_COMMA;
|
||||
XK_minus,
|
||||
XK_underscore:
|
||||
Result := VKEY_OEM_MINUS;
|
||||
XK_greater,
|
||||
XK_period:
|
||||
Result := VKEY_OEM_PERIOD;
|
||||
XK_colon,
|
||||
XK_semicolon:
|
||||
Result := VKEY_OEM_1;
|
||||
XK_question,
|
||||
XK_slash:
|
||||
Result := VKEY_OEM_2;
|
||||
XK_asciitilde,
|
||||
XK_quoteleft:
|
||||
Result := VKEY_OEM_3;
|
||||
XK_bracketleft,
|
||||
XK_braceleft:
|
||||
Result := VKEY_OEM_4;
|
||||
XK_backslash,
|
||||
XK_bar:
|
||||
Result := VKEY_OEM_5;
|
||||
XK_bracketright,
|
||||
XK_braceright:
|
||||
Result := VKEY_OEM_6;
|
||||
XK_quoteright,
|
||||
XK_quotedbl:
|
||||
Result := VKEY_OEM_7;
|
||||
XK_ISO_Level5_Shift:
|
||||
Result := VKEY_OEM_8;
|
||||
XK_Shift_L,
|
||||
XK_Shift_R:
|
||||
Result := VKEY_SHIFT;
|
||||
XK_Control_L,
|
||||
XK_Control_R:
|
||||
Result := VKEY_CONTROL;
|
||||
XK_Meta_L,
|
||||
XK_Meta_R,
|
||||
XK_Alt_L,
|
||||
XK_Alt_R:
|
||||
Result := VKEY_MENU;
|
||||
XK_ISO_Level3_Shift:
|
||||
Result := VKEY_ALTGR;
|
||||
XK_Multi_key:
|
||||
Result := VKEY_COMPOSE;
|
||||
XK_Pause:
|
||||
Result := VKEY_PAUSE;
|
||||
XK_Caps_Lock:
|
||||
Result := VKEY_CAPITAL;
|
||||
XK_Num_Lock:
|
||||
Result := VKEY_NUMLOCK;
|
||||
XK_Scroll_Lock:
|
||||
Result := VKEY_SCROLL;
|
||||
XK_Select:
|
||||
Result := VKEY_SELECT;
|
||||
XK_Print:
|
||||
Result := VKEY_PRINT;
|
||||
XK_Execute:
|
||||
Result := VKEY_EXECUTE;
|
||||
XK_Insert,
|
||||
XK_KP_Insert:
|
||||
Result := VKEY_INSERT;
|
||||
XK_Help:
|
||||
Result := VKEY_HELP;
|
||||
XK_Super_L:
|
||||
Result := VKEY_LWIN;
|
||||
XK_Super_R:
|
||||
Result := VKEY_RWIN;
|
||||
XK_Menu:
|
||||
Result := VKEY_APPS;
|
||||
XK_F1,
|
||||
XK_F2,
|
||||
XK_F3,
|
||||
XK_F4,
|
||||
XK_F5,
|
||||
XK_F6,
|
||||
XK_F7,
|
||||
XK_F8,
|
||||
XK_F9,
|
||||
XK_F10,
|
||||
XK_F11,
|
||||
XK_F12,
|
||||
XK_F13,
|
||||
XK_F14,
|
||||
XK_F15,
|
||||
XK_F16,
|
||||
XK_F17,
|
||||
XK_F18,
|
||||
XK_F19,
|
||||
XK_F20,
|
||||
XK_F21,
|
||||
XK_F22,
|
||||
XK_F23,
|
||||
XK_F24:
|
||||
Result := VKEY_F1 + (keysym - XK_F1);
|
||||
XK_KP_F1,
|
||||
XK_KP_F2,
|
||||
XK_KP_F3,
|
||||
XK_KP_F4:
|
||||
Result := VKEY_F1 + (keysym - XK_KP_F1);
|
||||
XK_guillemotleft,
|
||||
XK_guillemotright,
|
||||
XK_degree,
|
||||
XK_ugrave,
|
||||
XKc_Ugrave,
|
||||
XK_brokenbar:
|
||||
Result := VKEY_OEM_102;
|
||||
XF86XK_Tools:
|
||||
Result := VKEY_F13;
|
||||
XF86XK_Launch5:
|
||||
Result := VKEY_F14;
|
||||
XF86XK_Launch6:
|
||||
Result := VKEY_F15;
|
||||
XF86XK_Launch7:
|
||||
Result := VKEY_F16;
|
||||
XF86XK_Launch8:
|
||||
Result := VKEY_F17;
|
||||
XF86XK_Launch9:
|
||||
Result := VKEY_F18;
|
||||
XF86XK_Refresh,
|
||||
XF86XK_History,
|
||||
XF86XK_OpenURL,
|
||||
XF86XK_AddFavorite,
|
||||
XF86XK_Go,
|
||||
XF86XK_ZoomIn,
|
||||
XF86XK_ZoomOut:
|
||||
Result := VKEY_UNKNOWN;
|
||||
XF86XK_Back:
|
||||
Result := VKEY_BROWSER_BACK;
|
||||
XF86XK_Forward:
|
||||
Result := VKEY_BROWSER_FORWARD;
|
||||
XF86XK_Reload:
|
||||
Result := VKEY_BROWSER_REFRESH;
|
||||
XF86XK_Stop:
|
||||
Result := VKEY_BROWSER_STOP;
|
||||
XF86XK_Search:
|
||||
Result := VKEY_BROWSER_SEARCH;
|
||||
XF86XK_Favorites:
|
||||
Result := VKEY_BROWSER_FAVORITES;
|
||||
XF86XK_HomePage:
|
||||
Result := VKEY_BROWSER_HOME;
|
||||
XF86XK_AudioMute:
|
||||
Result := VKEY_VOLUME_MUTE;
|
||||
XF86XK_AudioLowerVolume:
|
||||
Result := VKEY_VOLUME_DOWN;
|
||||
XF86XK_AudioRaiseVolume:
|
||||
Result := VKEY_VOLUME_UP;
|
||||
XF86XK_AudioNext:
|
||||
Result := VKEY_MEDIA_NEXT_TRACK;
|
||||
XF86XK_AudioPrev:
|
||||
Result := VKEY_MEDIA_PREV_TRACK;
|
||||
XF86XK_AudioStop:
|
||||
Result := VKEY_MEDIA_STOP;
|
||||
XF86XK_AudioPlay:
|
||||
Result := VKEY_MEDIA_PLAY_PAUSE;
|
||||
XF86XK_Mail:
|
||||
Result := VKEY_MEDIA_LAUNCH_MAIL;
|
||||
XF86XK_LaunchA:
|
||||
Result := VKEY_MEDIA_LAUNCH_APP1;
|
||||
XF86XK_LaunchB,
|
||||
XF86XK_Calculator:
|
||||
Result := VKEY_MEDIA_LAUNCH_APP2;
|
||||
XF86XK_WLAN:
|
||||
Result := VKEY_WLAN;
|
||||
XF86XK_PowerOff:
|
||||
Result := VKEY_POWER;
|
||||
XF86XK_MonBrightnessDown:
|
||||
Result := VKEY_BRIGHTNESS_DOWN;
|
||||
XF86XK_MonBrightnessUp:
|
||||
Result := VKEY_BRIGHTNESS_UP;
|
||||
XF86XK_KbdBrightnessDown:
|
||||
Result := VKEY_KBD_BRIGHTNESS_DOWN;
|
||||
XF86XK_KbdBrightnessUp:
|
||||
Result := VKEY_KBD_BRIGHTNESS_UP;
|
||||
else Result := VKEY_UNKNOWN;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetCefStateModifiers(state : cuint) : integer;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if ((state and GDK_SHIFT_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
|
||||
if ((state and GDK_LOCK_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_CAPS_LOCK_ON;
|
||||
|
||||
if ((state and GDK_CONTROL_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
|
||||
if ((state and GDK_MOD1_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
|
||||
if ((state and GDK_BUTTON1_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
|
||||
if ((state and GDK_BUTTON2_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
|
||||
if ((state and GDK_BUTTON3_MASK) <> 0) then
|
||||
Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function GdkEventToWindowsKeyCode(event: PGdkEventKey) : integer;
|
||||
var
|
||||
windows_key_code, keyval : integer;
|
||||
begin
|
||||
windows_key_code := KeyboardCodeFromXKeysym(event^.keyval);
|
||||
if (windows_key_code <> 0) then
|
||||
begin
|
||||
Result := windows_key_code;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (event^.hardware_keycode < length(kHardwareCodeToGDKKeyval)) then
|
||||
begin
|
||||
keyval := kHardwareCodeToGDKKeyval[event^.hardware_keycode];
|
||||
if (keyval <> 0) then
|
||||
begin
|
||||
Result := KeyboardCodeFromXKeysym(keyval);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := KeyboardCodeFromXKeysym(event^.keyval);
|
||||
end;
|
||||
|
||||
function GetWindowsKeyCodeWithoutLocation(key_code : integer) : integer;
|
||||
begin
|
||||
case key_code of
|
||||
VKEY_LCONTROL, VKEY_RCONTROL : Result := VKEY_CONTROL;
|
||||
VKEY_LSHIFT, VKEY_RSHIFT : Result := VKEY_SHIFT;
|
||||
VKEY_LMENU, VKEY_RMENU : Result := VKEY_MENU;
|
||||
else Result := key_code;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetControlCharacter(windows_key_code : integer; shift : boolean) : integer;
|
||||
begin
|
||||
if (windows_key_code >= VKEY_A) and (windows_key_code <= VKEY_Z) then
|
||||
Result := windows_key_code - VKEY_A + 1
|
||||
else
|
||||
if shift then
|
||||
case windows_key_code of
|
||||
VKEY_2 : Result := 0;
|
||||
VKEY_6 : Result := $1E;
|
||||
VKEY_OEM_MINUS : Result := $1F;
|
||||
else Result := 0;
|
||||
end
|
||||
else
|
||||
case windows_key_code of
|
||||
VKEY_OEM_4 : Result := $1B;
|
||||
VKEY_OEM_5 : Result := $1C;
|
||||
VKEY_OEM_6 : Result := $1D;
|
||||
VKEY_RETURN : Result := $0A;
|
||||
else Result := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure GdkEventKeyToCEFKeyEvent(GdkEvent: PGdkEventKey; var aCEFKeyEvent : TCEFKeyEvent);
|
||||
var
|
||||
windows_key_code : integer;
|
||||
begin
|
||||
windows_key_code := GdkEventToWindowsKeyCode(GdkEvent);
|
||||
aCEFKeyEvent.windows_key_code := GetWindowsKeyCodeWithoutLocation(windows_key_code);
|
||||
aCEFKeyEvent.native_key_code := GdkEvent^.hardware_keycode;
|
||||
aCEFKeyEvent.modifiers := GetCefStateModifiers(GdkEvent^.state);
|
||||
aCEFKeyEvent.focus_on_editable_field := 0;
|
||||
|
||||
if (GdkEvent^.keyval >= GDK_KP_Space) and (GdkEvent^.keyval <= GDK_KP_9) then
|
||||
aCEFKeyEvent.modifiers := aCEFKeyEvent.modifiers or EVENTFLAG_IS_KEY_PAD;
|
||||
|
||||
aCEFKeyEvent.is_system_key := ord((aCEFKeyEvent.modifiers and EVENTFLAG_ALT_DOWN) <> 0);
|
||||
|
||||
if (windows_key_code = VKEY_RETURN) then
|
||||
aCEFKeyEvent.unmodified_character := #13
|
||||
else
|
||||
aCEFKeyEvent.unmodified_character := WideChar(gdk_keyval_to_unicode(GdkEvent^.keyval));
|
||||
|
||||
if ((aCEFKeyEvent.modifiers and EVENTFLAG_CONTROL_DOWN) <> 0) then
|
||||
aCEFKeyEvent.character := WideChar(GetControlCharacter(windows_key_code, ((aCEFKeyEvent.modifiers and EVENTFLAG_SHIFT_DOWN) <> 0)))
|
||||
else
|
||||
aCEFKeyEvent.character := aCEFKeyEvent.unmodified_character;
|
||||
end;
|
||||
{$ENDIF}{$ENDIF}{$ENDIF}
|
||||
|
||||
end.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 212,
|
||||
"InternalVersion" : 213,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "87.1.12.0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user