diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/00-Delete.bat b/demos/Lazarus_Linux/OSRExternalPumpBrowser/00-Delete.bat
deleted file mode 100644
index 0b5ba5c8..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/00-Delete.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-rmdir /S /Q lib
-rmdir /S /Q backup
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi b/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi
deleted file mode 100644
index 363e8e12..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr b/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr
deleted file mode 100644
index 82841a86..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr
+++ /dev/null
@@ -1,78 +0,0 @@
-// ************************************************************************
-// ***************************** CEF4Delphi *******************************
-// ************************************************************************
-//
-// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
-// browser in Delphi applications.
-//
-// The original license of DCEF3 still applies to CEF4Delphi.
-//
-// For more information about CEF4Delphi visit :
-// https://www.briskbard.com/index.php?lang=en&pageid=cef
-//
-// Copyright © 2018 Salvador DÃaz Fau. All rights reserved.
-//
-// ************************************************************************
-// ************ vvvv Original license and comments below vvvv *************
-// ************************************************************************
-(*
- * Delphi Chromium Embedded 3
- *
- * Usage allowed under the restrictions of the Lesser GNU General Public License
- * or alternatively the restrictions of the Mozilla Public License 1.1
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- *
- * Unit owner : Henri Gourvest
- * Web site : http://www.progdigy.com
- * Repository : http://code.google.com/p/delphichromiumembedded/
- * Group : http://groups.google.com/group/delphichromiumembedded
- *
- * Embarcadero Technologies, Inc is not permitted to use or redistribute
- * this source code without explicit permission.
- *
- *)
-
-program OSRExternalPumpBrowser;
-
-{$MODE Delphi}
-
-{$I cef.inc}
-
-uses
- {$IFDEF UNIX}{$IFDEF UseCThreads}
- cthreads,
- cmem,
- {$ENDIF}{$ENDIF}
- Interfaces, Forms,
- uCEFApplication,
- uCEFWorkScheduler,
- uOSRExternalPumpBrowser in 'uOSRExternalPumpBrowser.pas' {OSRExternalPumpBrowserFrm};
-
-{.$R *.res}
-
-// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
-{$SetPEFlags $20}
-
-begin
- // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
- // https://github.com/salvadordf/CEF4Delphi/issues/89
- CreateGlobalCEFApp;
-
- if GlobalCEFApp.StartMainProcess then
- begin
- Application.Initialize;
- Application.CreateForm(TOSRExternalPumpBrowserFrm, OSRExternalPumpBrowserFrm);
- Application.Run;
-
- // The form needs to be destroyed *BEFORE* stopping the scheduler.
- OSRExternalPumpBrowserFrm.Free;
-
- GlobalCEFWorkScheduler.StopScheduler;
- end;
-
- DestroyGlobalCEFApp;
- DestroyGlobalCEFWorkScheduler;
-end.
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps b/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps
deleted file mode 100644
index 27bc655d..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/cef.inc b/demos/Lazarus_Linux/OSRExternalPumpBrowser/cef.inc
deleted file mode 100644
index a4c8d038..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/cef.inc
+++ /dev/null
@@ -1,456 +0,0 @@
-// ************************************************************************
-// ***************************** CEF4Delphi *******************************
-// ************************************************************************
-//
-// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
-// browser in Delphi applications.
-//
-// The original license of DCEF3 still applies to CEF4Delphi.
-//
-// For more information about CEF4Delphi visit :
-// https://www.briskbard.com/index.php?lang=en&pageid=cef
-//
-// Copyright © 2017 Salvador Diaz Fau. All rights reserved.
-//
-// ************************************************************************
-// ************ vvvv Original license and comments below vvvv *************
-// ************************************************************************
-(*
- * Delphi Chromium Embedded 3
- *
- * Usage allowed under the restrictions of the Lesser GNU General Public License
- * or alternatively the restrictions of the Mozilla Public License 1.1
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- * the specific language governing rights and limitations under the License.
- *
- * Unit owner : Henri Gourvest
- * Web site : http://www.progdigy.com
- * Repository : http://code.google.com/p/delphichromiumembedded/
- * Group : http://groups.google.com/group/delphichromiumembedded
- *
- * Embarcadero Technologies, Inc is not permitted to use or redistribute
- * this source code without explicit permission.
- *
- *)
-
- // The complete list of compiler versions is here :
- // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
-
-{$DEFINE DELPHI_VERSION_UNKNOW}
-
-// Delphi 5
-{$IFDEF VER130}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
-{$ENDIF}
-
-// Delphi 6
-{$IFDEF VER140}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
-{$ENDIF}
-
-// Delphi 7
-{$IFDEF VER150}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
-{$ENDIF}
-
-// Delphi 8
-{$IFDEF VER160}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
-{$ENDIF}
-
-// Delphi 2005
-{$IFDEF VER170}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
-{$ENDIF}
-
-{$IFDEF VER180}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- // Delphi 2007
- {$IFDEF VER185}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- // Delphi 2006
- {$ELSE}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$ENDIF}
-{$ENDIF}
-
-// Delphi 2009
-{$IFDEF VER200}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
-{$ENDIF}
-
-//Delphi 2010
-{$IFDEF VER210}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
-{$ENDIF}
-
-// Delphi XE
-{$IFDEF VER220}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
-{$ENDIF}
-
-// Delphi XE2 (First FireMonkey and 64bit compiler)
-{$IFDEF VER230}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
-{$ENDIF}
-
-// Delphi XE3
-{$IFDEF VER240}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
-{$ENDIF}
-
-// Delphi XE4
-{$IFDEF VER250}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
-{$ENDIF}
-
-// Delphi XE5
-{$IFDEF VER260}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
-{$ENDIF}
-
-// Delphi XE6
-{$IFDEF VER270}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
-{$ENDIF}
-
-// Delphi XE7
-{$IFDEF VER280}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
-{$ENDIF}
-
-// Delphi XE8
-{$IFDEF VER290}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
-{$ENDIF VER290}
-
-// Rad Studio 10 - Delphi Seattle
-{$IFDEF VER300}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
-{$ENDIF}
-
-// Rad Studio 10.1 - Delphi Berlin
-{$IFDEF VER310}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
- {$DEFINE DELPHI24_UP}
-{$ENDIF}
-
-// Rad Studio 10.2 - Delphi Tokyo
-{$IFDEF VER320}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
- {$DEFINE DELPHI24_UP}
- {$DEFINE DELPHI25_UP}
-{$ENDIF}
-
-// Rad Studio 10.3 - Delphi Rio
-{$IFDEF VER330}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
- {$DEFINE DELPHI24_UP}
- {$DEFINE DELPHI25_UP}
- {$DEFINE DELPHI26_UP}
-{$ENDIF}
-
-// Rad Studio 10.4 - Delphi Sydney
-{$IFDEF VER340}
- {$UNDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
- {$DEFINE DELPHI24_UP}
- {$DEFINE DELPHI25_UP}
- {$DEFINE DELPHI26_UP}
- {$DEFINE DELPHI27_UP}
-{$ENDIF}
-
-{$IFDEF FPC}
- {$DEFINE SUPPORTS_INLINE}
- {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
- {$DEFINE FPC_VER_320}
- {$IFEND}
-{$ELSE}
- {$IFDEF DELPHI_VERSION_UNKNOW}
- {$DEFINE DELPHI5_UP}
- {$DEFINE DELPHI6_UP}
- {$DEFINE DELPHI7_UP}
- {$DEFINE DELPHI8_UP}
- {$DEFINE DELPHI9_UP}
- {$DEFINE DELPHI10_UP}
- {$DEFINE DELPHI11_UP}
- {$DEFINE DELPHI12_UP}
- {$DEFINE DELPHI14_UP}
- {$DEFINE DELPHI15_UP}
- {$DEFINE DELPHI16_UP}
- {$DEFINE DELPHI17_UP}
- {$DEFINE DELPHI18_UP}
- {$DEFINE DELPHI19_UP}
- {$DEFINE DELPHI20_UP}
- {$DEFINE DELPHI21_UP}
- {$DEFINE DELPHI22_UP}
- {$DEFINE DELPHI23_UP}
- {$DEFINE DELPHI24_UP}
- {$DEFINE DELPHI25_UP}
- {$DEFINE DELPHI26_UP}
- {$DEFINE DELPHI27_UP}
- {$ENDIF}
-{$ENDIF}
-
-{$IFDEF DELPHI9_UP}
- {$DEFINE SUPPORTS_INLINE}
-{$ENDIF}
-
-{$IF DEFINED(CPUX32) OR
- DEFINED(CPU386) OR
- DEFINED(CPUi386) OR
- DEFINED(CPUPOWERPC32) OR
- DEFINED(CPUSPARC32) OR
- DEFINED(CPU32BITS) OR
- DEFINED(CPUARM32) OR
- DEFINED(WIN32) OR
- DEFINED(IOS32) OR
- DEFINED(MACOS32) OR
- DEFINED(LINUX32) OR
- DEFINED(POSIX32) OR
- DEFINED(ANDROID32)}
- {$DEFINE TARGET_32BITS}
-{$IFEND}
-
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm b/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm
deleted file mode 100644
index b807a02f..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm
+++ /dev/null
@@ -1,143 +0,0 @@
-object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
- Left = 293
- Height = 584
- Top = 210
- Width = 913
- Caption = 'Initializing browser. Please wait...'
- ClientHeight = 584
- ClientWidth = 913
- Color = clBtnFace
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'Tahoma'
- OnCloseQuery = FormCloseQuery
- OnCreate = FormCreate
- OnDestroy = FormDestroy
- OnHide = FormHide
- OnShow = FormShow
- Position = poScreenCenter
- LCLVersion = '2.0.10.0'
- object NavControlPnl: TPanel
- Left = 0
- Height = 21
- Top = 0
- Width = 913
- Align = alTop
- BevelOuter = bvNone
- ClientHeight = 21
- ClientWidth = 913
- Enabled = False
- TabOrder = 0
- object ComboBox1: TComboBox
- Left = 0
- Height = 21
- Top = 0
- Width = 844
- Align = alClient
- ItemHeight = 0
- ItemIndex = 0
- Items.Strings = (
- 'https://www.google.com'
- 'https://html5demos.com/drag'
- 'https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_select_form'
- 'https://www.briskbard.com'
- 'https://frames-per-second.appspot.com/'
- 'https://www.youtube.com'
- )
- OnEnter = ComboBox1Enter
- TabOrder = 0
- Text = 'https://www.google.com'
- end
- object Panel2: TPanel
- Left = 844
- Height = 21
- Top = 0
- Width = 69
- Align = alRight
- BevelOuter = bvNone
- ClientHeight = 21
- ClientWidth = 69
- TabOrder = 1
- object GoBtn: TButton
- Left = 0
- Height = 21
- Top = 0
- Width = 31
- Align = alLeft
- Caption = 'Go'
- OnClick = GoBtnClick
- OnEnter = GoBtnEnter
- TabOrder = 0
- end
- object SnapshotBtn: TButton
- Left = 38
- Height = 21
- Hint = 'Take snapshot'
- Top = 0
- Width = 31
- Align = alRight
- Caption = 'µ'
- Font.CharSet = SYMBOL_CHARSET
- Font.Color = clWindowText
- Font.Height = -24
- Font.Name = 'Webdings'
- OnClick = SnapshotBtnClick
- OnEnter = SnapshotBtnEnter
- ParentFont = False
- ParentShowHint = False
- ShowHint = True
- TabOrder = 1
- end
- end
- end
- object Panel1: TBufferPanel
- Left = 0
- Height = 563
- Top = 21
- Width = 913
- Align = alClient
- OnUTF8KeyPress = Panel1UTF8KeyPress
- Caption = 'Panel1'
- TabOrder = 1
- TabStop = True
- OnClick = Panel1Click
- OnEnter = Panel1Enter
- OnExit = Panel1Exit
- OnMouseDown = Panel1MouseDown
- OnMouseMove = Panel1MouseMove
- OnMouseUp = Panel1MouseUp
- OnMouseWheel = Panel1MouseWheel
- OnKeyDown = Panel1KeyDown
- OnKeyUp = Panel1KeyUp
- OnResize = Panel1Resize
- end
- object chrmosr: TChromium
- OnTooltip = chrmosrTooltip
- OnCursorChange = chrmosrCursorChange
- OnBeforePopup = chrmosrBeforePopup
- OnAfterCreated = chrmosrAfterCreated
- OnBeforeClose = chrmosrBeforeClose
- OnGetViewRect = chrmosrGetViewRect
- OnGetScreenPoint = chrmosrGetScreenPoint
- OnGetScreenInfo = chrmosrGetScreenInfo
- OnPopupShow = chrmosrPopupShow
- OnPopupSize = chrmosrPopupSize
- OnPaint = chrmosrPaint
- Left = 24
- Top = 56
- end
- object SaveDialog1: TSaveDialog
- Title = 'Save snapshot'
- DefaultExt = '.bmp'
- Filter = 'Bitmap files (*.bmp)|*.BMP'
- Left = 24
- Top = 278
- end
- object Timer1: TTimer
- Enabled = False
- Interval = 300
- OnTimer = Timer1Timer
- Left = 24
- Top = 206
- end
-end
diff --git a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas b/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas
deleted file mode 100644
index 56a28a5c..00000000
--- a/demos/Lazarus_Linux/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas
+++ /dev/null
@@ -1,732 +0,0 @@
-// ************************************************************************
-// ***************************** 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
- * Web site : http://www.progdigy.com
- * Repository : http://code.google.com/p/delphichromiumembedded/
- * Group : http://groups.google.com/group/delphichromiumembedded
- *
- * Embarcadero Technologies, Inc is not permitted to use or redistribute
- * this source code without explicit permission.
- *
- *)
-
-unit uOSRExternalPumpBrowser;
-
-{$MODE OBJFPC}{$H+}
-
-{$I cef.inc}
-
-interface
-
-uses
- Classes, SysUtils, LCLType, Variants, SyncObjs, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, Types,
- uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
- uCEFWorkScheduler;
-
-type
-
- { TOSRExternalPumpBrowserFrm }
-
- TOSRExternalPumpBrowserFrm = class(TForm)
- NavControlPnl: TPanel;
- chrmosr: TChromium;
- ComboBox1: TComboBox;
- Panel2: TPanel;
- GoBtn: TButton;
- SnapshotBtn: TButton;
- SaveDialog1: TSaveDialog;
- Timer1: TTimer;
- Panel1: TBufferPanel;
-
- procedure GoBtnClick(Sender: TObject);
- procedure GoBtnEnter(Sender: TObject);
-
- procedure Panel1Enter(Sender: TObject);
- procedure Panel1Exit(Sender: TObject);
- procedure Panel1Resize(Sender: TObject);
- procedure Panel1Click(Sender: TObject);
- procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
- procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
- procedure Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
- procedure Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
-
- procedure FormCreate(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure FormHide(Sender: TObject);
- procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
-
- procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer);
- procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; aCursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
- procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
- procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
- procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
- procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
- procedure chrmosrPopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
- procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
- procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
- procedure chrmosrBeforePopup(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 chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
-
- procedure SnapshotBtnClick(Sender: TObject);
- procedure SnapshotBtnEnter(Sender: TObject);
-
- procedure Timer1Timer(Sender: TObject);
- procedure ComboBox1Enter(Sender: TObject);
-
- protected
- FbFirst : boolean;
- FPopUpBitmap : TBitmap;
- FPopUpRect : TRect;
- FShowPopUp : boolean;
- FResizing : boolean;
- FPendingResize : boolean;
- FCanClose : boolean;
- FClosing : boolean;
- FResizeCS : TCriticalSection;
-
- function SendCompMessage(aMsg : cardinal) : boolean;
- function getModifiers(Shift: TShiftState): TCefEventFlags;
- function GetButton(Button: TMouseButton): TCefMouseButtonType;
- procedure DoResize;
-
- procedure BrowserCreated(Data: PtrInt);
- procedure BrowserCloseForm(Data: PtrInt);
- procedure PendingResize(Data: PtrInt);
- procedure PendingInvalidate(Data: PtrInt);
-
- public
- { Public declarations }
- end;
-
-var
- OSRExternalPumpBrowserFrm : TOSRExternalPumpBrowserFrm;
-
-// This is a simple browser in OSR mode (off-screen rendering).
-// It was necessary to destroy the browser following the destruction sequence described in
-// the MDIBrowser demo but in OSR mode there are some modifications.
-
-// This is the destruction sequence in OSR mode :
-// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
-// 2- chrmosr.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 sends WM_CLOSE to the form.
-
-procedure CreateGlobalCEFApp;
-procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
-
-implementation
-
-{$R *.lfm}
-
-uses
- Math,
- uCEFMiscFunctions, uCEFApplication;
-
-procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
-begin
- if (GlobalCEFWorkScheduler <> nil) then
- GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
-end;
-
-procedure CreateGlobalCEFApp;
-var
- TempHome, TempBinDir : ustring;
-begin
- TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
- TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
-
- // TCEFWorkScheduler will call cef_do_message_loop_work when
- // it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
- // GlobalCEFWorkScheduler needs to be created before the
- // GlobalCEFApp.StartMainProcess call.
- GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
-
- GlobalCEFApp := TCefApplication.Create;
- GlobalCEFApp.WindowlessRenderingEnabled := True;
- GlobalCEFApp.EnableHighDPISupport := True;
- GlobalCEFApp.ExternalMessagePump := True;
- GlobalCEFApp.MultiThreadedMessageLoop := False;
- GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
- GlobalCEFApp.SetCurrentDir := True;
-
- if DirectoryExists(TempBinDir) then
- begin
- GlobalCEFApp.FrameworkDirPath := TempBinDir;
- GlobalCEFApp.ResourcesDirPath := TempBinDir;
- GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
- end;
-
- // Add a debug log in the BIN directory
- GlobalCEFApp.LogFile := 'cef.log';
- GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.GoBtnClick(Sender: TObject);
-begin
- FResizeCS.Acquire;
- FResizing := False;
- FPendingResize := False;
- FResizeCS.Release;
-
- chrmosr.LoadURL(ComboBox1.Text);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.GoBtnEnter(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(False);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
-begin
- SendCompMessage(CEF_AFTERCREATED);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
-begin
- FCanClose := True;
- SendCompMessage(CEF_BEFORECLOSE);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.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);
-
- chrmosr.SendKeyEvent(@TempKeyEvent);
- end;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrBeforePopup(Sender: TObject;
- const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
- targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
- userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
- var windowInfo: TCefWindowInfo; var client: ICefClient;
- var settings: TCefBrowserSettings;
- var extra_info: ICefDictionaryValue;
- var noJavascriptAccess: Boolean;
- var Result: Boolean);
-begin
- // For simplicity, this demo blocks all popup windows and new tabs
- Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrCursorChange(Sender : TObject;
- const browser : ICefBrowser;
- aCursor : HICON;
- cursorType : TCefCursorType;
- const customCursorInfo : PCefCursorInfo;
- var aResult : boolean);
-begin
- Panel1.Cursor := CefCursorToWindowsCursor(cursorType);
- aResult := True;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenInfo(Sender : TObject;
- const browser : ICefBrowser;
- var screenInfo : TCefScreenInfo;
- out Result : Boolean);
-var
- TempRect : TCEFRect;
- TempScale : single;
-begin
- TempScale := Panel1.ScreenScale;
- TempRect.x := 0;
- TempRect.y := 0;
- TempRect.width := DeviceToLogical(Panel1.Width, TempScale);
- TempRect.height := DeviceToLogical(Panel1.Height, TempScale);
-
- screenInfo.device_scale_factor := TempScale;
- screenInfo.depth := 0;
- screenInfo.depth_per_component := 0;
- screenInfo.is_monochrome := Ord(False);
- screenInfo.rect := TempRect;
- screenInfo.available_rect := TempRect;
-
- Result := True;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenPoint(Sender: TObject;
- const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
- screenY: Integer; out Result: Boolean);
-var
- TempScreenPt, TempViewPt : TPoint;
- TempScale : single;
-begin
- TempScale := Panel1.ScreenScale;
- TempViewPt.x := LogicalToDevice(viewX, TempScale);
- TempViewPt.y := LogicalToDevice(viewY, TempScale);
- TempScreenPt := Panel1.ClientToScreen(TempViewPt);
- screenX := TempScreenPt.x;
- screenY := TempScreenPt.y;
- Result := True;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrGetViewRect(Sender : TObject;
- const browser : ICefBrowser;
- var rect : TCefRect);
-var
- TempScale : single;
-begin
- TempScale := Panel1.ScreenScale;
- rect.x := 0;
- rect.y := 0;
- rect.width := DeviceToLogical(Panel1.Width, TempScale);
- rect.height := DeviceToLogical(Panel1.Height, TempScale);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrPaint(Sender: TObject; const browser: ICefBrowser;
- kind: TCefPaintElementType; dirtyRectsCount: NativeUInt;
- const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth,
- aHeight: Integer);
-var
- src, dst: PByte;
- i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer;
- n : NativeUInt;
- TempWidth, TempHeight : integer;
- TempBufferBits : Pointer;
- TempForcedResize : boolean;
- TempBitmap : TBitmap;
- TempSrcRect : TRect;
-begin
- try
- FResizeCS.Acquire;
- TempForcedResize := False;
-
- if Panel1.BeginBufferDraw then
- begin
- if (kind = PET_POPUP) then
- begin
- if (FPopUpBitmap = nil) or
- (aWidth <> FPopUpBitmap.Width) or
- (aHeight <> FPopUpBitmap.Height) then
- begin
- if (FPopUpBitmap <> nil) then FPopUpBitmap.Free;
-
- 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;
- end
- else
- begin
- TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
-
- TempBitmap := Panel1.Buffer;
- TempBitmap.BeginUpdate;
-
- TempWidth := Panel1.BufferWidth;
- TempHeight := Panel1.BufferHeight;
- end;
-
- SrcStride := aWidth * SizeOf(TRGBQuad);
- n := 0;
-
- while (n < dirtyRectsCount) do
- begin
- if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
- begin
- TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
-
- if (TempLineSize > 0) then
- begin
- TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
- TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
-
- src := @PByte(buffer)[TempSrcOffset];
-
- i := 0;
- j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
-
- while (i < j) do
- begin
- TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
- dst := @PByte(TempBufferBits)[TempDstOffset];
-
- Move(src^, dst^, TempLineSize);
-
- Inc(src, SrcStride);
- inc(i);
- end;
- end;
- end;
-
- inc(n);
- end;
-
- TempBitmap.EndUpdate;
-
- if FShowPopup and (FPopUpBitmap <> nil) then
- begin
- TempSrcRect := Rect(0, 0,
- min(FPopUpRect.Right - FPopUpRect.Left, FPopUpBitmap.Width),
- min(FPopUpRect.Bottom - FPopUpRect.Top, FPopUpBitmap.Height));
-
- Panel1.BufferDraw(FPopUpBitmap, TempSrcRect, FPopUpRect);
- end;
-
- Panel1.EndBufferDraw;
-
- SendCompMessage(CEF_PENDINGINVALIDATE);
-
- if (kind = PET_VIEW) then
- begin
- if TempForcedResize or FPendingResize then
- SendCompMessage(CEF_PENDINGRESIZE);
-
- FResizing := False;
- FPendingResize := False;
- end;
- end;
- finally
- FResizeCS.Release;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrPopupShow(Sender : TObject;
- const browser : ICefBrowser;
- aShow : Boolean);
-begin
- if aShow then
- FShowPopUp := True
- else
- begin
- FShowPopUp := False;
- FPopUpRect := rect(0, 0, 0, 0);
-
- if (chrmosr <> nil) then chrmosr.Invalidate(PET_VIEW);
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrPopupSize(Sender : TObject;
- const browser : ICefBrowser;
- const rect : PCefRect);
-begin
- LogicalToDevice(rect^, Panel1.ScreenScale);
-
- FPopUpRect.Left := rect^.x;
- FPopUpRect.Top := rect^.y;
- FPopUpRect.Right := rect^.x + rect^.width - 1;
- FPopUpRect.Bottom := rect^.y + rect^.height - 1;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
-begin
- Panel1.hint := aText;
- Panel1.ShowHint := (length(aText) > 0);
- Result := True;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.ComboBox1Enter(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(False);
-end;
-
-function TOSRExternalPumpBrowserFrm.SendCompMessage(aMsg : cardinal) : boolean;
-begin
- case aMsg of
- CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreated, 0);
- CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseForm, 0);
- CEF_PENDINGRESIZE : Application.QueueAsyncCall(@PendingResize, 0);
- CEF_PENDINGINVALIDATE : Application.QueueAsyncCall(@PendingInvalidate, 0);
- end;
-end;
-
-function TOSRExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
-begin
- Result := EVENTFLAG_NONE;
-
- if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
- if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
- if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
- if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
- if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
- if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
-end;
-
-function TOSRExternalPumpBrowserFrm.GetButton(Button: TMouseButton): TCefMouseButtonType;
-begin
- case Button of
- TMouseButton.mbRight : Result := MBT_RIGHT;
- TMouseButton.mbMiddle : Result := MBT_MIDDLE;
- else Result := MBT_LEFT;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.BrowserCreated(Data: PtrInt);
-begin
- Caption := 'Simple Lazarus OSR Browser';
- NavControlPnl.Enabled := True;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.BrowserCloseForm(Data: PtrInt);
-begin
- Close;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.PendingResize(Data: PtrInt);
-begin
- DoResize;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.PendingInvalidate(Data: PtrInt);
-begin
- Panel1.Invalidate;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
-begin
- CanClose := FCanClose;
-
- if not(FClosing) then
- begin
- FClosing := True;
- Visible := False;
- chrmosr.CloseBrowser(True);
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.FormCreate(Sender: TObject);
-begin
- FbFirst := False;
- FPopUpBitmap := nil;
- FPopUpRect := rect(0, 0, 0, 0);
- FShowPopUp := False;
- FResizing := False;
- FPendingResize := False;
- FCanClose := False;
- FClosing := False;
- FResizeCS := TCriticalSection.Create;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.FormDestroy(Sender: TObject);
-begin
- if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
- if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.FormHide(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(False);
- chrmosr.WasHidden(True);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.FormShow(Sender: TObject);
-begin
- if chrmosr.Initialized then
- begin
- chrmosr.WasHidden(False);
- chrmosr.SendFocusEvent(True);
- end
- else
- begin
- // opaque white background color
- chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
- chrmosr.DefaultURL := ComboBox1.Text;
-
- if not(chrmosr.CreateBrowser(nil, '')) then
- Timer1.Enabled := True;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1Click(Sender: TObject);
-begin
- Panel1.SetFocus;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
-var
- TempEvent : TCefMouseEvent;
-begin
- Panel1.SetFocus;
-
- TempEvent.x := X;
- TempEvent.y := Y;
- TempEvent.modifiers := getModifiers(Shift);
- DeviceToLogical(TempEvent, Panel1.ScreenScale);
- chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
-var
- TempEvent : TCefMouseEvent;
-begin
- TempEvent.x := x;
- TempEvent.y := y;
- TempEvent.modifiers := getModifiers(Shift);
- DeviceToLogical(TempEvent, Panel1.ScreenScale);
- chrmosr.SendMouseMoveEvent(@TempEvent, False);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
-var
- TempEvent : TCefMouseEvent;
-begin
- TempEvent.x := X;
- TempEvent.y := Y;
- TempEvent.modifiers := getModifiers(Shift);
- DeviceToLogical(TempEvent, Panel1.ScreenScale);
- chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1Resize(Sender: TObject);
-begin
- DoResize;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.DoResize;
-begin
- try
- FResizeCS.Acquire;
-
- if FResizing then
- FPendingResize := True
- else
- if Panel1.BufferIsResized then
- chrmosr.Invalidate(PET_VIEW)
- else
- begin
- FResizing := True;
- chrmosr.WasResized;
- end;
- finally
- FResizeCS.Release;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1Enter(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(True);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1Exit(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(False);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
-var
- TempKeyEvent : TCefKeyEvent;
-begin
- if (Key <> 0) and (chrmosr <> 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);
-
- chrmosr.SendKeyEvent(@TempKeyEvent);
-
- if (Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then Key := 0;
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
-var
- TempKeyEvent : TCefKeyEvent;
-begin
- if (Key <> 0) and (chrmosr <> 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);
-
- chrmosr.SendKeyEvent(@TempKeyEvent);
- end;
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
- WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
-var
- TempEvent : TCefMouseEvent;
-begin
- TempEvent.x := MousePos.x;
- TempEvent.y := MousePos.y;
- TempEvent.modifiers := getModifiers(Shift);
- DeviceToLogical(TempEvent, Panel1.ScreenScale);
- chrmosr.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject);
-begin
- if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.SnapshotBtnEnter(Sender: TObject);
-begin
- chrmosr.SendFocusEvent(False);
-end;
-
-procedure TOSRExternalPumpBrowserFrm.Timer1Timer(Sender: TObject);
-begin
- Timer1.Enabled := False;
-
- if not(chrmosr.CreateBrowser(nil, '')) and
- not(chrmosr.Initialized) then
- Timer1.Enabled := True;
-end;
-
-end.
diff --git a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi
index 63a58329..7f3a0951 100644
--- a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi
+++ b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi
@@ -33,7 +33,7 @@
-
+
@@ -46,6 +46,11 @@
+
+
+
+
+
diff --git a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr
index 26442745..fb0cfc9b 100644
--- a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr
+++ b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr
@@ -42,8 +42,9 @@ program SimpleBrowser2;
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
- cmem,
- {$ENDIF}{$ENDIF}
+ {$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, uSimpleBrowser2,
{ 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.CreateForm(TForm1, Form1);
- Application.Run;
+ Application.Run;
+ CustomWidgetSetFinalization;
end;
DestroyGlobalCEFApp;
diff --git a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps
index e65bf505..850d37a5 100644
--- a/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps
+++ b/demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps
@@ -3,15 +3,14 @@
-
+
-
-
-
-
-
+
+
+
+
@@ -20,138 +19,522 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm b/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm
index f1b11fb4..fc229b62 100644
--- a/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm
+++ b/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm
@@ -1,23 +1,16 @@
object Form1: TForm1
- Left = 450
+ Left = 768
Height = 589
- Top = 267
+ Top = 220
Width = 967
Caption = 'Initializing browser. Please wait...'
ClientHeight = 589
ClientWidth = 967
+ OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
- OnShow = FormShow
- LCLVersion = '2.0.6.0'
- object CEFWindowParent1: TCEFWindowParent
- Left = 0
- Height = 566
- Top = 23
- Width = 967
- Align = alClient
- TabOrder = 0
- end
+ Position = poScreenCenter
+ LCLVersion = '2.0.10.0'
object AddressPnl: TPanel
Left = 0
Height = 23
@@ -27,7 +20,8 @@ object Form1: TForm1
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 967
- TabOrder = 1
+ Enabled = False
+ TabOrder = 0
object GoBtn: TButton
Left = 932
Height = 23
@@ -48,19 +42,31 @@ object Form1: TForm1
Text = 'https://www.google.com'
end
end
+ object CEFLinkedWindowParent1: TCEFLinkedWindowParent
+ Left = 0
+ Height = 566
+ Top = 23
+ Width = 967
+ Align = alClient
+ TabStop = True
+ TabOrder = 1
+ OnEnter = CEFLinkedWindowParent1Enter
+ OnExit = CEFLinkedWindowParent1Exit
+ Chromium = Chromium1
+ end
object Chromium1: TChromium
OnBeforePopup = Chromium1BeforePopup
OnAfterCreated = Chromium1AfterCreated
OnBeforeClose = Chromium1BeforeClose
OnClose = Chromium1Close
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
- left = 56
- top = 80
+ Left = 56
+ Top = 80
end
object Timer1: TTimer
Enabled = False
OnTimer = Timer1Timer
- left = 56
- top = 160
+ Left = 56
+ Top = 160
end
end
diff --git a/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas b/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas
index 1ec4abef..4e5b4f0d 100644
--- a/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas
+++ b/demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas
@@ -42,9 +42,9 @@ unit uSimpleBrowser2;
interface
uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, LMessages,
uCEFChromium, uCEFWindowParent, uCEFConstants, uCEFTypes, uCEFInterfaces,
- uCEFChromiumEvents;
+ uCEFChromiumEvents, uCEFLinkedWindowParent;
type
@@ -52,30 +52,25 @@ type
TForm1 = class(TForm)
AddressEdt: TEdit;
+ CEFLinkedWindowParent1: TCEFLinkedWindowParent;
GoBtn: TButton;
- CEFWindowParent1: TCEFWindowParent;
Chromium1: TChromium;
AddressPnl: TPanel;
Timer1: TTimer;
- procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser
- );
+
+ procedure CEFLinkedWindowParent1Enter(Sender: TObject);
+ procedure CEFLinkedWindowParent1Exit(Sender: TObject);
+
+ procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
- procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser;
- const frame: ICefFrame; const targetUrl, targetFrameName: ustring;
- targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean;
- const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
- var client: ICefClient; var settings: TCefBrowserSettings;
- var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean;
- var Result: Boolean);
- procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser;
- var aAction: TCefCloseBrowserAction);
- procedure Chromium1OpenUrlFromTab(Sender: TObject;
- const browser: ICefBrowser; const frame: ICefFrame;
- const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
- userGesture: Boolean; out Result: Boolean);
+ procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
+ procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
+ procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
+
+ procedure FormCreate(Sender: TObject);
+ procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
- procedure FormCreate(Sender: TObject);
- procedure FormShow(Sender: TObject);
+
procedure GoBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
@@ -85,10 +80,14 @@ type
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
FClosing : boolean; // Set to True in the CloseQuery event.
- function SendCompMessage(aMsg : cardinal) : boolean;
+ // CEF needs to handle these messages to call TChromium.NotifyMoveOrResizeStarted
+ procedure WMMove(var Message: TLMMove); message LM_MOVE;
+ procedure WMSize(var Message: TLMSize); message LM_SIZE;
+ procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
- procedure BrowserCreated;
- procedure BrowserDestroyMsg(Data: PtrInt);
+ procedure SendCompMessage(aMsg : cardinal);
+
+ procedure BrowserCreatedMsg(Data: PtrInt);
procedure BrowserCloseFormMsg(Data: PtrInt);
public
@@ -115,12 +114,15 @@ implementation
// or the domain "google.com". If you don't live in the US, you'll be redirected to
// another domain which will take a little time too.
-// This demo uses a TChromium and a TCEFWindowParent
+// This demo uses a TChromium and a TCEFLinkedWindowParent
+
+// We need to use TCEFLinkedWindowParent in Linux to update the browser
+// visibility and size automatically.
// Destruction steps
// =================
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
-// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
+// 2. TChromium.OnClose sets aAction to cbaClose to destroy the browser, which triggers the TChromium.OnBeforeClose event.
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends CEF_BEFORECLOSE to close the form.
uses
@@ -130,56 +132,32 @@ uses
procedure CreateGlobalCEFApp;
-var
- TempHome, TempBinDir : ustring;
begin
- TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
- TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
-
- GlobalCEFApp := TCefApplication.Create;
- GlobalCEFApp.SetCurrentDir := True;
-
- if DirectoryExists(TempBinDir) then
- begin
- GlobalCEFApp.FrameworkDirPath := TempBinDir;
- GlobalCEFApp.ResourcesDirPath := TempBinDir;
- GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
- end;
-
- // Add a debug log in the BIN directory
+ GlobalCEFApp := TCefApplication.Create;
+ {
GlobalCEFApp.LogFile := 'cef.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
+ }
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FCanClose := False;
FClosing := False;
-end;
-procedure TForm1.FormShow(Sender: TObject);
-begin
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
-
- // You *MUST* call CreateBrowser to create and initialize the browser.
- // This will trigger the AfterCreated event when the browser is fully
- // initialized and ready to receive commands.
-
- // GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
- // If it's not initialized yet, we use a simple timer to create the browser later.
- if not(Chromium1.CreateBrowser(CEFWindowParent1)) then Timer1.Enabled := True;
end;
procedure TForm1.GoBtnClick(Sender: TObject);
begin
- // This will load the URL in the edit box
Chromium1.LoadURL(UTF8Decode(AddressEdt.Text));
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
- if not(Chromium1.CreateBrowser(CEFWindowParent1)) and not(Chromium1.Initialized) then
+ if not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) and
+ not(Chromium1.Initialized) then
Timer1.Enabled := True;
end;
@@ -205,34 +183,7 @@ procedure TForm1.Chromium1BeforePopup(Sender: TObject;
begin
// For simplicity, this demo blocks all popup windows and new tabs
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
-end;
-
-procedure TForm1.Chromium1Close(Sender: TObject; const browser: ICefBrowser;
- var aAction: TCefCloseBrowserAction);
-begin
- SendCompMessage(CEF_DESTROY);
- aAction := cbaDelay;
-end;
-
-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.BrowserCreated;
-begin
- Caption := 'Simple Browser 2';
- AddressPnl.Enabled := True;
-end;
-
-procedure TForm1.Chromium1BeforeClose(Sender: TObject;
- const browser: ICefBrowser);
-begin
- FCanClose := True;
- SendCompMessage(CEF_BEFORECLOSE);
-end;
+end;
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
@@ -243,9 +194,57 @@ begin
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
end;
-procedure TForm1.BrowserDestroyMsg(Data: PtrInt);
+procedure TForm1.FormActivate(Sender: TObject);
begin
- CEFWindowParent1.Free;
+ // You *MUST* call CreateBrowser to create and initialize the browser.
+ // This will trigger the AfterCreated event when the browser is fully
+ // initialized and ready to receive commands.
+
+ // GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
+ // If it's not initialized yet, we use a simple timer to create the browser later.
+
+ // Linux needs a visible form to create a browser so we need to use the
+ // TForm.OnActivate event instead of the TForm.OnShow event
+
+ if not(Chromium1.Initialized) and
+ not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) then
+ Timer1.Enabled := True;
+end;
+
+procedure TForm1.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
+begin
+ // continue closing the browser
+ aAction := cbaClose;
+end;
+
+procedure TForm1.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
+begin
+ // We must wait until all browsers trigger the TChromium.OnBeforeClose event
+ // in order to close the application safely or we will have shutdown issues.
+ FCanClose := True;
+ SendCompMessage(CEF_BEFORECLOSE);
+end;
+
+procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
+begin
+ // Now the browser is fully initialized we can initialize the UI.
+ SendCompMessage(CEF_AFTERCREATED);
+end;
+
+procedure TForm1.CEFLinkedWindowParent1Enter(Sender: TObject);
+begin
+ If not(csDesigning in ComponentState) then Chromium1.SetFocus(True);
+end;
+
+procedure TForm1.CEFLinkedWindowParent1Exit(Sender: TObject);
+begin
+ if not(csDesigning in ComponentState) then Chromium1.SendCaptureLostEvent;
+end;
+
+procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
+begin
+ Caption := 'Simple Browser 2';
+ AddressPnl.Enabled := True;
end;
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
@@ -253,13 +252,32 @@ begin
Close;
end;
-function TForm1.SendCompMessage(aMsg : cardinal) : boolean;
+procedure TForm1.SendCompMessage(aMsg : cardinal);
begin
- case aMsg of
- CEF_DESTROY : Application.QueueAsyncCall(@BrowserDestroyMsg, 0);
+ case aMsg of
+ CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreatedMsg, 0);
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
end;
end;
+procedure TForm1.WMMove(var Message: TLMMove);
+begin
+ inherited;
+ Chromium1.NotifyMoveOrResizeStarted;
+end;
+
+procedure TForm1.WMSize(var Message: TLMSize);
+begin
+ inherited;
+ Chromium1.NotifyMoveOrResizeStarted;
+end;
+
+procedure TForm1.WMWindowPosChanged(var Message: TLMWindowPosChanged);
+begin
+ inherited;
+ Chromium1.NotifyMoveOrResizeStarted;
+end;
+
+
end.
diff --git a/demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps b/demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps
index 0558bdb1..b2d702f0 100644
--- a/demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps
+++ b/demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps
@@ -20,9 +20,8 @@
-
-
+
@@ -35,6 +34,7 @@
+
diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas
index bce158c2..a7abbbd5 100644
--- a/source/uCEFApplicationCore.pas
+++ b/source/uCEFApplicationCore.pas
@@ -54,6 +54,7 @@ uses
{$ELSE}
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF}
{$ENDIF}
+ {$IFDEF LINUX}xlib,{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
const
@@ -251,6 +252,9 @@ type
function GetTotalSystemMemory : uint64;
function GetAvailableSystemMemory : uint64;
function GetSystemMemoryLoad : cardinal;
+ {$IFDEF LINUX}
+ function GetXDisplay : PXDisplay;
+ {$ENDIF}
function LoadCEFlibrary : boolean; virtual;
function Load_cef_app_capi_h : boolean;
@@ -494,6 +498,9 @@ type
property AvailableSystemMemory : uint64 read GetAvailableSystemMemory;
property SystemMemoryLoad : cardinal read GetSystemMemoryLoad;
property SupportedSchemes : TStringList read FSupportedSchemes;
+ {$IFDEF LINUX}
+ property XDisplay : PXDisplay read GetXDisplay;
+ {$ENDIF}
// ICefApp
property OnRegCustomSchemes : TOnRegisterCustomSchemesEvent read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
@@ -2214,6 +2221,17 @@ begin
{$ENDIF}
end;
+{$IFDEF LINUX}
+function TCefApplicationCore.GetXDisplay : PXDisplay;
+begin
+ // This property can only be called in the CEF UI thread.
+ if FLibLoaded then
+ Result := cef_get_xdisplay{$IFDEF FPC}(){$ENDIF}
+ else
+ Result := nil;
+end;
+{$ENDIF}
+
function TCefApplicationCore.LoadCEFlibrary : boolean;
var
TempOldDir, TempString : string;
diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas
index 43131ab7..a9950844 100644
--- a/source/uCEFChromium.pas
+++ b/source/uCEFChromium.pas
@@ -123,10 +123,11 @@ implementation
uses
{$IFDEF DELPHI16_UP}
- System.SysUtils, System.Math;
+ System.SysUtils, System.Math,
{$ELSE}
- SysUtils, Math;
+ SysUtils, Math,
{$ENDIF}
+ uCEFMiscFunctions;
{ TChromium }
@@ -295,7 +296,7 @@ function TChromium.CreateBrowser(const aBrowserParent : TWinControl;
const aContext : ICefRequestContext;
const aExtraInfo : ICefDictionaryValue) : boolean;
var
- TempHandle : HWND;
+ TempHandle : TCefWindowHandle;
TempRect : TRect;
begin
if (aBrowserParent <> nil) then
@@ -305,8 +306,8 @@ begin
end
else
begin
- TempHandle := 0;
- TempRect := rect(0, 0, 0, 0);
+ InitializeWindowHandle(TempHandle);
+ TempRect := rect(0, 0, 0, 0);
end;
Result := inherited CreateBrowser(TempHandle, TempRect, aWindowName, aContext, aExtraInfo);
diff --git a/source/uCEFChromiumCore.pas b/source/uCEFChromiumCore.pas
index 76c96f88..0cccbc96 100644
--- a/source/uCEFChromiumCore.pas
+++ b/source/uCEFChromiumCore.pas
@@ -435,6 +435,9 @@ type
function ExecuteSetZoomLevelTask(const aValue : double) : boolean;
function ExecuteSetZoomStepTask(aValue : byte) : boolean;
function ExecuteBrowserNavigationTask(aTask : TCefBrowserNavigation) : boolean;
+ function ExecuteUpdateSizeTask(aLeft, aTop, aWidth, aHeight : integer) : boolean;
+ function ExecuteSendCaptureLostEventTask : boolean;
+ function ExecuteUpdateXWindowVisibilityTask(aVisible : boolean) : boolean;
procedure UpdateHostZoomLevel(const aValue : double);
procedure UpdateHostZoomPct(const aValue : double);
@@ -639,6 +642,9 @@ type
procedure doMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute); virtual;
procedure doOnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring); virtual;
procedure doBrowserNavigation(aTask : TCefBrowserNavigation); virtual;
+ procedure doUpdateSize(aLeft, aTop, aWidth, aHeight : integer); virtual;
+ procedure doSendCaptureLostEvent; virtual;
+ procedure doUpdateXWindowVisibility(aVisible : boolean); virtual;
function MustCreateAudioHandler : boolean; virtual;
function MustCreateDevToolsMessageObserver : boolean; virtual;
function MustCreateLoadHandler : boolean; virtual;
@@ -805,6 +811,11 @@ type
procedure ReplaceMisspelling(const aWord : ustring);
procedure AddWordToDictionary(const aWord : ustring);
+ {$IFDEF LINUX}
+ procedure UpdateBrowserSize(aLeft, aTop, aWidth, aHeight : integer);
+ procedure UpdateXWindowVisibility(aVisible : boolean);
+ {$ENDIF}
+
// ICefMediaRouter methods
function AddObserver(const observer: ICefMediaObserver): ICefRegistration;
function GetSource(const urn: ustring): ICefMediaSource;
@@ -1147,7 +1158,7 @@ uses
{$IFDEF DELPHI16_UP}
System.SysUtils, System.Math,
{$ELSE}
- SysUtils, Math,
+ SysUtils, Math, {$IFDEF FPC}{$IFDEF LINUX}xlib, x, xatom,{$ENDIF}{$ENDIF}
{$ENDIF}
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
uCEFApplicationCore, uCEFProcessMessage, uCEFRequestContext,
@@ -2499,6 +2510,57 @@ begin
end;
end;
+function TChromiumCore.ExecuteUpdateSizeTask(aLeft, aTop, aWidth, aHeight : integer) : boolean;
+var
+ TempTask : ICefTask;
+begin
+ Result := False;
+
+ try
+ if Initialized then
+ begin
+ TempTask := TCefUpdateSizeTask.Create(self, aLeft, aTop, aWidth, aHeight);
+ Result := CefPostTask(TID_UI, TempTask);
+ end;
+ finally
+ TempTask := nil;
+ end;
+end;
+
+function TChromiumCore.ExecuteSendCaptureLostEventTask : boolean;
+var
+ TempTask : ICefTask;
+begin
+ Result := False;
+
+ try
+ if Initialized then
+ begin
+ TempTask := TCefSendCaptureLostEventTask.Create(self);
+ Result := CefPostTask(TID_UI, TempTask);
+ end;
+ finally
+ TempTask := nil;
+ end;
+end;
+
+function TChromiumCore.ExecuteUpdateXWindowVisibilityTask(aVisible : boolean) : boolean;
+var
+ TempTask : ICefTask;
+begin
+ Result := False;
+
+ try
+ if Initialized then
+ begin
+ TempTask := TCefUpdateXWindowVisibilityTask.Create(self, aVisible);
+ Result := CefPostTask(TID_UI, TempTask);
+ end;
+ finally
+ TempTask := nil;
+ end;
+end;
+
procedure TChromiumCore.GoBack;
begin
ExecuteBrowserNavigationTask(bnBack);
@@ -4576,6 +4638,110 @@ begin
end;
end;
+procedure TChromiumCore.doUpdateSize(aLeft, aTop, aWidth, aHeight : integer);
+{$IFDEF LINUX}
+var
+ TempHandle : TCefWindowHandle;
+ TempChanges : TXWindowChanges;
+ TempXDisplay : PXDisplay;
+{$ENDIF}
+begin
+ {$IFDEF LINUX}
+ if (GlobalCEFApp <> nil) then
+ begin
+ TempXDisplay := GlobalCEFApp.XDisplay;
+
+ if (TempXDisplay <> nil) then
+ begin
+ TempHandle := WindowHandle;
+
+ if ValidCefWindowHandle(TempHandle) then
+ begin
+ TempChanges.x := aLeft;
+ TempChanges.y := aTop;
+ TempChanges.width := aWidth;
+ TempChanges.height := aHeight;
+
+ XConfigureWindow(TempXDisplay, TempHandle, CWX or CWY or CWHeight or CWWidth, @TempChanges);
+ end;
+ end;
+ end;
+ {$ENDIF}
+end;
+
+procedure TChromiumCore.doSendCaptureLostEvent;
+{$IFDEF LINUX}
+var
+ TempXDisplay : PXDisplay;
+{$ENDIF}
+begin
+ {$IFDEF LINUX}
+ if (GlobalCEFApp <> nil) then
+ begin
+ TempXDisplay := GlobalCEFApp.XDisplay;
+
+ if (TempXDisplay <> nil) then
+ XSetInputFocus(TempXDisplay, X.None, RevertToNone, CurrentTime);
+ end;
+ {$ENDIF}
+
+ if Initialized then
+ Browser.Host.SendCaptureLostEvent;
+end;
+
+procedure TChromiumCore.doUpdateXWindowVisibility(aVisible : boolean);
+{$IFDEF LINUX}
+var
+ TempXDisplay : PXDisplay;
+ TempHandle : TCefWindowHandle;
+ TempState : TAtom;
+ TempHidden : TAtom;
+{$ENDIF}
+begin
+ {$IFDEF LINUX}
+ if (GlobalCEFApp <> nil) then
+ begin
+ TempXDisplay := GlobalCEFApp.XDisplay;
+
+ if (TempXDisplay <> nil) then
+ begin
+ TempHandle := WindowHandle;
+
+ if ValidCefWindowHandle(TempHandle) then
+ begin
+ TempState := XInternAtom(TempXDisplay, '_NET_WM_STATE', False);
+
+ if aVisible then
+ XChangeProperty(TempXDisplay, TempHandle, TempState, XA_ATOM, 32, PropModeReplace, nil, 0)
+ else
+ begin
+ TempHidden := XInternAtom(TempXDisplay, '_NET_WM_STATE_HIDDEN', False);
+ XChangeProperty(TempXDisplay, TempHandle, TempState, XA_ATOM, 32, PropModeReplace, @TempHidden, 1);
+ end;
+ end;
+ end;
+ end;
+ {$ENDIF}
+end;
+
+{$IFDEF LINUX}
+procedure TChromiumCore.UpdateBrowserSize(aLeft, aTop, aWidth, aHeight : integer);
+begin
+ if CefCurrentlyOn(TID_UI) then
+ doUpdateSize(aLeft, aTop, aWidth, aHeight)
+ else
+ ExecuteUpdateSizeTask(aLeft, aTop, aWidth, aHeight);
+end;
+
+procedure TChromiumCore.UpdateXWindowVisibility(aVisible : boolean);
+begin
+ if CefCurrentlyOn(TID_UI) then
+ doUpdateXWindowVisibility(aVisible)
+ else
+ ExecuteUpdateXWindowVisibilityTask(aVisible);
+end;
+{$ENDIF}
+
function TChromiumCore.MustCreateLoadHandler : boolean;
begin
Result := assigned(FOnLoadStart) or
@@ -6231,8 +6397,10 @@ end;
procedure TChromiumCore.SendCaptureLostEvent;
begin
- if Initialized then
- Browser.Host.SendCaptureLostEvent;
+ if CefCurrentlyOn(TID_UI) then
+ doSendCaptureLostEvent
+ else
+ ExecuteSendCaptureLostEventTask;
end;
procedure TChromiumCore.SetFocus(focus: Boolean);
diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas
index eba9aa78..7a52b931 100644
--- a/source/uCEFInterfaces.pas
+++ b/source/uCEFInterfaces.pas
@@ -478,6 +478,9 @@ type
procedure doMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
procedure doOnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring);
procedure doBrowserNavigation(aTask : TCefBrowserNavigation);
+ procedure doUpdateSize(aLeft, aTop, aWidth, aHeight : integer);
+ procedure doSendCaptureLostEvent;
+ procedure doUpdateXWindowVisibility(aVisible : boolean);
function MustCreateAudioHandler : boolean;
function MustCreateLoadHandler : boolean;
function MustCreateFocusHandler : boolean;
diff --git a/source/uCEFLibFunctions.pas b/source/uCEFLibFunctions.pas
index 2623a810..8f07aefa 100644
--- a/source/uCEFLibFunctions.pas
+++ b/source/uCEFLibFunctions.pas
@@ -54,7 +54,7 @@ uses
{$ELSE}
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Math,
{$ENDIF}
- uCEFTypes;
+ {$IFDEF LINUX}xlib,{$ENDIF} uCEFTypes;
var
// /include/capi/cef_app_capi.h
diff --git a/source/uCEFLinkedWindowParent.pas b/source/uCEFLinkedWindowParent.pas
index cf1a6920..253c264a 100644
--- a/source/uCEFLinkedWindowParent.pas
+++ b/source/uCEFLinkedWindowParent.pas
@@ -54,9 +54,10 @@ uses
{$ELSE}
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics,
{$IFDEF FPC}
- LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
+ LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
+ {$IFDEF LINUX}xlib, x,{$ENDIF}
{$ELSE}
- Messages,
+ Messages,
{$ENDIF}
{$ENDIF}
uCEFWinControl, uCEFTypes, uCEFInterfaces, uCEFChromium;
@@ -66,7 +67,11 @@ type
TCEFLinkedWindowParent = class(TCEFWinControl)
protected
FChromium : TChromium;
-
+
+ {$IFDEF FPC}{$IFDEF LINUX}
+ procedure SetVisible(Value: Boolean); override;
+ procedure UpdateSize; override;
+ {$ENDIF}{$ENDIF}
procedure SetChromium(aValue : TChromium);
function GetChildWindowHandle : THandle; override;
@@ -84,14 +89,14 @@ type
{$IFDEF FPC}
-
procedure Register;
{$ENDIF}
implementation
uses
- uCEFMiscFunctions, uCEFClient, uCEFConstants;
+ uCEFMiscFunctions, uCEFClient, uCEFConstants, uCEFLibFunctions,
+ uCEFApplication;
constructor TCEFLinkedWindowParent.Create(AOwner : TComponent);
begin
@@ -151,6 +156,31 @@ begin
if (Operation = opRemove) and (AComponent = FChromium) then FChromium := nil;
end;
+{$IFDEF FPC}{$IFDEF LINUX}
+procedure TCEFLinkedWindowParent.SetVisible(Value: Boolean);
+var
+ TempChanged : boolean;
+begin
+ TempChanged := (Visible <> Value);
+
+ inherited SetVisible(Value);
+
+ if not(csDesigning in ComponentState) and
+ TempChanged and
+ (FChromium <> nil) and
+ FChromium.Initialized then
+ FChromium.UpdateXWindowVisibility(Visible);
+end;
+
+procedure TCEFLinkedWindowParent.UpdateSize;
+begin
+ if not(csDesigning in ComponentState) and
+ (FChromium <> nil) and
+ FChromium.Initialized then
+ FChromium.UpdateBrowserSize(Left, Top, Width, Height);
+end;
+{$ENDIF}{$ENDIF}
+
procedure TCEFLinkedWindowParent.SetChromium(aValue : TChromium);
begin
FChromium := aValue;
diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas
index 0a46ea1e..5421f732 100644
--- a/source/uCEFMiscFunctions.pas
+++ b/source/uCEFMiscFunctions.pas
@@ -61,7 +61,8 @@ uses
{$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,
+ ctypes, keysym, gtk2, glib2, gdk2, gtk2proc, gtk2int, xf86keysym,
+ Gtk2Def, gdk2x, Gtk2Extra,
{$ENDIF}{$ENDIF}{$ENDIF}
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
@@ -761,7 +762,7 @@ begin
aWindowInfo.y := aRect.top;
aWindowInfo.width := aRect.right - aRect.left;
aWindowInfo.height := aRect.bottom - aRect.top;
- aWindowInfo.parent_window := aParent;
+ aWindowInfo.parent_window := gdk_window_xwindow(PGtkWidget(aParent)^.window);
aWindowInfo.windowless_rendering_enabled := ord(False);
aWindowInfo.shared_texture_enabled := ord(False);
aWindowInfo.external_begin_frame_enabled := ord(False);
@@ -775,7 +776,7 @@ begin
aWindowInfo.y := 0;
aWindowInfo.width := 0;
aWindowInfo.height := 0;
- aWindowInfo.parent_window := aParent;
+ aWindowInfo.parent_window := gdk_window_xwindow(PGtkWidget(aParent)^.window);
aWindowInfo.windowless_rendering_enabled := ord(False);
aWindowInfo.shared_texture_enabled := ord(False);
aWindowInfo.external_begin_frame_enabled := ord(False);
diff --git a/source/uCEFTask.pas b/source/uCEFTask.pas
index b78ab5f9..59668bdf 100644
--- a/source/uCEFTask.pas
+++ b/source/uCEFTask.pas
@@ -219,6 +219,44 @@ type
destructor Destroy; override;
end;
+ TCefUpdateSizeTask = class(TCefTaskOwn)
+ protected
+ FEvents : Pointer;
+ FLeft : integer;
+ FTop : integer;
+ FWidth : integer;
+ FHeight : integer;
+
+ procedure Execute; override;
+
+ public
+ constructor Create(const aEvents : IChromiumEvents; aLeft, aTop, aWidth, aHeight : integer); reintroduce;
+ destructor Destroy; override;
+ end;
+
+ TCefSendCaptureLostEventTask = class(TCefTaskOwn)
+ protected
+ FEvents : Pointer;
+
+ procedure Execute; override;
+
+ public
+ constructor Create(const aEvents : IChromiumEvents); reintroduce;
+ destructor Destroy; override;
+ end;
+
+ TCefUpdateXWindowVisibilityTask = class(TCefTaskOwn)
+ protected
+ FEvents : pointer;
+ FVisible : boolean;
+
+ procedure Execute; override;
+
+ public
+ constructor Create(const aEvents : IChromiumEvents; aVisible : boolean); reintroduce;
+ destructor Destroy; override;
+ end;
+
implementation
@@ -682,4 +720,103 @@ begin
inherited Destroy;
end;
+
+// TCefUpdateSizeTask
+
+procedure TCefUpdateSizeTask.Execute;
+begin
+ try
+ try
+ if (FEvents <> nil) then IChromiumEvents(FEvents).doUpdateSize(FLeft, FTop, FWidth, FHeight);
+ except
+ on e : exception do
+ if CustomExceptionHandler('TCefUpdateSizeTask.Execute', e) then raise;
+ end;
+ finally
+ FEvents := nil;
+ end;
+end;
+
+constructor TCefUpdateSizeTask.Create(const aEvents : IChromiumEvents; aLeft, aTop, aWidth, aHeight : integer);
+begin
+ inherited Create;
+
+ FEvents := Pointer(aEvents);
+ FLeft := aLeft;
+ FTop := aTop;
+ FWidth := aWidth;
+ FHeight := aHeight;
+end;
+
+destructor TCefUpdateSizeTask.Destroy;
+begin
+ FEvents := nil;
+
+ inherited Destroy;
+end;
+
+
+// TCefSendCaptureLostEventTask
+
+procedure TCefSendCaptureLostEventTask.Execute;
+begin
+ try
+ try
+ if (FEvents <> nil) then IChromiumEvents(FEvents).doSendCaptureLostEvent;
+ except
+ on e : exception do
+ if CustomExceptionHandler('TCefSendCaptureLostEventTask.Execute', e) then raise;
+ end;
+ finally
+ FEvents := nil;
+ end;
+end;
+
+constructor TCefSendCaptureLostEventTask.Create(const aEvents : IChromiumEvents);
+begin
+ inherited Create;
+
+ FEvents := Pointer(aEvents);
+end;
+
+destructor TCefSendCaptureLostEventTask.Destroy;
+begin
+ FEvents := nil;
+
+ inherited Destroy;
+end;
+
+
+// TCefUpdateXWindowVisibilityTask
+
+procedure TCefUpdateXWindowVisibilityTask.Execute;
+begin
+ try
+ try
+ if (FEvents <> nil) then IChromiumEvents(FEvents).doUpdateXWindowVisibility(FVisible);
+ except
+ on e : exception do
+ if CustomExceptionHandler('TCefUpdateXWindowVisibilityTask.Execute', e) then raise;
+ end;
+ finally
+ FEvents := nil;
+ end;
+end;
+
+constructor TCefUpdateXWindowVisibilityTask.Create(const aEvents : IChromiumEvents; aVisible : boolean);
+begin
+ inherited Create;
+
+ FEvents := Pointer(aEvents);
+ FVisible := aVisible;
+end;
+
+destructor TCefUpdateXWindowVisibilityTask.Destroy;
+begin
+ FEvents := nil;
+
+ inherited Destroy;
+end;
+
+
end.
diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas
index ff6bca92..963b50fe 100644
--- a/source/uCEFTypes.pas
+++ b/source/uCEFTypes.pas
@@ -250,9 +250,7 @@ type
PCefMediaSinkDeviceInfo = ^TCefMediaSinkDeviceInfo;
{$IFDEF LINUX}
- PXEvent = Pointer;
- TXDisplay = record end;
- PXDisplay = ^TXDisplay;
+ PXEvent = Pointer;
{$ENDIF}
diff --git a/source/uCEFWinControl.pas b/source/uCEFWinControl.pas
index 01a582ea..dc4d7198 100644
--- a/source/uCEFWinControl.pas
+++ b/source/uCEFWinControl.pas
@@ -70,7 +70,7 @@ type
function DestroyChildWindow : boolean;
procedure CreateHandle; override;
procedure InvalidateChildren;
- procedure UpdateSize;
+ procedure UpdateSize; virtual;
property ChildWindowHandle : THandle read GetChildWindowHandle;
@@ -85,7 +85,9 @@ type
property Enabled;
property ShowHint;
property Hint;
- property OnResize;
+ property OnResize;
+ property OnEnter;
+ property OnExit;
{$IFDEF DELPHI14_UP}
property Touch;
property OnGesture;
@@ -122,10 +124,13 @@ begin
end;
procedure TCEFWinControl.UpdateSize;
+{$IFDEF MSWINDOWS}
var
TempRect : TRect;
TempHWND : THandle;
+{$ENDIF}
begin
+ {$IFDEF MSWINDOWS}
TempHWND := ChildWindowHandle;
if (TempHWND = 0) then exit;
@@ -134,6 +139,7 @@ begin
SetWindowPos(TempHWND, 0,
0, 0, TempRect.right, TempRect.bottom,
SWP_NOZORDER);
+ {$ENDIF}
end;
function TCEFWinControl.TakeSnapshot(var aBitmap : TBitmap) : boolean;
diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json
index b87e5b44..8c10fb8b 100644
--- a/update_CEF4Delphi.json
+++ b/update_CEF4Delphi.json
@@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
- "InternalVersion" : 213,
+ "InternalVersion" : 214,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "87.1.12.0"
}