diff --git a/README.md b/README.md index 4603d3e4..babae1d5 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 LICENSE.md file. -CEF4Delphi uses CEF 118.6.10 which includes Chromium 118.0.5993.119. +CEF4Delphi uses CEF 118.7.1 which includes Chromium 118.0.5993.119. The CEF binaries used by CEF4Delphi are available for download at Spotify : -* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_windows32.tar.bz2) -* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_windows64.tar.bz2) -* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_linux64.tar.bz2) -* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_linuxarm.tar.bz2) -* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_linuxarm64.tar.bz2) -* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.6.10%2Bg38848f1%2Bchromium-118.0.5993.119_macosx64.tar.bz2) +* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_windows32.tar.bz2) +* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_windows64.tar.bz2) +* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_linux64.tar.bz2) +* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_linuxarm.tar.bz2) +* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_linuxarm64.tar.bz2) +* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_118.7.1%2Bg99817d2%2Bchromium-118.0.5993.119_macosx64.tar.bz2) CEF4Delphi was developed and tested on Delphi 12.0 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 11 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index 4d03a4dc..06764b83 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -57,6 +57,7 @@ const MINIBROWSER_CONTEXTMENU_INCZOOM = MENU_ID_USER_FIRST + 15; MINIBROWSER_CONTEXTMENU_DECZOOM = MENU_ID_USER_FIRST + 16; MINIBROWSER_CONTEXTMENU_RESETZOOM = MENU_ID_USER_FIRST + 17; + MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN = MENU_ID_USER_FIRST + 18; DEVTOOLS_SCREENSHOT_MSGID = 1; DEVTOOLS_MHTML_MSGID = 2; @@ -420,6 +421,12 @@ begin if Chromium1.CanResetZoom then model.AddItem(MINIBROWSER_CONTEXTMENU_RESETZOOM, 'Reset zoom'); + + if Chromium1.Fullscreen then + begin + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN, 'Exit fullscreen'); + end; end else model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools'); @@ -608,6 +615,8 @@ begin MINIBROWSER_CONTEXTMENU_RESETZOOM : Chromium1.ResetZoomCommand; + MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN : + Chromium1.ExitFullscreen(True); end else case commandId of @@ -1081,11 +1090,15 @@ end; procedure TMiniBrowserFrm.Chromium1RenderCompMsg(Sender: TObject; var aMessage : TMessage; var aHandled: Boolean); begin - if not(FClosing) and (aMessage.Msg = WM_MOUSEMOVE) then - begin - StatusBar1.Panels[2].Text := 'x : ' + inttostr(aMessage.lParam and $FFFF); - StatusBar1.Panels[3].Text := 'y : ' + inttostr((aMessage.lParam and $FFFF0000) shr 16); - end; + if FClosing then exit; + + case aMessage.Msg of + WM_MOUSEMOVE : + begin + StatusBar1.Panels[2].Text := 'x : ' + inttostr(aMessage.lParam and $FFFF); + StatusBar1.Panels[3].Text := 'y : ' + inttostr((aMessage.lParam and $FFFF0000) shr 16); + end; + end; end; procedure TMiniBrowserFrm.Chromium1RequestMediaAccessPermission(Sender: TObject; diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas index bd938565..8951c5cb 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas @@ -82,7 +82,8 @@ const MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14; MINIBROWSER_CONTEXTMENU_INCZOOM = MENU_ID_USER_FIRST + 15; MINIBROWSER_CONTEXTMENU_DECZOOM = MENU_ID_USER_FIRST + 16; - MINIBROWSER_CONTEXTMENU_RESETZOOM = MENU_ID_USER_FIRST + 17; + MINIBROWSER_CONTEXTMENU_RESETZOOM = MENU_ID_USER_FIRST + 17; + MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN = MENU_ID_USER_FIRST + 18; DEVTOOLS_SCREENSHOT_MSGID = 1; DEVTOOLS_MHTML_MSGID = 2; @@ -531,7 +532,13 @@ begin model.AddItem(MINIBROWSER_CONTEXTMENU_DECZOOM, 'Decrement zoom'); if Chromium1.CanResetZoom then - model.AddItem(MINIBROWSER_CONTEXTMENU_RESETZOOM, 'Reset zoom'); + model.AddItem(MINIBROWSER_CONTEXTMENU_RESETZOOM, 'Reset zoom'); + + if Chromium1.Fullscreen then + begin + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN, 'Exit fullscreen'); + end; end else model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools'); @@ -700,7 +707,10 @@ begin Chromium1.DecZoomCommand; MINIBROWSER_CONTEXTMENU_RESETZOOM : - Chromium1.ResetZoomCommand; + Chromium1.ResetZoomCommand; + + MINIBROWSER_CONTEXTMENU_EXITFULLSCREEN : + Chromium1.ExitFullscreen(True); end else case commandId of diff --git a/docs/cef4delphi.chm b/docs/cef4delphi.chm index e3c6bc9a..05bdfdcb 100644 Binary files a/docs/cef4delphi.chm and b/docs/cef4delphi.chm differ diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index afb7ce95..7d8ddd0f 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ - + diff --git a/source/uCEFBrowser.pas b/source/uCEFBrowser.pas index 677de3bc..6edf110e 100644 --- a/source/uCEFBrowser.pas +++ b/source/uCEFBrowser.pas @@ -116,6 +116,8 @@ type function IsBackgroundHost : boolean; procedure SetAudioMuted(mute: boolean); function IsAudioMuted : boolean; + function IsFullscreen : boolean; + procedure ExitFullscreen(will_cause_resize: boolean); public class function UnWrap(data: Pointer): ICefBrowserHost; @@ -358,6 +360,16 @@ begin Result := PCefBrowserHost(FData)^.is_audio_muted(PCefBrowserHost(FData)) <> 0; end; +function TCefBrowserHostRef.IsFullscreen : boolean; +begin + Result := PCefBrowserHost(FData)^.is_fullscreen(PCefBrowserHost(FData)) <> 0; +end; + +procedure TCefBrowserHostRef.ExitFullscreen(will_cause_resize: boolean); +begin + PCefBrowserHost(FData)^.exit_fullscreen(PCefBrowserHost(FData), Ord(will_cause_resize)); +end; + procedure TCefBrowserHostRef.DragTargetDragEnter(const dragData: ICefDragData; const event: PCefMouseEvent; allowedOps: TCefDragOperations); begin PCefBrowserHost(FData)^.drag_target_drag_enter(PCefBrowserHost(FData), CefGetData(dragData), event, allowedOps); diff --git a/source/uCEFChromiumCore.pas b/source/uCEFChromiumCore.pas index 7aef676b..ad35eefa 100644 --- a/source/uCEFChromiumCore.pas +++ b/source/uCEFChromiumCore.pas @@ -361,6 +361,7 @@ type function GetRequestContextCache : ustring; function GetRequestContextIsGlobal : boolean; function GetAudioMuted : boolean; + function GetFullscreen : boolean; function GetParentFormHandle : TCefWindowHandle; virtual; function GetRequestContext : ICefRequestContext; function GetMediaRouter : ICefMediaRouter; @@ -1270,6 +1271,18 @@ type /// procedure Invalidate(type_: TCefPaintElementType = PET_VIEW); /// + /// Requests the renderer to exit browser fullscreen. In most cases exiting + /// window fullscreen should also exit browser fullscreen. With the Alloy + /// runtime this function should be called in response to a user action such + /// as clicking the green traffic light button on MacOS + /// (ICefWindowDelegate.OnWindowFullscreenTransition callback) or pressing + /// the "ESC" key (ICefKeyboardHandler.OnPreKeyEvent callback). With the + /// Chrome runtime these standard exit actions are handled internally but + /// new/additional user actions can use this function. Set |will_cause_resize| + /// to true (1) if exiting browser fullscreen will cause a view resize. + /// + procedure ExitFullscreen(will_cause_resize: boolean); + /// /// Issue a BeginFrame request to Chromium. Only valid when /// TCefWindowInfo.external_begin_frame_enabled is set to true (1). /// @@ -1944,6 +1957,14 @@ type /// property AudioMuted : boolean read GetAudioMuted write SetAudioMuted; /// + /// Returns true (1) if the renderer is currently in browser fullscreen. This + /// differs from window fullscreen in that browser fullscreen is entered using + /// the JavaScript Fullscreen API and modifies CSS attributes such as the + /// ::backdrop pseudo-element and :fullscreen pseudo-structure. This property + /// can only be called on the UI thread. + /// + property Fullscreen : boolean read GetFullscreen; + /// /// Forces the Google safesearch in the browser preferences. /// property SafeSearch : boolean read FSafeSearch write SetSafeSearch; @@ -5494,6 +5515,11 @@ begin Result := Initialized and Browser.host.IsAudioMuted; end; +function TChromiumCore.GetFullscreen : boolean; +begin + Result := Initialized and Browser.host.IsFullscreen; +end; + function TChromiumCore.GetParentFormHandle : TCefWindowHandle; begin InitializeWindowHandle(Result); @@ -9321,6 +9347,12 @@ begin end; end; +procedure TChromiumCore.ExitFullscreen(will_cause_resize: boolean); +begin + if Initialized then + Browser.Host.ExitFullscreen(will_cause_resize); +end; + procedure TChromiumCore.SendExternalBeginFrame; begin if Initialized then diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 5949b47c..1f3b39d5 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -1297,6 +1297,26 @@ type /// be called on the UI thread. /// function IsAudioMuted : boolean; + /// + /// Returns true (1) if the renderer is currently in browser fullscreen. This + /// differs from window fullscreen in that browser fullscreen is entered using + /// the JavaScript Fullscreen API and modifies CSS attributes such as the + /// ::backdrop pseudo-element and :fullscreen pseudo-structure. This function + /// can only be called on the UI thread. + /// + function IsFullscreen : boolean; + /// + /// Requests the renderer to exit browser fullscreen. In most cases exiting + /// window fullscreen should also exit browser fullscreen. With the Alloy + /// runtime this function should be called in response to a user action such + /// as clicking the green traffic light button on MacOS + /// (ICefWindowDelegate.OnWindowFullscreenTransition callback) or pressing + /// the "ESC" key (ICefKeyboardHandler.OnPreKeyEvent callback). With the + /// Chrome runtime these standard exit actions are handled internally but + /// new/additional user actions can use this function. Set |will_cause_resize| + /// to true (1) if exiting browser fullscreen will cause a view resize. + /// + procedure ExitFullscreen(will_cause_resize: boolean); /// /// Returns the hosted browser object. @@ -6801,9 +6821,9 @@ type /// the browser content area. If |fullscreen| is false (0) the content will /// automatically return to its original size and position. With the Alloy /// runtime the client is responsible for triggering the fullscreen transition - /// (for example, by calling cef_window_t::SetFullscreen when using Views). + /// (for example, by calling ICefWindow.SetFullscreen when using Views). /// With the Chrome runtime the fullscreen transition will be triggered - /// automatically. The cef_window_delegate_t::OnWindowFullscreenTransition + /// automatically. The ICefWindowDelegate.OnWindowFullscreenTransition /// function will be called during the fullscreen transition for notification /// purposes. /// diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index fcfc87dc..1c31d637 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -6959,6 +6959,8 @@ type is_background_host : function(self: PCefBrowserHost): integer; stdcall; set_audio_muted : procedure(self: PCefBrowserHost; mute: integer); stdcall; is_audio_muted : function(self: PCefBrowserHost): integer; stdcall; + is_fullscreen : function(self: PCefBrowserHost): integer; stdcall; + exit_fullscreen : procedure(self: PCefBrowserHost; will_cause_resize: integer); stdcall; end; /// diff --git a/source/uCEFVersion.inc b/source/uCEFVersion.inc index f33b47b9..5579fb19 100644 --- a/source/uCEFVersion.inc +++ b/source/uCEFVersion.inc @@ -1,6 +1,6 @@ CEF_SUPPORTED_VERSION_MAJOR = 118; - CEF_SUPPORTED_VERSION_MINOR = 6; - CEF_SUPPORTED_VERSION_RELEASE = 10; + CEF_SUPPORTED_VERSION_MINOR = 7; + CEF_SUPPORTED_VERSION_RELEASE = 1; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 998085f2..4d0f9442 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 538, + "InternalVersion" : 539, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "118.6.10" + "Version" : "118.7.1" } ], "UpdatePackageData" : {