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

Update to CEF 90.6.7

Added workaround to avoid a crash when the user clicks the right mouse button in Firemonkey for MacOS.
Added the click count to the mouse events to the Linux Firemonkey demo.
Added the ShowMessageCF function to show a message dialog in MacOS.
Added calls to FMX.Types.Log.d to write error messages in Firemonkey for Linux and MacOS.
This commit is contained in:
Salvador Díaz Fau 2021-05-27 14:29:30 +02:00
parent 44896524e8
commit b14abde967
12 changed files with 76 additions and 25 deletions

View File

@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 90.6.6 which includes Chromium 90.0.4430.93.
CEF4Delphi uses CEF 90.6.7 which includes Chromium 90.0.4430.212.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.6%2Bg3c44b04%2Bchromium-90.0.4430.93_macosx64.tar.bz2)
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.6.7%2Bg19ba721%2Bchromium-90.0.4430.212_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.4.2 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.12/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -322,6 +322,7 @@ procedure TFMXExternalPumpBrowserFrm.Panel1MouseDown(Sender : TObject;
X, Y : Single);
var
TempEvent : TCefMouseEvent;
TempCount : integer;
begin
if not(ssTouch in Shift) then
begin
@ -330,7 +331,13 @@ begin
TempEvent.x := round(X);
TempEvent.y := round(Y);
TempEvent.modifiers := getModifiers(Shift);
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
if (ssDouble in Shift) then
TempCount := 2
else
TempCount := 1;
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, TempCount);
end;
end;
@ -388,13 +395,20 @@ procedure TFMXExternalPumpBrowserFrm.Panel1MouseUp(Sender : TObject;
X, Y : Single);
var
TempEvent : TCefMouseEvent;
TempCount : integer;
begin
if not(ssTouch in Shift) then
begin
TempEvent.x := round(X);
TempEvent.y := round(Y);
TempEvent.modifiers := getModifiers(Shift);
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
if (ssDouble in Shift) then
TempCount := 2
else
TempCount := 1;
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, TempCount);
end;
end;

View File

@ -159,6 +159,7 @@ object FMXExternalPumpBrowserFrm: TFMXExternalPumpBrowserFrm
end
end
object chrmosr: TFMXChromium
OnBeforeContextMenu = chrmosrBeforeContextMenu
OnTooltip = chrmosrTooltip
OnCursorChange = chrmosrCursorChange
OnBeforePopup = chrmosrBeforePopup

View File

@ -114,12 +114,14 @@ type
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 chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult: Boolean);
procedure chrmosrBeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel);
procedure Timer1Timer(Sender: TObject);
procedure AddressEdtEnter(Sender: TObject);
procedure SnapshotBtnClick(Sender: TObject);
procedure SnapshotBtnEnter(Sender: TObject);
procedure CopyMenuItemClick(Sender: TObject);
procedure CutMenuItemClick(Sender: TObject);
procedure DeleteMenuItemClick(Sender: TObject);
@ -162,7 +164,6 @@ var
// This demo is in ALPHA state. It's incomplete and some features may not work!
// ****************************************************************************
// Known issues and missing features :
// - Full screen event is not handled correctly.
// - Right-click crashes the demo.
@ -599,6 +600,16 @@ begin
end);
end;
procedure TFMXExternalPumpBrowserFrm.chrmosrBeforeContextMenu( Sender : TObject;
const browser : ICefBrowser;
const frame : ICefFrame;
const params : ICefContextMenuParams;
const model : ICefMenuModel);
begin
// Disable the context menu to avoid a crash issue for now
if (model <> nil) then model.Clear;
end;
procedure TFMXExternalPumpBrowserFrm.chrmosrBeforePopup( Sender : TObject;
const browser : ICefBrowser;
const frame : ICefFrame;

View File

@ -1,4 +1,5 @@
package CEF4Delphi_FMX;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
@ -230,7 +231,9 @@ contains
uCEFLinuxTypes in '..\source\uCEFLinuxTypes.pas',
uCEFLinuxFunctions in '..\source\uCEFLinuxFunctions.pas',
uCEFWorkSchedulerQueueThread in '..\source\uCEFWorkSchedulerQueueThread.pas',
uCEFLinkedWinControlBase in '..\source\uCEFLinkedWinControlBase.pas';
uCEFLinkedWinControlBase in '..\source\uCEFLinkedWinControlBase.pas',
uCEFMacOSConstants in '..\source\uCEFMacOSConstants.pas',
uCEFMacOSFunctions in '..\source\uCEFMacOSFunctions.pas';
end.

View File

@ -347,6 +347,8 @@
<DCCReference Include="..\source\uCEFLinuxFunctions.pas"/>
<DCCReference Include="..\source\uCEFWorkSchedulerQueueThread.pas"/>
<DCCReference Include="..\source\uCEFLinkedWinControlBase.pas"/>
<DCCReference Include="..\source\uCEFMacOSConstants.pas"/>
<DCCReference Include="..\source\uCEFMacOSFunctions.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

View File

@ -21,7 +21,7 @@
</CompilerOptions>
<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="90" Minor="6" Release="6"/>
<Version Major="90" Minor="6" Release="7"/>
<Files Count="201">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -66,13 +66,13 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 90;
CEF_SUPPORTED_VERSION_MINOR = 6;
CEF_SUPPORTED_VERSION_RELEASE = 6;
CEF_SUPPORTED_VERSION_RELEASE = 7;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 90;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 4430;
CEF_CHROMEELF_VERSION_BUILD = 93;
CEF_CHROMEELF_VERSION_BUILD = 212;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll';
@ -620,7 +620,7 @@ uses
System.Math, System.IOUtils, System.SysUtils,
{$IFDEF MSWINDOWS}WinApi.TlHelp32, WinApi.PSAPI,{$ENDIF}
{$IFDEF LINUX}{$IFDEF FMX}Posix.Unistd, Posix.Stdio,{$ENDIF}{$ENDIF}
{$IFDEF MACOS}Posix.Stdio,{$ENDIF}
{$IFDEF MACOS}Posix.Stdio, uCEFMacOSFunctions,{$ENDIF}
{$ELSE}
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils,
{$IFDEF FPC}
@ -1554,7 +1554,7 @@ begin
{$IFDEF FPC}
// TO-DO: Find a way to show message boxes in Lazarus/FPC for MacOS
{$ELSE}
// TO-DO: Find a way to show message boxes in FMX for MacOS
ShowMessageCF('Error', aError, 10);
{$ENDIF}
{$ENDIF}
end;

View File

@ -57,6 +57,7 @@ function KeyToMacOSKeyCode(aKey : Word): integer;
{$IFDEF FMX}
procedure CopyCEFFramework;
procedure CopyCEFHelpers(const aProjectName : string);
procedure ShowMessageCF(const aHeading, aMessage : string; const aTimeoutInSecs : double = 0);
{$ENDIF}
{$ENDIF}
@ -66,6 +67,7 @@ implementation
{$IFDEF FMX}
uses
System.SysUtils, System.Types, System.IOUtils, Posix.Stdio, FMX.Types,
Macapi.CoreFoundation,
uCEFMiscFunctions;
const
@ -365,6 +367,22 @@ begin
end;
end;
end;
procedure ShowMessageCF(const aHeading, aMessage : string; const aTimeoutInSecs : double = 0);
var
TempHeading, TempMessage : CFStringRef;
TempResponse : CFOptionFlags;
begin
TempHeading := CFStringCreateWithCharactersNoCopy(nil, PChar(aHeading), Length(AHeading), kCFAllocatorNull);
TempMessage := CFStringCreateWithCharactersNoCopy(nil, PChar(aMessage), Length(AMessage), kCFAllocatorNull);
try
CFUserNotificationDisplayAlert(aTimeoutInSecs, kCFUserNotificationNoteAlertLevel, nil, nil, nil, TempHeading, TempMessage, nil, nil, nil, TempResponse);
finally
CFRelease(TempHeading);
CFRelease(TempMessage);
end;
end;
{$ENDIF}
{$ENDIF}

View File

@ -56,11 +56,12 @@ interface
uses
{$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}
WinApi.Windows, WinApi.ActiveX, {$IFDEF FMX}FMX.Types,{$ENDIF}
WinApi.Windows, WinApi.ActiveX,
{$ELSE}
{$IFDEF MACOSX}Macapi.Foundation, FMX.Helpers.Mac,{$ENDIF}
{$ENDIF}
System.Types, System.IOUtils, System.Classes, System.SysUtils, System.UITypes, System.Math,
{$IFDEF FMX}FMX.Types,{$ENDIF} System.Types, System.IOUtils, System.Classes,
System.SysUtils, System.UITypes, System.Math,
{$ELSE}
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF}
{$IFDEF DELPHI14_UP}Types, IOUtils,{$ENDIF} Classes, SysUtils, Math,
@ -947,16 +948,16 @@ begin
{$IFDEF LINUX}
{$IFDEF FPC}
// TO-DO: Find a way to write in the error console using Lazarus in Linux
// TO-DO: Find a way to write in the error console using Lazarus in Linux
{$ELSE}
// TO-DO: Find a way to write in the error console using FMXLinux
FMX.Types.Log.d(aMessage);
{$ENDIF}
{$ENDIF}
{$IFDEF MACOSX}
{$IFDEF FPC}
// TO-DO: Find a way to write in the error console using Lazarus in MacOS
{$ELSE}
// TO-DO: Find a way to write in the error console using FMX for MacOS
FMX.Types.Log.d(aMessage);
{$ENDIF}
{$ENDIF}

View File

@ -88,6 +88,7 @@ type
implementation
uses
uCEFMiscFunctions,
{$IFDEF DELPHI16_UP}
System.SysUtils, System.Math;
{$ELSE}

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 297,
"InternalVersion" : 298,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "90.6.6.0"
"Version" : "90.6.7.0"
}
],
"UpdatePackageData" : {