diff --git a/README.md b/README.md index 5c8eecd0..29757de7 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/demos/Delphi_FMX_Linux/FMXExternalPumpBrowser2/uFMXExternalPumpBrowser2.pas b/demos/Delphi_FMX_Linux/FMXExternalPumpBrowser2/uFMXExternalPumpBrowser2.pas index ff45583a..3ca4423e 100644 --- a/demos/Delphi_FMX_Linux/FMXExternalPumpBrowser2/uFMXExternalPumpBrowser2.pas +++ b/demos/Delphi_FMX_Linux/FMXExternalPumpBrowser2/uFMXExternalPumpBrowser2.pas @@ -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; diff --git a/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx b/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx index a8d79bd6..e35e9680 100644 --- a/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx +++ b/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx @@ -159,6 +159,7 @@ object FMXExternalPumpBrowserFrm: TFMXExternalPumpBrowserFrm end end object chrmosr: TFMXChromium + OnBeforeContextMenu = chrmosrBeforeContextMenu OnTooltip = chrmosrTooltip OnCursorChange = chrmosrCursorChange OnBeforePopup = chrmosrBeforePopup diff --git a/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas b/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas index 09981b4f..959b25d8 100644 --- a/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas +++ b/demos/Delphi_FMX_Mac/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas @@ -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; diff --git a/packages/CEF4Delphi_FMX.dpk b/packages/CEF4Delphi_FMX.dpk index 3d84d9d0..df93e51e 100644 --- a/packages/CEF4Delphi_FMX.dpk +++ b/packages/CEF4Delphi_FMX.dpk @@ -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. diff --git a/packages/CEF4Delphi_FMX.dproj b/packages/CEF4Delphi_FMX.dproj index 030e6485..0cad2ddd 100644 --- a/packages/CEF4Delphi_FMX.dproj +++ b/packages/CEF4Delphi_FMX.dproj @@ -347,6 +347,8 @@ + + Base diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index d43bb0c6..af4245e7 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ - + diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas index 7ecc8569..3721e3a3 100644 --- a/source/uCEFApplicationCore.pas +++ b/source/uCEFApplicationCore.pas @@ -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; diff --git a/source/uCEFMacOSFunctions.pas b/source/uCEFMacOSFunctions.pas index 13264703..04f65176 100644 --- a/source/uCEFMacOSFunctions.pas +++ b/source/uCEFMacOSFunctions.pas @@ -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} diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index eae3de33..ba31c871 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -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} diff --git a/source/uCEFWorkSchedulerThread.pas b/source/uCEFWorkSchedulerThread.pas index 3cf7e42e..320c1311 100644 --- a/source/uCEFWorkSchedulerThread.pas +++ b/source/uCEFWorkSchedulerThread.pas @@ -88,6 +88,7 @@ type implementation uses + uCEFMiscFunctions, {$IFDEF DELPHI16_UP} System.SysUtils, System.Math; {$ELSE} diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index f7a0951e..e55fe244 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -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" : {