mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +02:00
parent
6d5b74070b
commit
8f1b88bac9
14
README.md
14
README.md
@ -3,14 +3,14 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
|
|||||||
|
|
||||||
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
|
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
|
||||||
|
|
||||||
CEF4Delphi uses CEF 88.2.1 which includes Chromium 88.0.4324.146.
|
CEF4Delphi uses CEF 88.2.4 which includes Chromium 88.0.4324.150.
|
||||||
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
||||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_windows32.tar.bz2)
|
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_windows32.tar.bz2)
|
||||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_windows64.tar.bz2)
|
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_windows64.tar.bz2)
|
||||||
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_linux32.tar.bz2)
|
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_linux32.tar.bz2)
|
||||||
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_linux64.tar.bz2)
|
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_linux64.tar.bz2)
|
||||||
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_linuxarm.tar.bz2)
|
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_linuxarm.tar.bz2)
|
||||||
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.1%2Bg0b18d0b%2Bchromium-88.0.4324.146_linuxarm64.tar.bz2)
|
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.4%2Bgf3c4ca9%2Bchromium-88.0.4324.150_linuxarm64.tar.bz2)
|
||||||
|
|
||||||
CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</CompilerOptions>
|
</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."/>
|
<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"/>
|
<License Value="MPL 1.1"/>
|
||||||
<Version Major="88" Minor="2" Release="1"/>
|
<Version Major="88" Minor="2" Release="4"/>
|
||||||
<Files Count="196">
|
<Files Count="196">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||||
|
@ -66,13 +66,13 @@ uses
|
|||||||
const
|
const
|
||||||
CEF_SUPPORTED_VERSION_MAJOR = 88;
|
CEF_SUPPORTED_VERSION_MAJOR = 88;
|
||||||
CEF_SUPPORTED_VERSION_MINOR = 2;
|
CEF_SUPPORTED_VERSION_MINOR = 2;
|
||||||
CEF_SUPPORTED_VERSION_RELEASE = 1;
|
CEF_SUPPORTED_VERSION_RELEASE = 4;
|
||||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||||
|
|
||||||
CEF_CHROMEELF_VERSION_MAJOR = 88;
|
CEF_CHROMEELF_VERSION_MAJOR = 88;
|
||||||
CEF_CHROMEELF_VERSION_MINOR = 0;
|
CEF_CHROMEELF_VERSION_MINOR = 0;
|
||||||
CEF_CHROMEELF_VERSION_RELEASE = 4324;
|
CEF_CHROMEELF_VERSION_RELEASE = 4324;
|
||||||
CEF_CHROMEELF_VERSION_BUILD = 146;
|
CEF_CHROMEELF_VERSION_BUILD = 150;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
LIBCEF_DLL = 'libcef.dll';
|
LIBCEF_DLL = 'libcef.dll';
|
||||||
|
@ -190,14 +190,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TChromium.GetParentFormHandle : TCefWindowHandle;
|
function TChromium.GetParentFormHandle : TCefWindowHandle;
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
var
|
var
|
||||||
TempForm : TCustomForm;
|
TempForm : TCustomForm;
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
Result := inherited GetParentFormHandle;
|
Result := inherited GetParentFormHandle;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
TempForm := GetParentForm;
|
TempForm := GetParentForm;
|
||||||
|
|
||||||
if (TempForm <> nil) and TempForm.HandleAllocated then
|
if (TempForm <> nil) and TempForm.HandleAllocated then
|
||||||
@ -207,7 +203,6 @@ begin
|
|||||||
(Application.MainForm <> nil) and
|
(Application.MainForm <> nil) and
|
||||||
Application.MainForm.HandleAllocated then
|
Application.MainForm.HandleAllocated then
|
||||||
Result := Application.MainForm.Handle;
|
Result := Application.MainForm.Handle;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromium.MoveFormTo(const x, y: Integer);
|
procedure TChromium.MoveFormTo(const x, y: Integer);
|
||||||
|
@ -50,20 +50,22 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX, WinApi.CommCtrl,{$ENDIF}
|
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX, WinApi.CommCtrl,{$ENDIF}
|
||||||
System.Classes, System.SyncObjs, System.Types,
|
System.Classes, System.SyncObjs, System.Types,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF MSWINDOWS}Windows, ActiveX, CommCtrl,{$ENDIF} Classes,
|
{$IFDEF MSWINDOWS}Windows, ActiveX, CommCtrl,{$ENDIF} Classes,
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
|
LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
|
||||||
|
{$IFDEF LINUX}xlib,{$ENDIF}
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Messages,
|
Messages,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SyncObjs,
|
SyncObjs,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFMiscFunctions, uCEFClient,
|
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFMiscFunctions, uCEFClient,
|
||||||
uCEFConstants, uCEFTask, uCEFDomVisitor, uCEFChromiumEvents,
|
uCEFConstants, uCEFTask, uCEFDomVisitor, uCEFChromiumEvents,
|
||||||
{$IFDEF MSWINDOWS}uCEFDragAndDropMgr,{$ENDIF}
|
{$IFDEF MSWINDOWS}uCEFDragAndDropMgr,{$ENDIF}
|
||||||
|
{$IFDEF LINUX}uCEFLinuxTypes,{$ENDIF}
|
||||||
uCEFChromiumOptions, uCEFChromiumFontOptions, uCEFPDFPrintOptions,
|
uCEFChromiumOptions, uCEFChromiumFontOptions, uCEFPDFPrintOptions,
|
||||||
uCEFBrowserViewComponent;
|
uCEFBrowserViewComponent;
|
||||||
|
|
||||||
@ -143,6 +145,10 @@ type
|
|||||||
FJavascriptEnabled : boolean;
|
FJavascriptEnabled : boolean;
|
||||||
FLoadImagesAutomatically : boolean;
|
FLoadImagesAutomatically : boolean;
|
||||||
|
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
FXDisplay : PXDisplay;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
FOldBrowserCompWndPrc : TFNWndProc;
|
FOldBrowserCompWndPrc : TFNWndProc;
|
||||||
FOldWidgetCompWndPrc : TFNWndProc;
|
FOldWidgetCompWndPrc : TFNWndProc;
|
||||||
@ -356,6 +362,9 @@ type
|
|||||||
function GetBrowserById(aID : integer) : ICefBrowser;
|
function GetBrowserById(aID : integer) : ICefBrowser;
|
||||||
function GetBrowserCount : integer;
|
function GetBrowserCount : integer;
|
||||||
function GetBrowserIdByIndex(aIndex : integer) : integer;
|
function GetBrowserIdByIndex(aIndex : integer) : integer;
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
function GetXDisplay : PXDisplay;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure SetDoNotTrack(aValue : boolean);
|
procedure SetDoNotTrack(aValue : boolean);
|
||||||
procedure SetSendReferrer(aValue : boolean);
|
procedure SetSendReferrer(aValue : boolean);
|
||||||
@ -436,9 +445,6 @@ type
|
|||||||
function ExecuteSetZoomLevelTask(const aValue : double) : boolean;
|
function ExecuteSetZoomLevelTask(const aValue : double) : boolean;
|
||||||
function ExecuteSetZoomStepTask(aValue : byte) : boolean;
|
function ExecuteSetZoomStepTask(aValue : byte) : boolean;
|
||||||
function ExecuteBrowserNavigationTask(aTask : TCefBrowserNavigation) : 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 UpdateHostZoomLevel(const aValue : double);
|
||||||
procedure UpdateHostZoomPct(const aValue : double);
|
procedure UpdateHostZoomPct(const aValue : double);
|
||||||
@ -643,9 +649,6 @@ type
|
|||||||
procedure doMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute); virtual;
|
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 doOnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring); virtual;
|
||||||
procedure doBrowserNavigation(aTask : TCefBrowserNavigation); 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 MustCreateAudioHandler : boolean; virtual;
|
||||||
function MustCreateDevToolsMessageObserver : boolean; virtual;
|
function MustCreateDevToolsMessageObserver : boolean; virtual;
|
||||||
function MustCreateLoadHandler : boolean; virtual;
|
function MustCreateLoadHandler : boolean; virtual;
|
||||||
@ -906,6 +909,9 @@ type
|
|||||||
property QuicAllowed : boolean read FQuicAllowed write SetQuicAllowed;
|
property QuicAllowed : boolean read FQuicAllowed write SetQuicAllowed;
|
||||||
property JavascriptEnabled : boolean read FJavascriptEnabled write SetJavascriptEnabled;
|
property JavascriptEnabled : boolean read FJavascriptEnabled write SetJavascriptEnabled;
|
||||||
property LoadImagesAutomatically : boolean read FLoadImagesAutomatically write SetLoadImagesAutomatically;
|
property LoadImagesAutomatically : boolean read FLoadImagesAutomatically write SetLoadImagesAutomatically;
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
property XDisplay : PXDisplay read GetXDisplay;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
|
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
|
||||||
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
|
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
|
||||||
@ -1161,7 +1167,7 @@ uses
|
|||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.SysUtils, System.Math,
|
System.SysUtils, System.Math,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
SysUtils, Math, {$IFDEF FPC}{$IFDEF LINUX}xlib, x, xatom,{$ENDIF}{$ENDIF}
|
SysUtils, Math, {$IFDEF FPC}{$IFDEF LINUX}x, xatom, gdk2x, gtk2,{$ENDIF}{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
|
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
|
||||||
uCEFApplicationCore, uCEFProcessMessage, uCEFRequestContext,
|
uCEFApplicationCore, uCEFProcessMessage, uCEFRequestContext,
|
||||||
@ -1220,6 +1226,9 @@ begin
|
|||||||
FQuicAllowed := True;
|
FQuicAllowed := True;
|
||||||
FJavascriptEnabled := True;
|
FJavascriptEnabled := True;
|
||||||
FLoadImagesAutomatically := True;
|
FLoadImagesAutomatically := True;
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
FXDisplay := nil;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
if (GlobalCEFApp <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
FHyperlinkAuditing := GlobalCEFApp.HyperlinkAuditing
|
FHyperlinkAuditing := GlobalCEFApp.HyperlinkAuditing
|
||||||
@ -2517,57 +2526,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
procedure TChromiumCore.GoBack;
|
||||||
begin
|
begin
|
||||||
ExecuteBrowserNavigationTask(bnBack);
|
ExecuteBrowserNavigationTask(bnBack);
|
||||||
@ -2765,6 +2723,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
function TChromiumCore.GetXDisplay : PXDisplay;
|
||||||
|
{$IFDEF FPC}
|
||||||
|
var
|
||||||
|
TempParent : TCefWindowHandle;
|
||||||
|
{$ENDIF}
|
||||||
|
begin
|
||||||
|
if (FXDisplay = nil) then
|
||||||
|
begin
|
||||||
|
{$IFDEF FPC}
|
||||||
|
TempParent := ParentFormHandle;
|
||||||
|
|
||||||
|
if ValidCefWindowHandle(TempParent) and
|
||||||
|
(PGtkWidget(TempParent)^.Window <> nil) then
|
||||||
|
FXDisplay := GDK_WINDOW_XDISPLAY(PGtkWidget(TempParent)^.Window);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// GlobalCEFApp.XDisplay can only be called in the CEF UI thread.
|
||||||
|
if (FXDisplay = nil) and (GlobalCEFApp <> nil) then
|
||||||
|
FXDisplay := GlobalCEFApp.XDisplay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := FXDisplay;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TChromiumCore.GetHasValidMainFrame : boolean;
|
function TChromiumCore.GetHasValidMainFrame : boolean;
|
||||||
begin
|
begin
|
||||||
Result := Initialized and (Browser.MainFrame <> nil) and Browser.MainFrame.IsValid;
|
Result := Initialized and (Browser.MainFrame <> nil) and Browser.MainFrame.IsValid;
|
||||||
@ -4632,107 +4616,65 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.doUpdateSize(aLeft, aTop, aWidth, aHeight : integer);
|
{$IFDEF LINUX}
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
procedure TChromiumCore.UpdateBrowserSize(aLeft, aTop, aWidth, aHeight : integer);
|
||||||
|
{$IFDEF FPC}
|
||||||
var
|
var
|
||||||
TempHandle : TCefWindowHandle;
|
TempHandle : TCefWindowHandle;
|
||||||
TempChanges : TXWindowChanges;
|
TempChanges : TXWindowChanges;
|
||||||
TempXDisplay : PXDisplay;
|
TempXDisplay : PXDisplay;
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
if (GlobalCEFApp <> nil) then
|
TempHandle := WindowHandle;
|
||||||
|
|
||||||
|
if ValidCefWindowHandle(TempHandle) then
|
||||||
begin
|
begin
|
||||||
TempXDisplay := GlobalCEFApp.XDisplay;
|
TempXDisplay := XDisplay;
|
||||||
|
|
||||||
if (TempXDisplay <> nil) then
|
if (TempXDisplay <> nil) then
|
||||||
begin
|
begin
|
||||||
TempHandle := WindowHandle;
|
TempChanges.x := aLeft;
|
||||||
|
TempChanges.y := aTop;
|
||||||
|
TempChanges.width := aWidth;
|
||||||
|
TempChanges.height := aHeight;
|
||||||
|
|
||||||
if ValidCefWindowHandle(TempHandle) then
|
XConfigureWindow(TempXDisplay, TempHandle, CWX or CWY or CWHeight or CWWidth, @TempChanges);
|
||||||
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;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChromiumCore.doSendCaptureLostEvent;
|
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
|
||||||
var
|
|
||||||
TempXDisplay : PXDisplay;
|
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
begin
|
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
|
||||||
if (GlobalCEFApp <> nil) then
|
|
||||||
begin
|
|
||||||
TempXDisplay := GlobalCEFApp.XDisplay;
|
|
||||||
|
|
||||||
if (TempXDisplay <> nil) then
|
|
||||||
XSetInputFocus(TempXDisplay, X.None, RevertToNone, CurrentTime);
|
|
||||||
end;
|
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
|
|
||||||
if Initialized then
|
|
||||||
Browser.Host.SendCaptureLostEvent;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.doUpdateXWindowVisibility(aVisible : boolean);
|
procedure TChromiumCore.UpdateXWindowVisibility(aVisible : boolean);
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
var
|
var
|
||||||
TempXDisplay : PXDisplay;
|
TempXDisplay : PXDisplay;
|
||||||
TempHandle : TCefWindowHandle;
|
TempHandle : TCefWindowHandle;
|
||||||
TempState : TAtom;
|
TempState : TAtom;
|
||||||
TempHidden : TAtom;
|
TempHidden : TAtom;
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$IFDEF LINUX}{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
if (GlobalCEFApp <> nil) then
|
TempHandle := WindowHandle;
|
||||||
|
|
||||||
|
if ValidCefWindowHandle(TempHandle) then
|
||||||
begin
|
begin
|
||||||
TempXDisplay := GlobalCEFApp.XDisplay;
|
TempXDisplay := XDisplay;
|
||||||
|
|
||||||
if (TempXDisplay <> nil) then
|
if (TempXDisplay <> nil) then
|
||||||
begin
|
begin
|
||||||
TempHandle := WindowHandle;
|
TempState := XInternAtom(TempXDisplay, '_NET_WM_STATE', False);
|
||||||
|
|
||||||
if ValidCefWindowHandle(TempHandle) then
|
if aVisible then
|
||||||
|
XChangeProperty(TempXDisplay, TempHandle, TempState, XA_ATOM, 32, PropModeReplace, nil, 0)
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
TempState := XInternAtom(TempXDisplay, '_NET_WM_STATE', False);
|
TempHidden := XInternAtom(TempXDisplay, '_NET_WM_STATE_HIDDEN', False);
|
||||||
|
XChangeProperty(TempXDisplay, TempHandle, TempState, XA_ATOM, 32, PropModeReplace, @TempHidden, 1);
|
||||||
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;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}{$ENDIF}
|
{$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;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
@ -6424,11 +6366,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.SendCaptureLostEvent;
|
procedure TChromiumCore.SendCaptureLostEvent;
|
||||||
|
{$IFDEF LINUX}{$IFDEF FPC}
|
||||||
|
var
|
||||||
|
TempXDisplay : PXDisplay;
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if CefCurrentlyOn(TID_UI) then
|
if not(Initialized) then exit;
|
||||||
doSendCaptureLostEvent
|
|
||||||
else
|
{$IFDEF LINUX}{$IFDEF FPC}
|
||||||
ExecuteSendCaptureLostEventTask;
|
TempXDisplay := XDisplay;
|
||||||
|
|
||||||
|
if (TempXDisplay <> nil) then
|
||||||
|
XSetInputFocus(TempXDisplay, X.None, RevertToNone, CurrentTime);
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
|
||||||
|
Browser.Host.SendCaptureLostEvent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.SetFocus(focus: Boolean);
|
procedure TChromiumCore.SetFocus(focus: Boolean);
|
||||||
|
@ -485,9 +485,6 @@ type
|
|||||||
procedure doMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
procedure doMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
||||||
procedure doOnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring);
|
procedure doOnMediaSinkDeviceInfo(const ip_address: ustring; port: integer; const model_name: ustring);
|
||||||
procedure doBrowserNavigation(aTask : TCefBrowserNavigation);
|
procedure doBrowserNavigation(aTask : TCefBrowserNavigation);
|
||||||
procedure doUpdateSize(aLeft, aTop, aWidth, aHeight : integer);
|
|
||||||
procedure doSendCaptureLostEvent;
|
|
||||||
procedure doUpdateXWindowVisibility(aVisible : boolean);
|
|
||||||
function MustCreateAudioHandler : boolean;
|
function MustCreateAudioHandler : boolean;
|
||||||
function MustCreateLoadHandler : boolean;
|
function MustCreateLoadHandler : boolean;
|
||||||
function MustCreateFocusHandler : boolean;
|
function MustCreateFocusHandler : boolean;
|
||||||
|
@ -219,45 +219,6 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
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
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -720,103 +681,4 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
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.
|
end.
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 250,
|
"InternalVersion" : 251,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "88.2.1.0"
|
"Version" : "88.2.4.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpdatePackageData" : {
|
"UpdatePackageData" : {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user