From 6b042e813a1d480b1ed46944f0b952529c682362 Mon Sep 17 00:00:00 2001 From: salvadordf Date: Fri, 10 Mar 2023 16:55:57 +0100 Subject: [PATCH] Update to CEF 111.2.2 --- README.md | 16 +-- .../MediaRouter/uMediaRouterFrm.pas | 1 - .../MediaRouter/MediaRouter.lpi | 8 +- .../MediaRouter/uMediaRouterFrm.pas | 1 - packages/cef4delphi_lazarus.lpk | 2 +- source/uCEFApplicationCore.pas | 10 +- source/uCEFConstants.pas | 31 ++--- source/uCEFInterfaces.pas | 7 +- source/uCEFMediaSink.pas | 6 - source/uCEFTypes.pas | 3 +- source/uCEFViewsFrameworkEvents.pas | 32 ++--- source/uCEFWindowComponent.pas | 118 ++++++++++-------- source/uCEFWindowDelegate.pas | 48 +++++++ update_CEF4Delphi.json | 4 +- 14 files changed, 177 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index 06d5420b..5906099e 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,17 @@ 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 110.0.32 which includes Chromium 110.0.5481.180. +CEF4Delphi uses CEF 111.2.2 which includes Chromium 111.0.5563.65. The CEF binaries used by CEF4Delphi are available for download at Spotify : -* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_windows32.tar.bz2) -* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_windows64.tar.bz2) -* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_linux64.tar.bz2) -* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_linuxarm.tar.bz2) -* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_linuxarm64.tar.bz2) -* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_110.0.32%2Bg291f1df%2Bchromium-110.0.5481.180_macosx64.tar.bz2) +* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_windows32.tar.bz2) +* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_windows64.tar.bz2) +* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_linux64.tar.bz2) +* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_linuxarm.tar.bz2) +* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_linuxarm64.tar.bz2) +* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_111.2.2%2Bg1b83ff6%2Bchromium-111.0.5563.65_macosx64.tar.bz2) -CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.4/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. +CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi demos have been tested in Windows 10, Windows 11, Linux Mint 20.3 and Raspberry Pi OS. diff --git a/demos/Delphi_VCL/MediaRouter/uMediaRouterFrm.pas b/demos/Delphi_VCL/MediaRouter/uMediaRouterFrm.pas index 0a9ca23c..b64e5df2 100644 --- a/demos/Delphi_VCL/MediaRouter/uMediaRouterFrm.pas +++ b/demos/Delphi_VCL/MediaRouter/uMediaRouterFrm.pas @@ -646,7 +646,6 @@ begin begin FSinks[i].ID := aSinks[i].ID; FSinks[i].Name := aSinks[i].Name; - FSinks[i].Description := aSinks[i].Description; FSinks[i].IconType := aSinks[i].IconType; FSinks[i].SinkIntf := aSinks[i]; diff --git a/demos/Lazarus_Windows/MediaRouter/MediaRouter.lpi b/demos/Lazarus_Windows/MediaRouter/MediaRouter.lpi index 0567fc2f..3c5d1b43 100644 --- a/demos/Lazarus_Windows/MediaRouter/MediaRouter.lpi +++ b/demos/Lazarus_Windows/MediaRouter/MediaRouter.lpi @@ -1,7 +1,7 @@ - + @@ -9,9 +9,9 @@ + - <UseAppBundle Value="False"/> <ResourceType Value="res"/> @@ -25,7 +25,6 @@ </PublishOptions> <RunParams> <FormatVersion Value="2"/> - <Modes Count="0"/> </RunParams> <RequiredPackages Count="2"> <Item1> @@ -65,6 +64,9 @@ </SyntaxOptions> </Parsing> <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + </Debugging> <Options> <Win32> <GraphicApplication Value="True"/> diff --git a/demos/Lazarus_Windows/MediaRouter/uMediaRouterFrm.pas b/demos/Lazarus_Windows/MediaRouter/uMediaRouterFrm.pas index 6a9516df..f315ce11 100644 --- a/demos/Lazarus_Windows/MediaRouter/uMediaRouterFrm.pas +++ b/demos/Lazarus_Windows/MediaRouter/uMediaRouterFrm.pas @@ -564,7 +564,6 @@ begin begin FSinks[i].ID := aSinks[i].ID; FSinks[i].Name := aSinks[i].Name; - FSinks[i].Description := aSinks[i].Description; FSinks[i].IconType := aSinks[i].IconType; FSinks[i].SinkIntf := aSinks[i]; diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index 6c6990af..cbd89e6d 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -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="110" Release="32"/> + <Version Major="111" Minor="2" Release="2"/> <Files Count="214"> <Item1> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/> diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas index 492e5c85..0e5d059f 100644 --- a/source/uCEFApplicationCore.pas +++ b/source/uCEFApplicationCore.pas @@ -67,15 +67,15 @@ uses uCEFSchemeRegistrar, uCEFPreferenceRegistrar; const - CEF_SUPPORTED_VERSION_MAJOR = 110; - CEF_SUPPORTED_VERSION_MINOR = 0; - CEF_SUPPORTED_VERSION_RELEASE = 32; + CEF_SUPPORTED_VERSION_MAJOR = 111; + CEF_SUPPORTED_VERSION_MINOR = 2; + CEF_SUPPORTED_VERSION_RELEASE = 2; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; CEF_CHROMEELF_VERSION_MINOR = 0; - CEF_CHROMEELF_VERSION_RELEASE = 5481; - CEF_CHROMEELF_VERSION_BUILD = 180; + CEF_CHROMEELF_VERSION_RELEASE = 5563; + CEF_CHROMEELF_VERSION_BUILD = 65; {$IFDEF MSWINDOWS} LIBCEF_DLL = 'libcef.dll'; diff --git a/source/uCEFConstants.pas b/source/uCEFConstants.pas index 4e590593..8ca8970d 100644 --- a/source/uCEFConstants.pas +++ b/source/uCEFConstants.pas @@ -658,21 +658,22 @@ const CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM = 1 shl 2; CEF_PERMISSION_TYPE_CAMERA_STREAM = 1 shl 3; CEF_PERMISSION_TYPE_CLIPBOARD = 1 shl 4; - CEF_PERMISSION_TYPE_DISK_QUOTA = 1 shl 5; - CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 shl 6; - CEF_PERMISSION_TYPE_GEOLOCATION = 1 shl 7; - CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 shl 8; - CEF_PERMISSION_TYPE_MIC_STREAM = 1 shl 9; - CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 shl 10; - CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 shl 11; - CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 shl 12; - CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 shl 13; - CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 shl 14; - CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 shl 15; - CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 shl 16; - CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 shl 17; - CEF_PERMISSION_TYPE_VR_SESSION = 1 shl 18; - CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 shl 19; + CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS = 1 shl 5; + CEF_PERMISSION_TYPE_DISK_QUOTA = 1 shl 6; + CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 shl 7; + CEF_PERMISSION_TYPE_GEOLOCATION = 1 shl 8; + CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 shl 9; + CEF_PERMISSION_TYPE_MIC_STREAM = 1 shl 10; + CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 shl 11; + CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 shl 12; + CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 shl 13; + CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 shl 14; + CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 shl 15; + CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 shl 16; + CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 shl 17; + CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 shl 18; + CEF_PERMISSION_TYPE_VR_SESSION = 1 shl 19; + CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 shl 20; // /include/cef_api_hash.h (used as "cef_api_hash" parameters) CEF_API_HASH_PLATFORM = 0; diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 03ec890a..22ad30c7 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -175,7 +175,6 @@ type TCefMediaSinkInfo = record ID : ustring; Name : ustring; - Description : ustring; IconType : TCefMediaSinkIconType; SinkType : TCefMediaType; SinkIntf : ICefMediaSink; @@ -1418,7 +1417,6 @@ type ['{EDA1A4B2-2A4C-42DD-A7DF-901BF93D908D}'] function GetId: ustring; function GetName: ustring; - function GetDescription: ustring; function GetIconType: TCefMediaSinkIconType; procedure GetDeviceInfo(const callback: ICefMediaSinkDeviceInfoCallback); function IsCastSink: boolean; @@ -1427,7 +1425,6 @@ type property ID : ustring read GetId; property Name : ustring read GetName; - property Description : ustring read GetDescription; property IconType : TCefMediaSinkIconType read GetIconType; end; @@ -3026,6 +3023,8 @@ type procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); + procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); @@ -3045,6 +3044,8 @@ type procedure doOnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); procedure doOnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); procedure doOnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure doOnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); + procedure doOnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); procedure doOnCanResize(const window_: ICefWindow; var aResult : boolean); procedure doOnCanMaximize(const window_: ICefWindow; var aResult : boolean); procedure doOnCanMinimize(const window_: ICefWindow; var aResult : boolean); diff --git a/source/uCEFMediaSink.pas b/source/uCEFMediaSink.pas index 0e58d017..295b3905 100644 --- a/source/uCEFMediaSink.pas +++ b/source/uCEFMediaSink.pas @@ -56,7 +56,6 @@ type protected function GetId: ustring; function GetName: ustring; - function GetDescription: ustring; function GetIconType: TCefMediaSinkIconType; procedure GetDeviceInfo(const callback: ICefMediaSinkDeviceInfoCallback); function IsCastSink: boolean; @@ -81,11 +80,6 @@ begin Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_name(PCefMediaSink(FData))); end; -function TCefMediaSinkRef.GetDescription: ustring; -begin - Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_description(PCefMediaSink(FData))); -end; - function TCefMediaSinkRef.GetIconType: TCefMediaSinkIconType; begin Result := PCefMediaSink(FData)^.get_icon_type(PCefMediaSink(FData)); diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index 3bb48ab8..de9bfcdc 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -1721,7 +1721,6 @@ type base : TCefBaseRefCounted; get_id : function(self: PCefMediaSink): PCefStringUserFree; stdcall; get_name : function(self: PCefMediaSink): PCefStringUserFree; stdcall; - get_description : function(self: PCefMediaSink): PCefStringUserFree; stdcall; get_icon_type : function(self: PCefMediaSink): TCefMediaSinkIconType; stdcall; get_device_info : procedure(self: PCefMediaSink; callback: PCefMediaSinkDeviceInfoCallback); stdcall; is_cast_sink : function(self: PCefMediaSink): Integer; stdcall; @@ -3503,6 +3502,8 @@ type get_initial_bounds : function(self: PCefWindowDelegate; window: PCefWindow): TCefRect; stdcall; get_initial_show_state : function(self: PCefWindowDelegate; window: PCefWindow): TCefShowState; stdcall; is_frameless : function(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; + with_standard_window_buttons : function(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; + get_titlebar_height : function(self: PCefWindowDelegate; window: PCefWindow; titlebar_height: PSingle): Integer; stdcall; can_resize : function(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; can_maximize : function(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; can_minimize : function(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; diff --git a/source/uCEFViewsFrameworkEvents.pas b/source/uCEFViewsFrameworkEvents.pas index abc495e8..1144ebd2 100644 --- a/source/uCEFViewsFrameworkEvents.pas +++ b/source/uCEFViewsFrameworkEvents.pas @@ -90,21 +90,23 @@ type TOnMenuButtonPressedEvent = procedure(const Sender: TObject; const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock) of object; // ICefWindowDelegate - TOnWindowCreatedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; - TOnWindowClosingEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; - TOnWindowDestroyedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; - TOnWindowActivationChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; active: boolean) of object; - TOnWindowBoundsChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; const new_bounds: TCefRect) of object; - TOnGetParentWindowEvent = procedure(const Sender: TObject; const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow) of object; - TOnGetInitialBoundsEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefRect) of object; - TOnGetInitialShowStateEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefShowState) of object; - TOnIsFramelessEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; - TOnCanResizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; - TOnCanMaximizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; - TOnCanMinimizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; - TOnCanCloseEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; - TOnAcceleratorEvent = procedure(const Sender: TObject; const window_: ICefWindow; command_id: Integer; var aResult : boolean) of object; - TOnWindowKeyEventEvent = procedure(const Sender: TObject; const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean) of object; + TOnWindowCreatedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowClosingEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowDestroyedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowActivationChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; active: boolean) of object; + TOnWindowBoundsChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; const new_bounds: TCefRect) of object; + TOnGetParentWindowEvent = procedure(const Sender: TObject; const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow) of object; + TOnGetInitialBoundsEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefRect) of object; + TOnGetInitialShowStateEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefShowState) of object; + TOnIsFramelessEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnWithStandardWindowButtonsEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnGetTitlebarHeightEvent = procedure(const Sender: TObject; const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean) of object; + TOnCanResizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanMaximizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanMinimizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanCloseEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnAcceleratorEvent = procedure(const Sender: TObject; const window_: ICefWindow; command_id: Integer; var aResult : boolean) of object; + TOnWindowKeyEventEvent = procedure(const Sender: TObject; const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean) of object; implementation diff --git a/source/uCEFWindowComponent.pas b/source/uCEFWindowComponent.pas index f6d70f38..c360e855 100644 --- a/source/uCEFWindowComponent.pas +++ b/source/uCEFWindowComponent.pas @@ -63,25 +63,27 @@ type {$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows or pfidOSX or pfidLinux)]{$ENDIF}{$ENDIF} TCEFWindowComponent = class(TCEFPanelComponent, ICefWindowDelegateEvents) protected - FWindow : ICefWindow; - FWindowDlg : ICefWindowDelegate; + FWindow : ICefWindow; + FWindowDlg : ICefWindowDelegate; // ICefWindowDelegateEvents - FOnWindowCreated : TOnWindowCreatedEvent; - FOnWindowClosing : TOnWindowClosingEvent; - FOnWindowDestroyed : TOnWindowDestroyedEvent; - FOnWindowActivationChanged : TOnWindowActivationChangedEvent; - FOnWindowBoundsChanged : TOnWindowBoundsChangedEvent; - FOnGetParentWindow : TOnGetParentWindowEvent; - FOnGetInitialBounds : TOnGetInitialBoundsEvent; - FOnGetInitialShowState : TOnGetInitialShowStateEvent; - FOnIsFrameless : TOnIsFramelessEvent; - FOnCanResize : TOnCanResizeEvent; - FOnCanMaximize : TOnCanMaximizeEvent; - FOnCanMinimize : TOnCanMinimizeEvent; - FOnCanClose : TOnCanCloseEvent; - FOnAccelerator : TOnAcceleratorEvent; - FOnKeyEvent : TOnWindowKeyEventEvent; + FOnWindowCreated : TOnWindowCreatedEvent; + FOnWindowClosing : TOnWindowClosingEvent; + FOnWindowDestroyed : TOnWindowDestroyedEvent; + FOnWindowActivationChanged : TOnWindowActivationChangedEvent; + FOnWindowBoundsChanged : TOnWindowBoundsChangedEvent; + FOnGetParentWindow : TOnGetParentWindowEvent; + FOnGetInitialBounds : TOnGetInitialBoundsEvent; + FOnGetInitialShowState : TOnGetInitialShowStateEvent; + FOnIsFrameless : TOnIsFramelessEvent; + FOnWithStandardWindowButtons : TOnWithStandardWindowButtonsEvent; + FOnGetTitlebarHeight : TOnGetTitlebarHeightEvent; + FOnCanResize : TOnCanResizeEvent; + FOnCanMaximize : TOnCanMaximizeEvent; + FOnCanMinimize : TOnCanMinimizeEvent; + FOnCanClose : TOnCanCloseEvent; + FOnAccelerator : TOnAcceleratorEvent; + FOnKeyEvent : TOnWindowKeyEventEvent; procedure DestroyView; override; procedure Initialize; override; @@ -119,6 +121,8 @@ type procedure doOnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); procedure doOnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); procedure doOnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure doOnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); + procedure doOnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); procedure doOnCanResize(const window_: ICefWindow; var aResult : boolean); procedure doOnCanMaximize(const window_: ICefWindow; var aResult : boolean); procedure doOnCanMinimize(const window_: ICefWindow; var aResult : boolean); @@ -166,21 +170,23 @@ type property IsMinimized : boolean read GetIsMinimized; published - property OnWindowCreated : TOnWindowCreatedEvent read FOnWindowCreated write FOnWindowCreated; - property OnWindowClosing : TOnWindowClosingEvent read FOnWindowClosing write FOnWindowClosing; - property OnWindowDestroyed : TOnWindowDestroyedEvent read FOnWindowDestroyed write FOnWindowDestroyed; - property OnWindowActivationChanged : TOnWindowActivationChangedEvent read FOnWindowActivationChanged write FOnWindowActivationChanged; - property OnWindowBoundsChanged : TOnWindowBoundsChangedEvent read FOnWindowBoundsChanged write FOnWindowBoundsChanged; - property OnGetParentWindow : TOnGetParentWindowEvent read FOnGetParentWindow write FOnGetParentWindow; - property OnGetInitialBounds : TOnGetInitialBoundsEvent read FOnGetInitialBounds write FOnGetInitialBounds; - property OnGetInitialShowState : TOnGetInitialShowStateEvent read FOnGetInitialShowState write FOnGetInitialShowState; - property OnIsFrameless : TOnIsFramelessEvent read FOnIsFrameless write FOnIsFrameless; - property OnCanResize : TOnCanResizeEvent read FOnCanResize write FOnCanResize; - property OnCanMaximize : TOnCanMaximizeEvent read FOnCanMaximize write FOnCanMaximize; - property OnCanMinimize : TOnCanMinimizeEvent read FOnCanMinimize write FOnCanMinimize; - property OnCanClose : TOnCanCloseEvent read FOnCanClose write FOnCanClose; - property OnAccelerator : TOnAcceleratorEvent read FOnAccelerator write FOnAccelerator; - property OnKeyEvent : TOnWindowKeyEventEvent read FOnKeyEvent write FOnKeyEvent; + property OnWindowCreated : TOnWindowCreatedEvent read FOnWindowCreated write FOnWindowCreated; + property OnWindowClosing : TOnWindowClosingEvent read FOnWindowClosing write FOnWindowClosing; + property OnWindowDestroyed : TOnWindowDestroyedEvent read FOnWindowDestroyed write FOnWindowDestroyed; + property OnWindowActivationChanged : TOnWindowActivationChangedEvent read FOnWindowActivationChanged write FOnWindowActivationChanged; + property OnWindowBoundsChanged : TOnWindowBoundsChangedEvent read FOnWindowBoundsChanged write FOnWindowBoundsChanged; + property OnGetParentWindow : TOnGetParentWindowEvent read FOnGetParentWindow write FOnGetParentWindow; + property OnGetInitialBounds : TOnGetInitialBoundsEvent read FOnGetInitialBounds write FOnGetInitialBounds; + property OnGetInitialShowState : TOnGetInitialShowStateEvent read FOnGetInitialShowState write FOnGetInitialShowState; + property OnIsFrameless : TOnIsFramelessEvent read FOnIsFrameless write FOnIsFrameless; + property OnWithStandardWindowButtons : TOnWithStandardWindowButtonsEvent read FOnWithStandardWindowButtons write FOnWithStandardWindowButtons; + property OnGetTitlebarHeight : TOnGetTitlebarHeightEvent read FOnGetTitlebarHeight write FOnGetTitlebarHeight; + property OnCanResize : TOnCanResizeEvent read FOnCanResize write FOnCanResize; + property OnCanMaximize : TOnCanMaximizeEvent read FOnCanMaximize write FOnCanMaximize; + property OnCanMinimize : TOnCanMinimizeEvent read FOnCanMinimize write FOnCanMinimize; + property OnCanClose : TOnCanCloseEvent read FOnCanClose write FOnCanClose; + property OnAccelerator : TOnAcceleratorEvent read FOnAccelerator write FOnAccelerator; + property OnKeyEvent : TOnWindowKeyEventEvent read FOnKeyEvent write FOnKeyEvent; end; {$IFDEF FPC} @@ -223,23 +229,25 @@ procedure TCEFWindowComponent.Initialize; begin inherited Initialize; - FWindow := nil; - FWindowDlg := nil; - FOnWindowCreated := nil; - FOnWindowClosing := nil; - FOnWindowDestroyed := nil; - FOnWindowActivationChanged := nil; - FOnWindowBoundsChanged := nil; - FOnGetParentWindow := nil; - FOnGetInitialBounds := nil; - FOnGetInitialShowState := nil; - FOnIsFrameless := nil; - FOnCanResize := nil; - FOnCanMaximize := nil; - FOnCanMinimize := nil; - FOnCanClose := nil; - FOnAccelerator := nil; - FOnKeyEvent := nil; + FWindow := nil; + FWindowDlg := nil; + FOnWindowCreated := nil; + FOnWindowClosing := nil; + FOnWindowDestroyed := nil; + FOnWindowActivationChanged := nil; + FOnWindowBoundsChanged := nil; + FOnGetParentWindow := nil; + FOnGetInitialBounds := nil; + FOnGetInitialShowState := nil; + FOnIsFrameless := nil; + FOnWithStandardWindowButtons := nil; + FOnGetTitlebarHeight := nil; + FOnCanResize := nil; + FOnCanMaximize := nil; + FOnCanMinimize := nil; + FOnCanClose := nil; + FOnAccelerator := nil; + FOnKeyEvent := nil; end; procedure TCEFWindowComponent.CreateTopLevelWindow; @@ -354,6 +362,18 @@ begin FOnIsFrameless(self, window_, aResult); end; +procedure TCEFWindowComponent.doOnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); +begin + if assigned(FOnWithStandardWindowButtons) then + FOnWithStandardWindowButtons(self, window_, aResult); +end; + +procedure TCEFWindowComponent.doOnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); +begin + if assigned(FOnGetTitlebarHeight) then + FOnGetTitlebarHeight(self, window_, titlebar_height, aResult); +end; + procedure TCEFWindowComponent.doOnCanResize(const window_: ICefWindow; var aResult : boolean); begin if assigned(FOnCanResize) then diff --git a/source/uCEFWindowDelegate.pas b/source/uCEFWindowDelegate.pas index af840f45..1c9e0f94 100644 --- a/source/uCEFWindowDelegate.pas +++ b/source/uCEFWindowDelegate.pas @@ -68,6 +68,8 @@ type procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); + procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); @@ -90,6 +92,8 @@ type procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); virtual; procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); virtual; procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); virtual; procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); virtual; @@ -129,6 +133,8 @@ type procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); override; procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); override; procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); override; + procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); override; + procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); override; procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); override; procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); override; procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); override; @@ -207,6 +213,16 @@ begin aResult := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; +procedure TCefWindowDelegateRef.OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); +begin + aResult := (PCefWindowDelegate(FData)^.with_standard_window_buttons(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); +end; + +procedure TCefWindowDelegateRef.OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); +begin + aResult := (PCefWindowDelegate(FData)^.get_titlebar_height(PCefWindowDelegate(FData), CefGetData(window_), @titlebar_height) <> 0); +end; + procedure TCefWindowDelegateRef.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin aResult := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); @@ -518,6 +534,16 @@ begin // end; +procedure TCefWindowDelegateOwn.OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); +begin + // +end; + +procedure TCefWindowDelegateOwn.OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); +begin + // +end; + procedure TCefWindowDelegateOwn.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin // @@ -769,6 +795,28 @@ begin end; end; +procedure TCustomWindowDelegate.OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); +begin + try + if (FEvents <> nil) then + ICefWindowDelegateEvents(FEvents).doOnWithStandardWindowButtons(window_, aResult); + except + on e : exception do + if CustomExceptionHandler('TCustomWindowDelegate.OnWithStandardWindowButtons', e) then raise; + end; +end; + +procedure TCustomWindowDelegate.OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); +begin + try + if (FEvents <> nil) then + ICefWindowDelegateEvents(FEvents).doOnGetTitlebarHeight(window_, titlebar_height, aResult); + except + on e : exception do + if CustomExceptionHandler('TCustomWindowDelegate.OnGetTitlebarHeight', e) then raise; + end; +end; + procedure TCustomWindowDelegate.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin try diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 0bb34fd7..8597f704 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 470, + "InternalVersion" : 471, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "110.0.32" + "Version" : "111.2.2" } ], "UpdatePackageData" : {