1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-03 10:15:38 +02:00

FPC compatibility with all missing MSWINDOWS features (Drag&Drop, OnBrowserCompMsg/OnWidgetCompMsg/OnRenderCompMsg) that VCL/FMX already had

Some Linux support (compiles and can load the libcef.so but still crashes when calling CreateBrowser)
This commit is contained in:
Andreas Hausladen 2019-11-10 18:23:39 +01:00
parent d897a1d815
commit eb0d04f1b5
25 changed files with 525 additions and 345 deletions

View File

@ -198,6 +198,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
Top = 0 Top = 0
Width = 25 Width = 25
Caption = '►' Caption = '►'
Default = True
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -17 Font.Height = -17
@ -244,6 +245,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
OnNavigationVisitorResultAvailable = Chromium1NavigationVisitorResultAvailable OnNavigationVisitorResultAvailable = Chromium1NavigationVisitorResultAvailable
OnDownloadImageFinished = Chromium1DownloadImageFinished OnDownloadImageFinished = Chromium1DownloadImageFinished
OnCookiesFlushed = Chromium1CookiesFlushed OnCookiesFlushed = Chromium1CookiesFlushed
OnRenderCompMsg = Chromium1RenderCompMsg
OnLoadEnd = Chromium1LoadEnd OnLoadEnd = Chromium1LoadEnd
OnLoadError = Chromium1LoadError OnLoadError = Chromium1LoadError
OnLoadingStateChange = Chromium1LoadingStateChange OnLoadingStateChange = Chromium1LoadingStateChange

View File

@ -22,7 +22,7 @@ package CEF4Delphi;
{$VARSTRINGCHECKS ON} {$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF} {$WRITEABLECONST OFF}
{$MINENUMSIZE 1} {$MINENUMSIZE 1}
{$IMAGEBASE $400000} {$IMAGEBASE $54C00000}
{$DEFINE DEBUG} {$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING} {$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'CEF4Delphi'} {$DESCRIPTION 'CEF4Delphi'}
@ -102,7 +102,7 @@ contains
uCEFZipReader in '..\source\uCEFZipReader.pas', uCEFZipReader in '..\source\uCEFZipReader.pas',
uCEFResponse in '..\source\uCEFResponse.pas', uCEFResponse in '..\source\uCEFResponse.pas',
uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas', uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas',
uCEFV8Exception in '..\source\uCEFV8Exception.pas', uCEFv8Exception in '..\source\uCEFv8Exception.pas',
uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas', uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas',
uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas', uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas',
uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas', uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas',
@ -131,6 +131,7 @@ contains
uCEFImage in '..\source\uCEFImage.pas', uCEFImage in '..\source\uCEFImage.pas',
uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas', uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas',
uCEFWindowParent in '..\source\uCEFWindowParent.pas', uCEFWindowParent in '..\source\uCEFWindowParent.pas',
uCEFChromiumCore in '..\source\uCEFChromiumCore.pas',
uCEFChromium in '..\source\uCEFChromium.pas', uCEFChromium in '..\source\uCEFChromium.pas',
uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas', uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas',
uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas', uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas',

View File

@ -196,7 +196,7 @@
<DCCReference Include="..\source\uCEFZipReader.pas"/> <DCCReference Include="..\source\uCEFZipReader.pas"/>
<DCCReference Include="..\source\uCEFResponse.pas"/> <DCCReference Include="..\source\uCEFResponse.pas"/>
<DCCReference Include="..\source\uCEFCookieVisitor.pas"/> <DCCReference Include="..\source\uCEFCookieVisitor.pas"/>
<DCCReference Include="..\source\uCEFV8Exception.pas"/> <DCCReference Include="..\source\uCEFv8Exception.pas"/>
<DCCReference Include="..\source\uCEFResourceBundleHandler.pas"/> <DCCReference Include="..\source\uCEFResourceBundleHandler.pas"/>
<DCCReference Include="..\source\uCEFSetCookieCallback.pas"/> <DCCReference Include="..\source\uCEFSetCookieCallback.pas"/>
<DCCReference Include="..\source\uCEFDeleteCookiesCallback.pas"/> <DCCReference Include="..\source\uCEFDeleteCookiesCallback.pas"/>
@ -225,6 +225,7 @@
<DCCReference Include="..\source\uCEFImage.pas"/> <DCCReference Include="..\source\uCEFImage.pas"/>
<DCCReference Include="..\source\uCEFMenuModelDelegate.pas"/> <DCCReference Include="..\source\uCEFMenuModelDelegate.pas"/>
<DCCReference Include="..\source\uCEFWindowParent.pas"/> <DCCReference Include="..\source\uCEFWindowParent.pas"/>
<DCCReference Include="..\source\uCEFChromiumCore.pas"/>
<DCCReference Include="..\source\uCEFChromium.pas"/> <DCCReference Include="..\source\uCEFChromium.pas"/>
<DCCReference Include="..\source\uCEFChromiumEvents.pas"/> <DCCReference Include="..\source\uCEFChromiumEvents.pas"/>
<DCCReference Include="..\source\uCEFChromiumOptions.pas"/> <DCCReference Include="..\source\uCEFChromiumOptions.pas"/>

View File

@ -30,7 +30,7 @@
-W+ -W+
-M -M
-$M16384,1048576 -$M16384,1048576
-K$00400000 -K$54C00000
-N"dcu\" -N"dcu\"
-LE"c:\program files\borland\delphi7\Projects\Bpl" -LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl" -LN"c:\program files\borland\delphi7\Projects\Bpl"

View File

@ -21,7 +21,7 @@ package CEF4Delphi_D7;
{$VARSTRINGCHECKS ON} {$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF} {$WRITEABLECONST OFF}
{$MINENUMSIZE 1} {$MINENUMSIZE 1}
{$IMAGEBASE $400000} {$IMAGEBASE $54C00000}
{$DESCRIPTION 'CEF4Delphi'} {$DESCRIPTION 'CEF4Delphi'}
{$IMPLICITBUILD OFF} {$IMPLICITBUILD OFF}
{$DEFINE DEBUG} {$DEFINE DEBUG}
@ -100,7 +100,7 @@ contains
uCEFZipReader in '..\source\uCEFZipReader.pas', uCEFZipReader in '..\source\uCEFZipReader.pas',
uCEFResponse in '..\source\uCEFResponse.pas', uCEFResponse in '..\source\uCEFResponse.pas',
uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas', uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas',
uCEFV8Exception in '..\source\uCEFV8Exception.pas', uCEFv8Exception in '..\source\uCEFv8Exception.pas',
uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas', uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas',
uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas', uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas',
uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas', uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas',
@ -130,6 +130,7 @@ contains
uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas', uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas',
uCEFWindowParent in '..\source\uCEFWindowParent.pas', uCEFWindowParent in '..\source\uCEFWindowParent.pas',
uCEFChromium in '..\source\uCEFChromium.pas', uCEFChromium in '..\source\uCEFChromium.pas',
uCEFChromiumCore in '..\source\uCEFChromiumCore.pas',
uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas', uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas',
uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas', uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas',
uCEFChromiumFontOptions in '..\source\uCEFChromiumFontOptions.pas', uCEFChromiumFontOptions in '..\source\uCEFChromiumFontOptions.pas',

View File

@ -22,7 +22,7 @@ package CEF4Delphi_FMX;
{$VARSTRINGCHECKS ON} {$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF} {$WRITEABLECONST OFF}
{$MINENUMSIZE 1} {$MINENUMSIZE 1}
{$IMAGEBASE $400000} {$IMAGEBASE $54C00000}
{$DEFINE $(FrameworkType)} {$DEFINE $(FrameworkType)}
{$ENDIF IMPLICITBUILDING} {$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'CEF4Delphi'} {$DESCRIPTION 'CEF4Delphi'}
@ -103,7 +103,7 @@ contains
uCEFZipReader in '..\source\uCEFZipReader.pas', uCEFZipReader in '..\source\uCEFZipReader.pas',
uCEFResponse in '..\source\uCEFResponse.pas', uCEFResponse in '..\source\uCEFResponse.pas',
uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas', uCEFCookieVisitor in '..\source\uCEFCookieVisitor.pas',
uCEFV8Exception in '..\source\uCEFV8Exception.pas', uCEFv8Exception in '..\source\uCEFv8Exception.pas',
uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas', uCEFResourceBundleHandler in '..\source\uCEFResourceBundleHandler.pas',
uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas', uCEFSetCookieCallback in '..\source\uCEFSetCookieCallback.pas',
uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas', uCEFDeleteCookiesCallback in '..\source\uCEFDeleteCookiesCallback.pas',
@ -132,6 +132,7 @@ contains
uCEFImage in '..\source\uCEFImage.pas', uCEFImage in '..\source\uCEFImage.pas',
uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas', uCEFMenuModelDelegate in '..\source\uCEFMenuModelDelegate.pas',
uCEFWindowParent in '..\source\uCEFWindowParent.pas', uCEFWindowParent in '..\source\uCEFWindowParent.pas',
uCEFChromiumCore in '..\source\uCEFChromiumCore.pas',
uCEFChromium in '..\source\uCEFChromium.pas', uCEFChromium in '..\source\uCEFChromium.pas',
uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas', uCEFChromiumEvents in '..\source\uCEFChromiumEvents.pas',
uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas', uCEFChromiumOptions in '..\source\uCEFChromiumOptions.pas',

View File

@ -218,7 +218,7 @@
<DCCReference Include="..\source\uCEFZipReader.pas"/> <DCCReference Include="..\source\uCEFZipReader.pas"/>
<DCCReference Include="..\source\uCEFResponse.pas"/> <DCCReference Include="..\source\uCEFResponse.pas"/>
<DCCReference Include="..\source\uCEFCookieVisitor.pas"/> <DCCReference Include="..\source\uCEFCookieVisitor.pas"/>
<DCCReference Include="..\source\uCEFV8Exception.pas"/> <DCCReference Include="..\source\uCEFv8Exception.pas"/>
<DCCReference Include="..\source\uCEFResourceBundleHandler.pas"/> <DCCReference Include="..\source\uCEFResourceBundleHandler.pas"/>
<DCCReference Include="..\source\uCEFSetCookieCallback.pas"/> <DCCReference Include="..\source\uCEFSetCookieCallback.pas"/>
<DCCReference Include="..\source\uCEFDeleteCookiesCallback.pas"/> <DCCReference Include="..\source\uCEFDeleteCookiesCallback.pas"/>
@ -247,6 +247,7 @@
<DCCReference Include="..\source\uCEFImage.pas"/> <DCCReference Include="..\source\uCEFImage.pas"/>
<DCCReference Include="..\source\uCEFMenuModelDelegate.pas"/> <DCCReference Include="..\source\uCEFMenuModelDelegate.pas"/>
<DCCReference Include="..\source\uCEFWindowParent.pas"/> <DCCReference Include="..\source\uCEFWindowParent.pas"/>
<DCCReference Include="..\source\uCEFChromiumCore.pas"/>
<DCCReference Include="..\source\uCEFChromium.pas"/> <DCCReference Include="..\source\uCEFChromium.pas"/>
<DCCReference Include="..\source\uCEFChromiumEvents.pas"/> <DCCReference Include="..\source\uCEFChromiumEvents.pas"/>
<DCCReference Include="..\source\uCEFChromiumOptions.pas"/> <DCCReference Include="..\source\uCEFChromiumOptions.pas"/>

View File

@ -22,7 +22,7 @@
<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="78" Minor="3" Release="1"/> <Version Major="78" Minor="3" Release="1"/>
<Files Count="145"> <Files Count="146">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
<UnitName Value="uCEFAccessibilityHandler"/> <UnitName Value="uCEFAccessibilityHandler"/>
@ -433,8 +433,8 @@
<UnitName Value="uCEFv8Context"/> <UnitName Value="uCEFv8Context"/>
</Item102> </Item102>
<Item103> <Item103>
<Filename Value="..\source\uCEFV8Exception.pas"/> <Filename Value="..\source\uCEFv8Exception.pas"/>
<UnitName Value="uCEFV8Exception"/> <UnitName Value="uCEFv8Exception"/>
</Item103> </Item103>
<Item104> <Item104>
<Filename Value="..\source\uCEFv8Handler.pas"/> <Filename Value="..\source\uCEFv8Handler.pas"/>
@ -511,107 +511,111 @@
<UnitName Value="uCEFZipReader"/> <UnitName Value="uCEFZipReader"/>
</Item121> </Item121>
<Item122> <Item122>
<Filename Value="..\source\uCEFChromiumCore.pas"/>
<UnitName Value="uCEFChromiumCore"/>
</Item122>
<Item123>
<Filename Value="..\source\uCEFChromium.pas"/> <Filename Value="..\source\uCEFChromium.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFChromium"/> <UnitName Value="uCEFChromium"/>
</Item122> </Item123>
<Item123> <Item124>
<Filename Value="..\source\uCEFBufferPanel.pas"/> <Filename Value="..\source\uCEFBufferPanel.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFBufferPanel"/> <UnitName Value="uCEFBufferPanel"/>
</Item123>
<Item124>
<Filename Value="..\source\uCEFServer.pas"/>
<UnitName Value="uCEFServer"/>
</Item124> </Item124>
<Item125> <Item125>
<Filename Value="..\source\uCEFServer.pas"/>
<UnitName Value="uCEFServer"/>
</Item125>
<Item126>
<Filename Value="..\source\uCEFServerComponent.pas"/> <Filename Value="..\source\uCEFServerComponent.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFServerComponent"/> <UnitName Value="uCEFServerComponent"/>
</Item125>
<Item126>
<Filename Value="..\source\uCEFServerEvents.pas"/>
<UnitName Value="uCEFServerEvents"/>
</Item126> </Item126>
<Item127> <Item127>
<Filename Value="..\source\uCEFServerHandler.pas"/> <Filename Value="..\source\uCEFServerEvents.pas"/>
<UnitName Value="uCEFServerHandler"/> <UnitName Value="uCEFServerEvents"/>
</Item127> </Item127>
<Item128> <Item128>
<Filename Value="..\source\res\tbufferpanel.lrs"/> <Filename Value="..\source\uCEFServerHandler.pas"/>
<Type Value="LRS"/> <UnitName Value="uCEFServerHandler"/>
</Item128> </Item128>
<Item129> <Item129>
<Filename Value="..\source\res\tcefservercomponent.lrs"/> <Filename Value="..\source\res\tbufferpanel.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item129> </Item129>
<Item130> <Item130>
<Filename Value="..\source\res\tcefwindowparent.lrs"/> <Filename Value="..\source\res\tcefservercomponent.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item130> </Item130>
<Item131> <Item131>
<Filename Value="..\source\res\tcefworkscheduler.lrs"/> <Filename Value="..\source\res\tcefwindowparent.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item131> </Item131>
<Item132> <Item132>
<Filename Value="..\source\res\tchromium.lrs"/> <Filename Value="..\source\res\tcefworkscheduler.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item132> </Item132>
<Item133> <Item133>
<Filename Value="..\source\res\tchromiumwindow.lrs"/> <Filename Value="..\source\res\tchromium.lrs"/>
<Type Value="LRS"/> <Type Value="LRS"/>
</Item133> </Item133>
<Item134> <Item134>
<Filename Value="..\source\uCEFWinControl.pas"/> <Filename Value="..\source\res\tchromiumwindow.lrs"/>
<UnitName Value="uCEFWinControl"/> <Type Value="LRS"/>
</Item134> </Item134>
<Item135> <Item135>
<Filename Value="..\source\uCEFWinControl.pas"/>
<UnitName Value="uCEFWinControl"/>
</Item135>
<Item136>
<Filename Value="..\source\uCEFLinkedWindowParent.pas"/> <Filename Value="..\source\uCEFLinkedWindowParent.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFLinkedWindowParent"/> <UnitName Value="uCEFLinkedWindowParent"/>
</Item135>
<Item136>
<Filename Value="..\source\uCEFUrlRequestClientEvents.pas"/>
<UnitName Value="uCEFUrlRequestClientEvents"/>
</Item136> </Item136>
<Item137> <Item137>
<Filename Value="..\source\uCEFUrlRequestClientEvents.pas"/>
<UnitName Value="uCEFUrlRequestClientEvents"/>
</Item137>
<Item138>
<Filename Value="..\source\uCEFUrlRequestClientComponent.pas"/> <Filename Value="..\source\uCEFUrlRequestClientComponent.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFUrlRequestClientComponent"/> <UnitName Value="uCEFUrlRequestClientComponent"/>
</Item137>
<Item138>
<Filename Value="..\source\uCEFOSRIMEHandler.pas"/>
<UnitName Value="uCEFOSRIMEHandler"/>
</Item138> </Item138>
<Item139> <Item139>
<Filename Value="..\source\uCEFCookieAccessFilter.pas"/> <Filename Value="..\source\uCEFOSRIMEHandler.pas"/>
<UnitName Value="uCEFCookieAccessFilter"/> <UnitName Value="uCEFOSRIMEHandler"/>
</Item139> </Item139>
<Item140> <Item140>
<Filename Value="..\source\uCEFResourceReadCallback.pas"/> <Filename Value="..\source\uCEFCookieAccessFilter.pas"/>
<UnitName Value="uCEFResourceReadCallback"/> <UnitName Value="uCEFCookieAccessFilter"/>
</Item140> </Item140>
<Item141> <Item141>
<Filename Value="..\source\uCEFResourceRequestHandler.pas"/> <Filename Value="..\source\uCEFResourceReadCallback.pas"/>
<UnitName Value="uCEFResourceRequestHandler"/> <UnitName Value="uCEFResourceReadCallback"/>
</Item141> </Item141>
<Item142> <Item142>
<Filename Value="..\source\uCEFResourceSkipCallback.pas"/> <Filename Value="..\source\uCEFResourceRequestHandler.pas"/>
<UnitName Value="uCEFResourceSkipCallback"/> <UnitName Value="uCEFResourceRequestHandler"/>
</Item142> </Item142>
<Item143> <Item143>
<Filename Value="..\source\res\tcefsentinel.lrs"/> <Filename Value="..\source\uCEFResourceSkipCallback.pas"/>
<Type Value="LRS"/> <UnitName Value="uCEFResourceSkipCallback"/>
</Item143> </Item143>
<Item144> <Item144>
<Filename Value="..\source\res\tcefsentinel.lrs"/>
<Type Value="LRS"/>
</Item144>
<Item145>
<Filename Value="..\source\uCEFSentinel.pas"/> <Filename Value="..\source\uCEFSentinel.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFSentinel"/> <UnitName Value="uCEFSentinel"/>
</Item144> </Item145>
<Item145> <Item146>
<Filename Value="..\source\uCEFApplicationCore.pas"/> <Filename Value="..\source\uCEFApplicationCore.pas"/>
<UnitName Value="uCEFApplicationCore"/> <UnitName Value="uCEFApplicationCore"/>
</Item145> </Item146>
</Files> </Files>
<RequiredPkgs Count="3"> <RequiredPkgs Count="3">
<Item1> <Item1>

View File

@ -39,17 +39,18 @@ uses
uCEFStringMap, uCEFStringMultimap, uCEFStringVisitor, uCEFTask, uCEFStringMap, uCEFStringMultimap, uCEFStringVisitor, uCEFTask,
uCEFTaskRunner, uCEFThread, uCEFTypes, uCEFUrlRequest, uCEFUrlrequestClient, uCEFTaskRunner, uCEFThread, uCEFTypes, uCEFUrlRequest, uCEFUrlrequestClient,
uCEFv8Accessor, uCEFv8ArrayBufferReleaseCallback, uCEFv8Context, uCEFv8Accessor, uCEFv8ArrayBufferReleaseCallback, uCEFv8Context,
uCEFV8Exception, uCEFv8Handler, uCEFv8Interceptor, uCEFv8StackFrame, uCEFv8Exception, uCEFv8Handler, uCEFv8Interceptor, uCEFv8StackFrame,
uCEFv8StackTrace, uCEFv8Value, uCEFValue, uCEFWaitableEvent, uCEFv8StackTrace, uCEFv8Value, uCEFValue, uCEFWaitableEvent,
uCEFWebPluginInfo, uCEFWebPluginInfoVisitor, uCEFWebPluginUnstableCallback, uCEFWebPluginInfo, uCEFWebPluginInfoVisitor, uCEFWebPluginUnstableCallback,
uCEFWindowParent, uCEFWorkScheduler, uCEFWorkSchedulerThread, uCEFWindowParent, uCEFWorkScheduler, uCEFWorkSchedulerThread,
uCEFWriteHandler, uCEFX509Certificate, uCEFX509CertPrincipal, uCEFXmlReader, uCEFWriteHandler, uCEFX509Certificate, uCEFX509CertPrincipal, uCEFXmlReader,
uCEFZipReader, uCEFChromium, uCEFBufferPanel, uCEFServer, uCEFZipReader, uCEFChromiumCore, uCEFChromium, uCEFBufferPanel, uCEFServer,
uCEFServerComponent, uCEFServerEvents, uCEFServerHandler, uCEFWinControl, uCEFServerComponent, uCEFServerEvents, uCEFServerHandler, uCEFWinControl,
uCEFLinkedWindowParent, uCEFUrlRequestClientEvents, uCEFLinkedWindowParent, uCEFUrlRequestClientEvents,
uCEFUrlRequestClientComponent, uCEFOSRIMEHandler, uCEFCookieAccessFilter, uCEFUrlRequestClientComponent, uCEFOSRIMEHandler, uCEFCookieAccessFilter,
uCEFResourceReadCallback, uCEFResourceRequestHandler, uCEFResourceReadCallback, uCEFResourceRequestHandler,
uCEFResourceSkipCallback, uCEFSentinel, LazarusPackageIntf; uCEFResourceSkipCallback, uCEFSentinel, uCEFApplicationCore,
LazarusPackageIntf;
implementation implementation

View File

@ -884,12 +884,11 @@ function TCefApplicationCore.CheckCEFLibrary : boolean;
var var
TempString, TempOldDir : string; TempString, TempOldDir : string;
TempMissingFrm, TempMissingRsc, TempMissingLoc, TempMissingSubProc : boolean; TempMissingFrm, TempMissingRsc, TempMissingLoc, TempMissingSubProc : boolean;
{$IFDEF MSWINDOWS}
TempMachine : integer; TempMachine : integer;
TempVersionInfo : TFileVersionInfo; TempVersionInfo : TFileVersionInfo;
{$ENDIF}
begin begin
{$IFNDEF MSWINDOWS}
Result := True;
{$ELSE}
Result := False; Result := False;
if not(FCheckCEFFiles) or (FProcessType <> ptBrowser) then if not(FCheckCEFFiles) or (FProcessType <> ptBrowser) then
@ -901,7 +900,7 @@ begin
TempOldDir := GetCurrentDir; TempOldDir := GetCurrentDir;
chdir(GetModulePath); chdir(GetModulePath);
end; end;
try
TempMissingSubProc := not(CheckSubprocessPath(FBrowserSubprocessPath, FMissingLibFiles)); TempMissingSubProc := not(CheckSubprocessPath(FBrowserSubprocessPath, FMissingLibFiles));
TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles)); TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles));
TempMissingRsc := not(CheckResources(FResourcesDirPath, FMissingLibFiles, FCheckDevToolsResources, not(FDisableExtensions))); TempMissingRsc := not(CheckResources(FResourcesDirPath, FMissingLibFiles, FCheckDevToolsResources, not(FDisableExtensions)));
@ -920,6 +919,7 @@ begin
ShowErrorMessageDlg(TempString); ShowErrorMessageDlg(TempString);
end end
else else
{$IFDEF MSWINDOWS}
if CheckDLLVersion(LibCefPath, if CheckDLLVersion(LibCefPath,
CEF_SUPPORTED_VERSION_MAJOR, CEF_SUPPORTED_VERSION_MAJOR,
CEF_SUPPORTED_VERSION_MINOR, CEF_SUPPORTED_VERSION_MINOR,
@ -984,10 +984,15 @@ begin
ShowErrorMessageDlg(TempString); ShowErrorMessageDlg(TempString);
end; end;
{$ELSE}
if FSetCurrentDir then chdir(TempOldDir); begin
Result := True;
end; end;
{$ENDIF} {$ENDIF}
finally
if FSetCurrentDir then chdir(TempOldDir);
end;
end;
end; end;
function TCefApplicationCore.StartMainProcess : boolean; function TCefApplicationCore.StartMainProcess : boolean;
@ -1269,7 +1274,11 @@ begin
{$IFDEF DELPHI14_UP} {$IFDEF DELPHI14_UP}
TempThread.Start; TempThread.Start;
{$ELSE} {$ELSE}
{$IFNDEF FPC}
TempThread.Resume; TempThread.Resume;
{$ELSE}
TempThread.Start;
{$ENDIF}
{$ENDIF} {$ENDIF}
end end
else else
@ -1527,8 +1536,10 @@ procedure TCefApplicationCore.Internal_OnBeforeCommandLineProcessing(const proce
const commandLine : ICefCommandLine); const commandLine : ICefCommandLine);
var var
i : integer; i : integer;
{$IFDEF MSWINDOWS}
TempVersionInfo : TFileVersionInfo; TempVersionInfo : TFileVersionInfo;
TempFileName : string; TempFileName : string;
{$ENDIF}
begin begin
if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then
begin begin
@ -1867,11 +1878,7 @@ begin
ZeroMemory(@TempMemCtrs, SizeOf(TProcessMemoryCounters)); ZeroMemory(@TempMemCtrs, SizeOf(TProcessMemoryCounters));
TempMemCtrs.cb := SizeOf(TProcessMemoryCounters); TempMemCtrs.cb := SizeOf(TProcessMemoryCounters);
{$IFDEF FPC} if GetProcessMemoryInfo(TempProcHWND, {$IFNDEF FPC}@{$ENDIF}TempMemCtrs, TempMemCtrs.cb) then inc(Result, TempMemCtrs.WorkingSetSize);
if GetProcessMemoryInfo(TempProcHWND, TempMemCtrs, TempMemCtrs.cb) then inc(Result, TempMemCtrs.WorkingSetSize);
{$ELSE}
if GetProcessMemoryInfo(TempProcHWND, @TempMemCtrs, TempMemCtrs.cb) then inc(Result, TempMemCtrs.WorkingSetSize);
{$ENDIF}
CloseHandle(TempProcHWND); CloseHandle(TempProcHWND);
end; end;

View File

@ -68,7 +68,9 @@ type
function GetParentForm : TCustomForm; function GetParentForm : TCustomForm;
procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual; procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual;
public public
{$IFDEF MSWINDOWS}
procedure InitializeDragAndDrop(const aDropTargetCtrl : TWinControl); procedure InitializeDragAndDrop(const aDropTargetCtrl : TWinControl);
{$ENDIF MSWINDOWS}
procedure ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl = nil); procedure ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl = nil);
procedure CloseDevTools(const aDevTools : TWinControl = nil); procedure CloseDevTools(const aDevTools : TWinControl = nil);
@ -126,11 +128,13 @@ uses
{ TChromium } { TChromium }
{$IFDEF MSWINDOWS}
procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl: TWinControl); procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl: TWinControl);
begin begin
if aDropTargetCtrl <> nil then if aDropTargetCtrl <> nil then
inherited InitializeDragAndDrop(aDropTargetCtrl.Handle); inherited InitializeDragAndDrop(aDropTargetCtrl.Handle);
end; end;
{$ENDIF MSWINDOWS}
procedure TChromium.InitializeDevToolsWindowInfo(aDevTools: TWinControl); procedure TChromium.InitializeDevToolsWindowInfo(aDevTools: TWinControl);
begin begin

View File

@ -50,9 +50,9 @@ interface
uses uses
{$IFDEF DELPHI16_UP} {$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX,{$ENDIF} System.Classes, {$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX, WinApi.CommCtrl,{$ENDIF} System.Classes,
{$ELSE} {$ELSE}
{$IFDEF MSWINDOWS}Windows, ActiveX,{$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,
{$ELSE} {$ELSE}
@ -61,7 +61,7 @@ uses
{$ENDIF} {$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFMiscFunctions, uCEFClient, uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFMiscFunctions, uCEFClient,
uCEFConstants, uCEFTask, uCEFDomVisitor, uCEFChromiumEvents, uCEFConstants, uCEFTask, uCEFDomVisitor, uCEFChromiumEvents,
{$IFDEF MSWINDOWS}{$IFNDEF FPC}uCEFDragAndDropMgr,{$ENDIF}{$ENDIF} {$IFDEF MSWINDOWS}uCEFDragAndDropMgr,{$ENDIF}
uCEFChromiumOptions, uCEFChromiumFontOptions, uCEFPDFPrintOptions; uCEFChromiumOptions, uCEFChromiumFontOptions, uCEFPDFPrintOptions;
type type
@ -116,9 +116,7 @@ type
FDevBrowserSettings : TCefBrowserSettings; FDevBrowserSettings : TCefBrowserSettings;
FDragOperations : TCefDragOperations; FDragOperations : TCefDragOperations;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
FDragDropManager : TCEFDragAndDropMgr; FDragDropManager : TCEFDragAndDropMgr;
{$ENDIF}
FDropTargetWnd : HWND; FDropTargetWnd : HWND;
{$ENDIF} {$ENDIF}
FDragAndDropInitialized : boolean; FDragAndDropInitialized : boolean;
@ -127,7 +125,6 @@ type
FWebRTCNonProxiedUDP : TCefState; FWebRTCNonProxiedUDP : TCefState;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
FOldBrowserCompWndPrc : TFNWndProc; FOldBrowserCompWndPrc : TFNWndProc;
FOldWidgetCompWndPrc : TFNWndProc; FOldWidgetCompWndPrc : TFNWndProc;
FOldRenderCompWndPrc : TFNWndProc; FOldRenderCompWndPrc : TFNWndProc;
@ -135,7 +132,6 @@ type
FWidgetCompStub : Pointer; FWidgetCompStub : Pointer;
FRenderCompStub : Pointer; FRenderCompStub : Pointer;
{$ENDIF} {$ENDIF}
{$ENDIF}
FBrowserCompHWND : THandle; FBrowserCompHWND : THandle;
FWidgetCompHWND : THandle; FWidgetCompHWND : THandle;
FRenderCompHWND : THandle; FRenderCompHWND : THandle;
@ -266,12 +262,10 @@ type
FOnCookieVisitorDestroyed : TOnCookieVisitorDestroyed; FOnCookieVisitorDestroyed : TOnCookieVisitorDestroyed;
FOnCookieSet : TOnCookieSet; FOnCookieSet : TOnCookieSet;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
FOnBrowserCompMsg : TOnCompMsgEvent; FOnBrowserCompMsg : TOnCompMsgEvent;
FOnWidgetCompMsg : TOnCompMsgEvent; FOnWidgetCompMsg : TOnCompMsgEvent;
FOnRenderCompMsg : TOnCompMsgEvent; FOnRenderCompMsg : TOnCompMsgEvent;
{$ENDIF} {$ENDIF}
{$ENDIF}
function GetIsLoading : boolean; function GetIsLoading : boolean;
function GetMultithreadApp : boolean; function GetMultithreadApp : boolean;
@ -375,15 +369,15 @@ type
procedure DefaultInitializeDevToolsWindowInfo(aDevToolsWnd: TCefWindowHandle; const aClientRect: TRect; const aWindowName: ustring); procedure DefaultInitializeDevToolsWindowInfo(aDevToolsWnd: TCefWindowHandle; const aClientRect: TRect; const aWindowName: ustring);
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure WndProc(var aMessage: TMessage); procedure WndProc(var aMessage: TMessage);
{$IFNDEF FPC}
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
procedure FreeAndNilStub(var aStub : pointer); procedure FreeAndNilStub(var aStub : pointer);
function InstallCompWndProc(aWnd: THandle; aStub: Pointer): TFNWndProc;
procedure RestoreCompWndProc(var aOldWnd: THandle; aNewWnd: THandle; var aProc: TFNWndProc); procedure RestoreCompWndProc(var aOldWnd: THandle; aNewWnd: THandle; var aProc: TFNWndProc);
procedure CallOldCompWndProc(aProc: TFNWndProc; aWnd: THandle; var aMessage: TMessage);
procedure BrowserCompWndProc(var aMessage: TMessage); procedure BrowserCompWndProc(var aMessage: TMessage);
procedure WidgetCompWndProc(var aMessage: TMessage); procedure WidgetCompWndProc(var aMessage: TMessage);
procedure RenderCompWndProc(var aMessage: TMessage); procedure RenderCompWndProc(var aMessage: TMessage);
{$ENDIF} {$ENDIF}
{$ENDIF}
procedure DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
procedure DragDropManager_OnDragOver(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure DragDropManager_OnDragOver(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
@ -602,10 +596,7 @@ type
function FlushCookieStore(aFlushImmediately : boolean = True) : boolean; function FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
procedure ShowDevTools(const inspectElementAt: TPoint; aWindowInfo: PCefWindowInfo); procedure ShowDevTools(const inspectElementAt: TPoint; aWindowInfo: PCefWindowInfo);
{$IFDEF MSWINDOWS} procedure CloseDevTools(const aDevToolsWnd : TCefWindowHandle = 0);
procedure CloseDevTools(const aDevToolsWnd : THandle); overload;
{$ENDIF}
procedure CloseDevTools; overload;
procedure Find(aIdentifier : integer; const aSearchText : ustring; aForward, aMatchCase, aFindNext : Boolean); procedure Find(aIdentifier : integer; const aSearchText : ustring; aForward, aMatchCase, aFindNext : Boolean);
procedure StopFinding(aClearSelection : Boolean); procedure StopFinding(aClearSelection : Boolean);
@ -747,12 +738,10 @@ type
property OnCookieVisitorDestroyed : TOnCookieVisitorDestroyed read FOnCookieVisitorDestroyed write FOnCookieVisitorDestroyed; property OnCookieVisitorDestroyed : TOnCookieVisitorDestroyed read FOnCookieVisitorDestroyed write FOnCookieVisitorDestroyed;
property OnCookieSet : TOnCookieSet read FOnCookieSet write FOnCookieSet; property OnCookieSet : TOnCookieSet read FOnCookieSet write FOnCookieSet;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg; property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg; property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
property OnRenderCompMsg : TOnCompMsgEvent read FOnRenderCompMsg write FOnRenderCompMsg; property OnRenderCompMsg : TOnCompMsgEvent read FOnRenderCompMsg write FOnRenderCompMsg;
{$ENDIF} {$ENDIF}
{$ENDIF}
// ICefClient // ICefClient
property OnProcessMessageReceived : TOnProcessMessageReceived read FOnProcessMessageReceived write FOnProcessMessageReceived; property OnProcessMessageReceived : TOnProcessMessageReceived read FOnProcessMessageReceived write FOnProcessMessageReceived;
@ -864,10 +853,6 @@ type
property OnGetResourceRequestHandler_ReqCtxHdlr : TOnGetResourceRequestHandler read FOnGetResourceRequestHandler_ReqCtxHdlr write FOnGetResourceRequestHandler_ReqCtxHdlr; property OnGetResourceRequestHandler_ReqCtxHdlr : TOnGetResourceRequestHandler read FOnGetResourceRequestHandler_ReqCtxHdlr write FOnGetResourceRequestHandler_ReqCtxHdlr;
end; end;
{$IFDEF FPC}
procedure Register;
{$ENDIF}
// ********************************************************* // *********************************************************
// ********************** ATTENTION ! ********************** // ********************** ATTENTION ! **********************
// ********************************************************* // *********************************************************
@ -905,7 +890,7 @@ uses
{$ENDIF} {$ENDIF}
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame, uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
uCEFApplicationCore, uCEFProcessMessage, uCEFRequestContext, uCEFApplicationCore, uCEFProcessMessage, uCEFRequestContext,
{$IFDEF MSWINDOWS}{$IFNDEF FPC}uCEFOLEDragAndDrop,{$ENDIF}{$ENDIF} {$IFDEF MSWINDOWS}uCEFOLEDragAndDrop,{$ENDIF}
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor, uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
uCEFListValue, uCEFNavigationEntryVisitor, uCEFDownloadImageCallBack, uCEFCookieManager, uCEFListValue, uCEFNavigationEntryVisitor, uCEFDownloadImageCallBack, uCEFCookieManager,
uCEFRequestContextHandler, uCEFCookieVisitor, uCEFSetCookieCallback, uCEFResourceRequestHandler; uCEFRequestContextHandler, uCEFCookieVisitor, uCEFSetCookieCallback, uCEFResourceRequestHandler;
@ -946,23 +931,21 @@ begin
FYouTubeRestrict := YOUTUBE_RESTRICT_OFF; FYouTubeRestrict := YOUTUBE_RESTRICT_OFF;
FPrintingEnabled := True; FPrintingEnabled := True;
{$IFNDEF FPC} {$IFDEF MSWINDOWS}
FOldBrowserCompWndPrc := nil; FOldBrowserCompWndPrc := nil;
FOldWidgetCompWndPrc := nil; FOldWidgetCompWndPrc := nil;
FOldRenderCompWndPrc := nil; FOldRenderCompWndPrc := nil;
FBrowserCompStub := nil; FBrowserCompStub := nil;
FWidgetCompStub := nil; FWidgetCompStub := nil;
FRenderCompStub := nil; FRenderCompStub := nil;
{$ENDIF} {$ENDIF MSWINDOWS}
FBrowserCompHWND := 0; FBrowserCompHWND := 0;
FWidgetCompHWND := 0; FWidgetCompHWND := 0;
FRenderCompHWND := 0; FRenderCompHWND := 0;
FDragOperations := DRAG_OPERATION_NONE; FDragOperations := DRAG_OPERATION_NONE;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
FDragDropManager := nil; FDragDropManager := nil;
{$ENDIF}
FDropTargetWnd := 0; FDropTargetWnd := 0;
{$ENDIF MSWINDOWS} {$ENDIF MSWINDOWS}
FDragAndDropInitialized := False; FDragAndDropInitialized := False;
@ -996,11 +979,9 @@ destructor TChromiumCore.Destroy;
begin begin
try try
try try
{$IFNDEF FPC}
if (FDragDropManager <> nil) then FreeAndNil(FDragDropManager);
{$ENDIF}
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if (FDragDropManager <> nil) then FreeAndNil(FDragDropManager);
if (FCompHandle <> 0) then if (FCompHandle <> 0) then
begin begin
DeallocateHWnd(FCompHandle); DeallocateHWnd(FCompHandle);
@ -1025,7 +1006,6 @@ end;
procedure TChromiumCore.BeforeDestruction; procedure TChromiumCore.BeforeDestruction;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
RestoreCompWndProc(FBrowserCompHWND, 0, FOldBrowserCompWndPrc); RestoreCompWndProc(FBrowserCompHWND, 0, FOldBrowserCompWndPrc);
FreeAndNilStub(FBrowserCompStub); FreeAndNilStub(FBrowserCompStub);
@ -1035,7 +1015,6 @@ begin
RestoreCompWndProc(FRenderCompHWND, 0, FOldRenderCompWndPrc); RestoreCompWndProc(FRenderCompHWND, 0, FOldRenderCompWndPrc);
FreeAndNilStub(FRenderCompStub); FreeAndNilStub(FRenderCompStub);
{$ENDIF} {$ENDIF}
{$ENDIF}
DestroyClientHandler; DestroyClientHandler;
DestroyReqContextHandler; DestroyReqContextHandler;
@ -1052,6 +1031,27 @@ end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC} {$IFNDEF FPC}
// Windows XP and newer (older Delphi version < XE don't have them and newer
// require a call to InitCommonControl what isn't necessary.
{type
SUBCLASSPROC = function(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM;
uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
TSubClassProc = SUBCLASSPROC;
function SetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): BOOL; stdcall;
external comctl32 name 'SetWindowSubclass';
//function GetWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR; var pdwRefData: DWORD_PTR): BOOL; stdcall;
// external comctl32 name 'GetWindowSubclass';
function RemoveWindowSubclass(hWnd: HWND; pfnSubclass: SUBCLASSPROC; uIdSubclass: UINT_PTR): BOOL; stdcall;
external comctl32 name 'RemoveWindowSubclass';
function DefSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
external comctl32 name 'DefSubclassProc';
// We stick with the original implementation because the WndProc stub is a lot
// faster than the WindowSubClass stub that uses the slow GetProp(hWnd). Which
// is extremly slow in Windows 10 1809 and newer.
}
procedure TChromiumCore.CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure TChromiumCore.CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
begin begin
if (aStub = nil) then aStub := MakeObjectInstance(aMethod); if (aStub = nil) then aStub := MakeObjectInstance(aMethod);
@ -1066,6 +1066,11 @@ begin
end; end;
end; end;
function TChromiumCore.InstallCompWndProc(aWnd: THandle; aStub: Pointer): TFNWndProc;
begin
Result := TFNWndProc(SetWindowLongPtr(aWnd, GWLP_WNDPROC, NativeInt(aStub)));
end;
procedure TChromiumCore.RestoreCompWndProc(var aOldWnd: THandle; aNewWnd: THandle; var aProc: TFNWndProc); procedure TChromiumCore.RestoreCompWndProc(var aOldWnd: THandle; aNewWnd: THandle; var aProc: TFNWndProc);
begin begin
if (aOldWnd <> 0) and (aOldWnd <> aNewWnd) and (aProc <> nil) then if (aOldWnd <> 0) and (aOldWnd <> aNewWnd) and (aProc <> nil) then
@ -1075,6 +1080,74 @@ begin
aOldWnd := 0; aOldWnd := 0;
end; end;
end; end;
procedure TChromiumCore.CallOldCompWndProc(aProc: TFNWndProc; aWnd: THandle; var aMessage: TMessage);
begin
if (aProc <> nil) and (aWnd <> 0) then
aMessage.Result := CallWindowProc(aProc, aWnd, aMessage.Msg, aMessage.wParam, aMessage.lParam);
end;
{$ELSE}
procedure TChromiumCore.CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
begin
if (aStub = nil) then
begin
GetMem(aStub, SizeOf(TWndMethod));
TWndMethod(aStub^) := aMethod;
end;
end;
procedure TChromiumCore.FreeAndNilStub(var aStub : pointer);
begin
if (aStub <> nil) then
begin
FreeMem(aStub);
aStub := nil;
end;
end;
function CompSubClassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM;
uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
var
m: TWndMethod;
Msg: TMessage;
begin
Msg.msg := uMsg;
Msg.wParam := wparam;
Msg.lParam := lParam;
Msg.Result := 0;
m := TWndMethod(Pointer(dwRefData)^);
m(Msg);
Result := Msg.Result;
end;
function TChromiumCore.InstallCompWndProc(aWnd: THandle; aStub: Pointer): TFNWndProc;
begin
Result := nil;
if (aWnd <> 0) and (aStub <> nil) then
begin
SetWindowSubclass(aWnd, @CompSubClassProc, 1, NativeInt(aStub));
Result := TFNWndProc(1); // IdSubClass
end;
end;
procedure TChromiumCore.RestoreCompWndProc(var aOldWnd: THandle; aNewWnd: THandle; var aProc: TFNWndProc);
begin
if (aOldWnd <> 0) and (aOldWnd <> aNewWnd) and (aProc <> nil) then
begin
RemoveWindowSubclass(aOldWnd, @CompSubClassProc, 1);
aProc := nil;
aOldWnd := 0;
end;
end;
procedure TChromiumCore.CallOldCompWndProc(aProc: TFNWndProc; aWnd: THandle; var aMessage: TMessage);
begin
if (aProc <> nil) and (aWnd <> 0) then
aMessage.Result := DefSubclassProc(aWnd, aMessage.Msg, aMessage.wParam, aMessage.lParam);
end;
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}
@ -1135,10 +1208,6 @@ begin
end; end;
procedure TChromiumCore.AfterConstruction; procedure TChromiumCore.AfterConstruction;
{$IFDEF FPC}
var
TempWndMethod : TWndMethod;
{$ENDIF}
begin begin
inherited AfterConstruction; inherited AfterConstruction;
@ -1146,12 +1215,7 @@ begin
if not(csDesigning in ComponentState) then if not(csDesigning in ComponentState) then
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFDEF FPC} FCompHandle := AllocateHWnd({$IFDEF FPC}@{$ENDIF}WndProc);
TempWndMethod := @WndProc;
FCompHandle := AllocateHWnd(TempWndMethod);
{$ELSE}
FCompHandle := AllocateHWnd(WndProc);
{$ENDIF}
{$ENDIF} {$ENDIF}
FOptions := TChromiumOptions.Create; FOptions := TChromiumOptions.Create;
FFontOptions := TChromiumFontOptions.Create; FFontOptions := TChromiumFontOptions.Create;
@ -1318,7 +1382,8 @@ begin
FOnCookiesVisited := nil; FOnCookiesVisited := nil;
FOnCookieVisitorDestroyed := nil; FOnCookieVisitorDestroyed := nil;
FOnCookieSet := nil; FOnCookieSet := nil;
{$IFNDEF FPC}
{$IFDEF MSWINDOWS}
FOnBrowserCompMsg := nil; FOnBrowserCompMsg := nil;
FOnWidgetCompMsg := nil; FOnWidgetCompMsg := nil;
FOnRenderCompMsg := nil; FOnRenderCompMsg := nil;
@ -1434,12 +1499,9 @@ end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure TChromiumCore.InitializeDragAndDrop(const aDropTargetWnd : HWND); procedure TChromiumCore.InitializeDragAndDrop(const aDropTargetWnd : HWND);
{$IFNDEF FPC}
var var
TempDropTarget : IDropTarget; TempDropTarget : IDropTarget;
{$ENDIF}
begin begin
{$IFNDEF FPC}
if FIsOSR and if FIsOSR and
not(FDragAndDropInitialized) and not(FDragAndDropInitialized) and
(FDragDropManager = nil) and (FDragDropManager = nil) and
@ -1448,10 +1510,10 @@ begin
FDropTargetWnd := aDropTargetWnd; FDropTargetWnd := aDropTargetWnd;
FDragDropManager := TCEFDragAndDropMgr.Create; FDragDropManager := TCEFDragAndDropMgr.Create;
FDragDropManager.OnDragEnter := DragDropManager_OnDragEnter; FDragDropManager.OnDragEnter := {$IFDEF FPC}@{$ENDIF}DragDropManager_OnDragEnter;
FDragDropManager.OnDragOver := DragDropManager_OnDragOver; FDragDropManager.OnDragOver := {$IFDEF FPC}@{$ENDIF}DragDropManager_OnDragOver;
FDragDropManager.OnDragLeave := DragDropManager_OnDragLeave; FDragDropManager.OnDragLeave := {$IFDEF FPC}@{$ENDIF}DragDropManager_OnDragLeave;
FDragDropManager.OnDrop := DragDropManager_OnDrop; FDragDropManager.OnDrop := {$IFDEF FPC}@{$ENDIF}DragDropManager_OnDrop;
TempDropTarget := TOLEDropTarget.Create(FDragDropManager); TempDropTarget := TOLEDropTarget.Create(FDragDropManager);
@ -1459,18 +1521,15 @@ begin
FDragAndDropInitialized := True; FDragAndDropInitialized := True;
end; end;
{$ENDIF}
end; end;
procedure TChromiumCore.ShutdownDragAndDrop; procedure TChromiumCore.ShutdownDragAndDrop;
begin begin
{$IFNDEF FPC}
if FDragAndDropInitialized and (FDropTargetWnd <> 0) then if FDragAndDropInitialized and (FDropTargetWnd <> 0) then
begin begin
RevokeDragDrop(FDropTargetWnd); RevokeDragDrop(FDropTargetWnd);
FDragAndDropInitialized := False; FDragAndDropInitialized := False;
end; end;
{$ENDIF}
end; end;
procedure TChromiumCore.ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent); procedure TChromiumCore.ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent);
@ -1486,9 +1545,11 @@ end;
{$ENDIF} {$ENDIF}
procedure TChromiumCore.DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure TChromiumCore.DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
{$IFDEF MSWINDOWS}
var var
TempMouseEvent : TCefMouseEvent; TempMouseEvent : TCefMouseEvent;
TempAllowedOps : TCefDragOperations; TempAllowedOps : TCefDragOperations;
{$ENDIF}
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
@ -1506,9 +1567,11 @@ begin
end; end;
procedure TChromiumCore.DragDropManager_OnDragOver(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure TChromiumCore.DragDropManager_OnDragOver(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
{$IFDEF MSWINDOWS}
var var
TempMouseEvent : TCefMouseEvent; TempMouseEvent : TCefMouseEvent;
TempAllowedOps : TCefDragOperations; TempAllowedOps : TCefDragOperations;
{$ENDIF}
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
@ -1530,9 +1593,11 @@ begin
end; end;
procedure TChromiumCore.DragDropManager_OnDrop(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure TChromiumCore.DragDropManager_OnDrop(Sender: TObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
{$IFDEF MSWINDOWS}
var var
TempMouseEvent : TCefMouseEvent; TempMouseEvent : TCefMouseEvent;
TempAllowedOps : TCefDragOperations; TempAllowedOps : TCefDragOperations;
{$ENDIF}
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
@ -2802,8 +2867,10 @@ begin
end; end;
function TChromiumCore.SetNewBrowserParent(aNewParentHwnd : HWND) : boolean; function TChromiumCore.SetNewBrowserParent(aNewParentHwnd : HWND) : boolean;
{$IFDEF MSWINDOWS}
var var
TempHandle : HWND; TempHandle : HWND;
{$ENDIF}
begin begin
Result := False; Result := False;
@ -3415,9 +3482,11 @@ begin
end; end;
function TChromiumCore.doSavePreferences : boolean; function TChromiumCore.doSavePreferences : boolean;
{$IFDEF MSWINDOWS}
var var
TempDict : ICefDictionaryValue; TempDict : ICefDictionaryValue;
TempPrefs : TStringList; TempPrefs : TStringList;
{$ENDIF}
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@ -3751,22 +3820,17 @@ begin
end; end;
end; end;
{$IFDEF MSWINDOWS} procedure TChromiumCore.CloseDevTools(const aDevToolsWnd : TCefWindowHandle);
procedure TChromiumCore.CloseDevTools(const aDevToolsWnd : THandle);
begin begin
if Initialized then if Initialized then
begin begin
{$IFDEF MSWINDOWS}
if (aDevToolsWnd <> 0) then if (aDevToolsWnd <> 0) then
SetParent(GetWindow(aDevToolsWnd, GW_CHILD), 0); SetParent(GetWindow(aDevToolsWnd, GW_CHILD), 0);
{$ENDIF}
CloseDevTools;
end;
end;
{$ENDIF MSWINDOWS}
procedure TChromiumCore.CloseDevTools;
begin
if Initialized and (FBrowser <> nil) then FBrowser.Host.CloseDevTools; if Initialized and (FBrowser <> nil) then FBrowser.Host.CloseDevTools;
end;
end; end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@ -3780,7 +3844,6 @@ begin
end; end;
end; end;
{$IFNDEF FPC}
procedure TChromiumCore.BrowserCompWndProc(var aMessage: TMessage); procedure TChromiumCore.BrowserCompWndProc(var aMessage: TMessage);
var var
TempHandled : boolean; TempHandled : boolean;
@ -3792,14 +3855,8 @@ begin
if assigned(FOnBrowserCompMsg) then if assigned(FOnBrowserCompMsg) then
FOnBrowserCompMsg(aMessage, TempHandled); FOnBrowserCompMsg(aMessage, TempHandled);
if not(TempHandled) and if not(TempHandled) then
(FOldBrowserCompWndPrc <> nil) and CallOldCompWndProc(FOldBrowserCompWndPrc, FBrowserCompHWND, aMessage);
(FBrowserCompHWND <> 0) then
aMessage.Result := CallWindowProc(FOldBrowserCompWndPrc,
FBrowserCompHWND,
aMessage.Msg,
aMessage.wParam,
aMessage.lParam);
finally finally
if aMessage.Msg = WM_DESTROY then if aMessage.Msg = WM_DESTROY then
RestoreCompWndProc(FBrowserCompHWND, 0, FOldBrowserCompWndPrc); RestoreCompWndProc(FBrowserCompHWND, 0, FOldBrowserCompWndPrc);
@ -3821,14 +3878,8 @@ begin
if assigned(FOnWidgetCompMsg) then if assigned(FOnWidgetCompMsg) then
FOnWidgetCompMsg(aMessage, TempHandled); FOnWidgetCompMsg(aMessage, TempHandled);
if not(TempHandled) and if not(TempHandled) then
(FOldWidgetCompWndPrc <> nil) and CallOldCompWndProc(FOldWidgetCompWndPrc, FWidgetCompHWND, aMessage);
(FWidgetCompHWND <> 0) then
aMessage.Result := CallWindowProc(FOldWidgetCompWndPrc,
FWidgetCompHWND,
aMessage.Msg,
aMessage.wParam,
aMessage.lParam);
finally finally
if aMessage.Msg = WM_DESTROY then if aMessage.Msg = WM_DESTROY then
RestoreCompWndProc(FWidgetCompHWND, 0, FOldWidgetCompWndPrc); RestoreCompWndProc(FWidgetCompHWND, 0, FOldWidgetCompWndPrc);
@ -3850,14 +3901,8 @@ begin
if assigned(FOnRenderCompMsg) then if assigned(FOnRenderCompMsg) then
FOnRenderCompMsg(aMessage, TempHandled); FOnRenderCompMsg(aMessage, TempHandled);
if not(TempHandled) and if not(TempHandled) then
(FOldRenderCompWndPrc <> nil) and CallOldCompWndProc(FOldRenderCompWndPrc, FRenderCompHWND, aMessage);
(FRenderCompHWND <> 0) then
aMessage.Result := CallWindowProc(FOldRenderCompWndPrc,
FRenderCompHWND,
aMessage.Msg,
aMessage.wParam,
aMessage.lParam);
finally finally
if aMessage.Msg = WM_DESTROY then if aMessage.Msg = WM_DESTROY then
RestoreCompWndProc(FRenderCompHWND, 0, FOldRenderCompWndPrc); RestoreCompWndProc(FRenderCompHWND, 0, FOldRenderCompWndPrc);
@ -3868,7 +3913,6 @@ begin
end; end;
end; end;
{$ENDIF} {$ENDIF}
{$ENDIF}
function TChromiumCore.doOnClose(const browser: ICefBrowser): Boolean; function TChromiumCore.doOnClose(const browser: ICefBrowser): Boolean;
var var
@ -4465,23 +4509,19 @@ end;
procedure TChromiumCore.doOnRenderViewReady(const browser: ICefBrowser); procedure TChromiumCore.doOnRenderViewReady(const browser: ICefBrowser);
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
var var
OldBrowserCompHWND, OldWidgetCompHWND, OldRenderCompHWND: THandle; OldBrowserCompHWND, OldWidgetCompHWND, OldRenderCompHWND: THandle;
{$ENDIF} {$ENDIF}
{$ENDIF}
begin begin
if (browser <> nil) and if (browser <> nil) and
(browser.Host <> nil) and (browser.Host <> nil) and
(browser.Identifier = FBrowserId) then (browser.Identifier = FBrowserId) then
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
{$IFNDEF FPC}
OldBrowserCompHWND := FBrowserCompHWND; OldBrowserCompHWND := FBrowserCompHWND;
OldWidgetCompHWND := FWidgetCompHWND; OldWidgetCompHWND := FWidgetCompHWND;
OldRenderCompHWND := FRenderCompHWND; OldRenderCompHWND := FRenderCompHWND;
{$ENDIF} {$ENDIF}
{$ENDIF}
FBrowserCompHWND := browser.Host.WindowHandle; FBrowserCompHWND := browser.Host.WindowHandle;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@ -4490,35 +4530,28 @@ begin
if (FWidgetCompHWND <> 0) then if (FWidgetCompHWND <> 0) then
FRenderCompHWND := FindWindowEx(FWidgetCompHWND, 0, 'Chrome_RenderWidgetHostHWND', 'Chrome Legacy Window'); FRenderCompHWND := FindWindowEx(FWidgetCompHWND, 0, 'Chrome_RenderWidgetHostHWND', 'Chrome Legacy Window');
{$IFNDEF FPC}
RestoreCompWndProc(OldBrowserCompHWND, FBrowserCompHWND, FOldBrowserCompWndPrc); RestoreCompWndProc(OldBrowserCompHWND, FBrowserCompHWND, FOldBrowserCompWndPrc);
if assigned(FOnBrowserCompMsg) and (FBrowserCompHWND <> 0) and (FOldBrowserCompWndPrc = nil) then if assigned(FOnBrowserCompMsg) and (FBrowserCompHWND <> 0) and (FOldBrowserCompWndPrc = nil) then
begin begin
CreateStub(BrowserCompWndProc, FBrowserCompStub); CreateStub({$IFDEF FPC}@{$ENDIF}BrowserCompWndProc, FBrowserCompStub);
FOldBrowserCompWndPrc := TFNWndProc(SetWindowLongPtr(FBrowserCompHWND, FOldBrowserCompWndPrc := InstallCompWndProc(FBrowserCompHWND, FBrowserCompStub);
GWLP_WNDPROC,
NativeInt(FBrowserCompStub)));
end; end;
RestoreCompWndProc(OldWidgetCompHWND, FWidgetCompHWND, FOldWidgetCompWndPrc); RestoreCompWndProc(OldWidgetCompHWND, FWidgetCompHWND, FOldWidgetCompWndPrc);
if assigned(FOnWidgetCompMsg) and (FWidgetCompHWND <> 0) and (FOldWidgetCompWndPrc = nil) then if assigned(FOnWidgetCompMsg) and (FWidgetCompHWND <> 0) and (FOldWidgetCompWndPrc = nil) then
begin begin
CreateStub(WidgetCompWndProc, FWidgetCompStub); CreateStub({$IFDEF FPC}@{$ENDIF}WidgetCompWndProc, FWidgetCompStub);
FOldWidgetCompWndPrc := TFNWndProc(SetWindowLongPtr(FWidgetCompHWND, FOldWidgetCompWndPrc := InstallCompWndProc(FWidgetCompHWND, FWidgetCompStub);
GWLP_WNDPROC,
NativeInt(FWidgetCompStub)));
end; end;
RestoreCompWndProc(OldRenderCompHWND, FRenderCompHWND, FOldRenderCompWndPrc); RestoreCompWndProc(OldRenderCompHWND, FRenderCompHWND, FOldRenderCompWndPrc);
if assigned(FOnRenderCompMsg) and (FRenderCompHWND <> 0) and (FOldRenderCompWndPrc = nil) then if assigned(FOnRenderCompMsg) and (FRenderCompHWND <> 0) and (FOldRenderCompWndPrc = nil) then
begin begin
CreateStub(RenderCompWndProc, FRenderCompStub); CreateStub({$IFDEF FPC}@{$ENDIF}RenderCompWndProc, FRenderCompStub);
FOldRenderCompWndPrc := TFNWndProc(SetWindowLongPtr(FRenderCompHWND, FOldRenderCompWndPrc := InstallCompWndProc(FRenderCompHWND, FRenderCompStub);
GWLP_WNDPROC,
NativeInt(FRenderCompStub)));
end; end;
{$ENDIF} {$ENDIF}
{$ENDIF}
end; end;
if Assigned(FOnRenderViewReady) then FOnRenderViewReady(Self, browser); if Assigned(FOnRenderViewReady) then FOnRenderViewReady(Self, browser);
@ -4614,7 +4647,7 @@ function TChromiumCore.doOnStartDragging(const browser : ICefBrowser;
y : Integer): Boolean; y : Integer): Boolean;
begin begin
Result := False; Result := False;
{$IFNDEF FPC} {$IFDEF MSWINDOWS}
if FDragAndDropInitialized and if FDragAndDropInitialized and
FDragDropManager.CloneDragData(dragData, allowedOps) then FDragDropManager.CloneDragData(dragData, allowedOps) then
begin begin
@ -4627,13 +4660,13 @@ begin
end; end;
procedure TChromiumCore.DelayedDragging; procedure TChromiumCore.DelayedDragging;
{$IFNDEF FPC} {$IFDEF MSWINDOWS}
var var
TempOperation : TCefDragOperation; TempOperation : TCefDragOperation;
TempPoint : TPoint; TempPoint : TPoint;
{$ENDIF} {$ENDIF}
begin begin
{$IFNDEF FPC} {$IFDEF MSWINDOWS}
if FDragAndDropInitialized and (FDropTargetWnd <> 0) and (GlobalCEFApp <> nil) then if FDragAndDropInitialized and (FDropTargetWnd <> 0) and (GlobalCEFApp <> nil) then
begin begin
FDragOperations := DRAG_OPERATION_NONE; FDragOperations := DRAG_OPERATION_NONE;

View File

@ -116,6 +116,14 @@ implementation
uses uses
uCEFMiscFunctions, uCEFWriteHandler, uCEFStreamWriter, uCEFConstants; uCEFMiscFunctions, uCEFWriteHandler, uCEFStreamWriter, uCEFConstants;
{$IFDEF FPC}
const
//CFSTR_FILEDESCRIPTORA = 'FileGroupDescriptor'; // CF_FILEGROUPDESCRIPTORA
CFSTR_FILEDESCRIPTORW = 'FileGroupDescriptorW'; // CF_FILEGROUPDESCRIPTORW
CFSTR_FILEDESCRIPTOR = CFSTR_FILEDESCRIPTORW;
CFSTR_FILECONTENTS = 'FileContents'; // CF_FILECONTENTS
{$ENDIF}
// ***************************************************** // *****************************************************
// **************** TCEFDragAndDropMgr ***************** // **************** TCEFDragAndDropMgr *****************
// ***************************************************** // *****************************************************
@ -667,7 +675,11 @@ begin
while (TempEnumFrmt.Next(1, TempFormat, nil) = S_OK) and not(TempUsed) do while (TempEnumFrmt.Next(1, TempFormat, nil) = S_OK) and not(TempUsed) do
begin begin
try try
{$IFNDEF FPC}
TempMedium.unkForRelease := nil; TempMedium.unkForRelease := nil;
{$ELSE}
TempMedium.PUnkForRelease := nil;
{$ENDIF}
if ((TempFormat.tymed and TYMED_HGLOBAL) <> 0) and if ((TempFormat.tymed and TYMED_HGLOBAL) <> 0) and
(aDataObject.GetData(TempFormat, TempMedium) = S_OK) then (aDataObject.GetData(TempFormat, TempMedium) = S_OK) then
@ -722,7 +734,11 @@ begin
TempResEffect := DROPEFFECT_NONE; TempResEffect := DROPEFFECT_NONE;
TempDataObject := TOLEDataObject.Create(TempFormatArray, TempMediumArray, i); TempDataObject := TOLEDataObject.Create(TempFormatArray, TempMediumArray, i);
TempDropSource := TOLEDropSource.Create; TempDropSource := TOLEDropSource.Create;
{$IFNDEF FPC}
TempResult := DoDragDrop(TempDataObject, TempDropSource, FOLEEffect, TempResEffect); TempResult := DoDragDrop(TempDataObject, TempDropSource, FOLEEffect, TempResEffect);
{$ELSE}
TempResult := DoDragDrop(TempDataObject, TempDropSource, DWORD(FOLEEffect), LPDWORD(TempResEffect));
{$ENDIF}
if (TempResult <> DRAGDROP_S_DROP) then TempResEffect := DROPEFFECT_NONE; if (TempResult <> DRAGDROP_S_DROP) then TempResEffect := DROPEFFECT_NONE;
FCurrentDragData := nil; FCurrentDragData := nil;

View File

@ -70,7 +70,7 @@ type
implementation implementation
uses uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFDictionaryValue, uCEFRequestContext, uCefExtensionHandler; uCEFMiscFunctions, uCEFLibFunctions, uCEFDictionaryValue, uCEFRequestContext, uCEFExtensionHandler;
function TCefExtensionRef.GetIdentifier : ustring; function TCefExtensionRef.GetIdentifier : ustring;
begin begin

View File

@ -116,7 +116,7 @@ begin
DefaultInitializeDevToolsWindowInfo(0, Rect(0, 0, 0, 0), ''); DefaultInitializeDevToolsWindowInfo(0, Rect(0, 0, 0, 0), '');
end; end;
procedure TFMXChromium.ShowDevTools(inspectElementAt: TPoint; const aDevTools : TControl = nil); procedure TFMXChromium.ShowDevTools(inspectElementAt: TPoint);
begin begin
if Initialized then if Initialized then
begin begin

View File

@ -53,7 +53,7 @@ uses
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.ActiveX,{$ENDIF} System.IOUtils, System.Classes, System.SysUtils, System.UITypes, System.Math, {$IFDEF MSWINDOWS}WinApi.Windows, WinApi.ActiveX,{$ENDIF} System.IOUtils, System.Classes, System.SysUtils, System.UITypes, System.Math,
{$ELSE} {$ELSE}
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} Classes, SysUtils, Math, {$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} Classes, SysUtils, Math,
{$IFDEF FPC}LCLType,{$IFNDEF MSWINDOWS}InterfaceBase,{$ENDIF}{$ENDIF} {$IFDEF FPC}LCLType,{$IFNDEF MSWINDOWS}InterfaceBase, Forms,{$ENDIF}{$ENDIF}
{$ENDIF} {$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler, uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
uCEFRegisterCDMCallback, uCEFConstants; uCEFRegisterCDMCallback, uCEFConstants;
@ -136,6 +136,8 @@ function PathIsURLAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name
function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW'; function PathIsURLUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsURLW';
{$IFNDEF DELPHI12_UP} {$IFNDEF DELPHI12_UP}
const
GWLP_WNDPROC = GWL_WNDPROC;
{$IFDEF WIN64} {$IFDEF WIN64}
function SetWindowLongPtr(hWnd: HWND; nIndex: Integer; dwNewLong: int64): int64; stdcall; external user32 name 'SetWindowLongPtrW'; function SetWindowLongPtr(hWnd: HWND; nIndex: Integer; dwNewLong: int64): int64; stdcall; external user32 name 'SetWindowLongPtrW';
{$ELSE} {$ELSE}
@ -879,9 +881,10 @@ function SplitLongString(aSrcString : string) : string;
const const
MAXLINELENGTH = 50; MAXLINELENGTH = 50;
begin begin
Result := '';
while (length(aSrcString) > 0) do while (length(aSrcString) > 0) do
begin begin
if (length(Result) > 0) then if (Result <> '') then
Result := Result + CRLF + copy(aSrcString, 1, MAXLINELENGTH) Result := Result + CRLF + copy(aSrcString, 1, MAXLINELENGTH)
else else
Result := Result + copy(aSrcString, 1, MAXLINELENGTH); Result := Result + copy(aSrcString, 1, MAXLINELENGTH);
@ -972,7 +975,7 @@ begin
if (length(aLocalesDirPath) > 0) then if (length(aLocalesDirPath) > 0) then
TempDir := IncludeTrailingPathDelimiter(aLocalesDirPath) TempDir := IncludeTrailingPathDelimiter(aLocalesDirPath)
else else
TempDir := 'locales\'; TempDir := 'locales' + PathDelim;
TempList := TStringList.Create; TempList := TStringList.Create;
@ -1071,11 +1074,19 @@ begin
TempList := TStringList.Create; TempList := TStringList.Create;
TempList.Add(TempDir + CHROMEELF_DLL); TempList.Add(TempDir + CHROMEELF_DLL);
TempList.Add(TempDir + LIBCEF_DLL); TempList.Add(TempDir + LIBCEF_DLL);
{$IFDEF MSWINDOWS}
TempList.Add(TempDir + 'd3dcompiler_47.dll'); TempList.Add(TempDir + 'd3dcompiler_47.dll');
TempList.Add(TempDir + 'libEGL.dll'); TempList.Add(TempDir + 'libEGL.dll');
TempList.Add(TempDir + 'libGLESv2.dll'); TempList.Add(TempDir + 'libGLESv2.dll');
TempList.Add(TempDir + 'swiftshader\libEGL.dll'); TempList.Add(TempDir + 'swiftshader\libEGL.dll');
TempList.Add(TempDir + 'swiftshader\libGLESv2.dll'); TempList.Add(TempDir + 'swiftshader\libGLESv2.dll');
{$ENDIF}
{$IFDEF LINUX}
TempList.Add(TempDir + 'libEGL.so');
TempList.Add(TempDir + 'libGLESv2.so');
TempList.Add(TempDir + 'swiftshader/libEGL.so');
TempList.Add(TempDir + 'swiftshader/libGLESv2.so');
{$ENDIF}
TempList.Add(TempDir + 'icudtl.dat'); TempList.Add(TempDir + 'icudtl.dat');
if TempExists then if TempExists then
@ -1515,7 +1526,12 @@ end;
function GetModulePath : string; function GetModulePath : string;
begin begin
{$IFDEF MSWINDOWS}
Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF}))); Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF})));
{$ELSE}
// DLL filename not supported
Result := IncludeTrailingPathDelimiter(ExtractFileDir(ParamStr(0)));
{$ENDIF MSWINDOWS}
end; end;
function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean;

View File

@ -72,7 +72,7 @@ type
implementation implementation
uses uses
uCEFMiscFunctions, uCefSSLStatus; uCEFMiscFunctions, uCEFSSLStatus;
function TCefNavigationEntryRef.IsValid: Boolean; function TCefNavigationEntryRef.IsValid: Boolean;
begin begin

View File

@ -88,8 +88,13 @@ type
destructor Destroy; override; destructor Destroy; override;
// IEnumFormatEtc // IEnumFormatEtc
function Next(Celt: LongInt; out Elt; pCeltFetched: pLongInt): HRESULT; stdcall; {$IFNDEF FPC}
function Next(Celt: LongInt; out Rgelt; pCeltFetched: pLongInt): HRESULT; stdcall;
function Skip(Celt: Longint): HRESULT; stdcall; function Skip(Celt: Longint): HRESULT; stdcall;
{$ELSE}
function Next(Celt: ULONG; out Rgelt: FormatEtc; pceltFetched: PULONG = nil): HRESULT; stdcall;
function Skip(Celt: ULONG): HRESULT; stdcall;
{$ENDIF}
function Reset: HRESULT; stdcall; function Reset: HRESULT; stdcall;
function Clone(out Enum: IEnumFormatEtc): HRESULT; stdcall; function Clone(out Enum: IEnumFormatEtc): HRESULT; stdcall;
end; end;
@ -97,8 +102,13 @@ type
TOLEDropSource = class(TInterfacedObject, IDropSource) TOLEDropSource = class(TInterfacedObject, IDropSource)
public public
// IDropSource // IDropSource
{$IFNDEF FPC}
function QueryContinueDrag(fEscapePressed: bool; grfKeyState: LongInt): HRESULT; stdcall; function QueryContinueDrag(fEscapePressed: bool; grfKeyState: LongInt): HRESULT; stdcall;
function GiveFeedback(dwEffect: LongInt): HRESULT; stdcall; function GiveFeedback(dwEffect: LongInt): HRESULT; stdcall;
{$ELSE}
function QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: DWORD): HRESULT; stdcall;
function GiveFeedback(dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
end; end;
TOLEDataObject = class(TInterfacedObject, IDataObject) TOLEDataObject = class(TInterfacedObject, IDataObject)
@ -120,11 +130,19 @@ type
function GetDataHere(const FormatEtc: TFormatEtc; out Medium: TStgMedium):HRESULT; stdcall; function GetDataHere(const FormatEtc: TFormatEtc; out Medium: TStgMedium):HRESULT; stdcall;
function QueryGetData(const FormatEtc: TFormatEtc): HRESULT; stdcall; function QueryGetData(const FormatEtc: TFormatEtc): HRESULT; stdcall;
function GetCanonicalFormatEtc(const FormatEtc: TFormatEtc; out FormatEtcout: TFormatEtc): HRESULT; stdcall; function GetCanonicalFormatEtc(const FormatEtc: TFormatEtc; out FormatEtcout: TFormatEtc): HRESULT; stdcall;
{$IFNDEF FPC}
function SetData(const FormatEtc: TFormatEtc; var Medium: TStgMedium; fRelease: Bool): HRESULT; stdcall; function SetData(const FormatEtc: TFormatEtc; var Medium: TStgMedium; fRelease: Bool): HRESULT; stdcall;
function EnumFormatEtc(dwDirection: LongInt; out aEnumFormatEtc: IEnumFormatEtc): HRESULT; stdcall; function EnumFormatEtc(dwDirection: LongInt; out aEnumFormatEtc: IEnumFormatEtc): HRESULT; stdcall;
function dAdvise(const FormatEtc: TFormatEtc; advf: LongInt; const advsink: IAdviseSink; out dwConnection: LongInt): HRESULT; stdcall; function dAdvise(const FormatEtc: TFormatEtc; advf: LongInt; const advsink: IAdviseSink; out dwConnection: LongInt): HRESULT; stdcall;
function dUnadvise(dwConnection: LongInt): HRESULT; stdcall; function dUnadvise(dwConnection: LongInt): HRESULT; stdcall;
{$ELSE}
function SetData(const pformatetc: FORMATETC; const medium: STGMEDIUM; FRelease: BOOL): HRESULT; stdcall;
function EnumFormatEtc(dwDirection: DWORD; out aEnumFormatEtc: IENUMFORMATETC): HRESULT; stdcall;
function DAdvise(const formatetc: FORMATETC; advf: DWORD; const AdvSink: IAdviseSink; out dwConnection: DWORD): HRESULT; stdcall;
function DUnadvise(dwconnection: DWORD): HRESULT; stdcall;
{$ENDIF}
function EnumdAdvise(out EnumAdvise: IEnumStatData): HRESULT; stdcall; function EnumdAdvise(out EnumAdvise: IEnumStatData): HRESULT; stdcall;
end; end;
TOLEDropTarget = class(TInterfacedObject, IDropTarget) TOLEDropTarget = class(TInterfacedObject, IDropTarget)
@ -135,10 +153,17 @@ type
constructor Create(const aManager : TOLEDragAndDropMgr); reintroduce; constructor Create(const aManager : TOLEDragAndDropMgr); reintroduce;
// IDropTarget // IDropTarget
{$IFNDEF FPC}
function DragEnter(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function DragEnter(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
function DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall;
function Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
{$ELSE}
function DragEnter(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
function DragOver(grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
function Drop(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
function DragLeave: HRESULT; stdcall;
end; end;
implementation implementation
@ -168,7 +193,11 @@ begin
aMedium.hGlobal := TempHandle; aMedium.hGlobal := TempHandle;
aMedium.tymed := TYMED_HGLOBAL; aMedium.tymed := TYMED_HGLOBAL;
{$IFNDEF FPC}
aMedium.unkForRelease := nil; aMedium.unkForRelease := nil;
{$ELSE}
aMedium.PUnkForRelease := nil;
{$ENDIF}
GlobalUnlock(TempHandle); GlobalUnlock(TempHandle);
@ -207,6 +236,10 @@ begin
end; end;
function TOLEDragAndDropMgr.GetStorageForFileDescriptor(var aMedium : TStgMedium; const aFileName : string) : boolean; function TOLEDragAndDropMgr.GetStorageForFileDescriptor(var aMedium : TStgMedium; const aFileName : string) : boolean;
{$IFDEF FPC}
const
FD_LINKUI = $8000;
{$ENDIF}
var var
TempHandle : HGLOBAL; TempHandle : HGLOBAL;
TempDescriptor : TFileGroupDescriptor; TempDescriptor : TFileGroupDescriptor;
@ -243,7 +276,11 @@ begin
aMedium.tymed := TYMED_HGLOBAL; aMedium.tymed := TYMED_HGLOBAL;
aMedium.hGlobal := TempHandle; aMedium.hGlobal := TempHandle;
{$IFNDEF FPC}
aMedium.unkForRelease := nil; aMedium.unkForRelease := nil;
{$ELSE}
aMedium.PUnkForRelease := nil;
{$ENDIF}
GlobalUnlock(TempHandle); GlobalUnlock(TempHandle);
@ -330,6 +367,8 @@ begin
end; end;
procedure TOLEEnumFormatEtc.CopyFormatEtc(var aDstFormatEtc : TFormatEtc; const aSrcFormatEtc : TFormatEtc); procedure TOLEEnumFormatEtc.CopyFormatEtc(var aDstFormatEtc : TFormatEtc; const aSrcFormatEtc : TFormatEtc);
var
Size: Integer;
begin begin
aDstFormatEtc.cfFormat := aSrcFormatEtc.cfFormat; aDstFormatEtc.cfFormat := aSrcFormatEtc.cfFormat;
aDstFormatEtc.dwAspect := aSrcFormatEtc.dwAspect; aDstFormatEtc.dwAspect := aSrcFormatEtc.dwAspect;
@ -340,27 +379,28 @@ begin
aDstFormatEtc.ptd := nil aDstFormatEtc.ptd := nil
else else
begin begin
aDstFormatEtc.ptd := CoTaskMemAlloc(SizeOf(TDVTargetDevice)); Size := Max(aSrcFormatEtc.ptd^.tdSize, SizeOf(DVTARGETDEVICE));
aDstFormatEtc.ptd := CoTaskMemAlloc(Size);
aDstFormatEtc.ptd.tdSize := aSrcFormatEtc.ptd.tdSize; Move(aSrcFormatEtc.ptd^, aDstFormatEtc.ptd^, Size);
aDstFormatEtc.ptd.tdDriverNameOffset := aSrcFormatEtc.ptd.tdDriverNameOffset;
aDstFormatEtc.ptd.tdDeviceNameOffset := aSrcFormatEtc.ptd.tdDeviceNameOffset;
aDstFormatEtc.ptd.tdPortNameOffset := aSrcFormatEtc.ptd.tdPortNameOffset;
aDstFormatEtc.ptd.tdExtDevmodeOffset := aSrcFormatEtc.ptd.tdExtDevmodeOffset;
aDstFormatEtc.ptd.tdData := aSrcFormatEtc.ptd.tdData;
end; end;
end; end;
function TOLEEnumFormatEtc.Next(Celt: LongInt; out Elt; pCeltFetched: pLongInt): HRESULT; function TOLEEnumFormatEtc.Next
{$IFNDEF FPC}
(Celt: LongInt; out Rgelt; pCeltFetched: pLongInt): HRESULT; stdcall;
{$ELSE}
(Celt: ULONG; out Rgelt: FormatEtc; pceltFetched: PULONG): HRESULT; stdcall;
{$ENDIF}
var var
i : integer; i : integer;
TempArray : TOLEFormatArray absolute Elt; TempArray : ^TOLEFormatArray;
begin begin
i := 0; i := 0;
TempArray := @Rgelt;
while (i < Celt) and (FIndex < FNumFormats) do while (i < Celt) and (FIndex < FNumFormats) do
begin begin
CopyFormatEtc(TempArray[i], FFormatArray[FIndex]); CopyFormatEtc(TempArray^[i], FFormatArray[FIndex]);
inc(i); inc(i);
inc(FIndex); inc(FIndex);
end; end;
@ -373,7 +413,12 @@ begin
Result := S_FALSE; Result := S_FALSE;
end; end;
function TOLEEnumFormatEtc.Skip(Celt: Longint): HRESULT; function TOLEEnumFormatEtc.Skip
{$IFNDEF FPC}
(Celt: Longint): HRESULT; stdcall;
{$ELSE}
(Celt: ULONG): HRESULT; stdcall;
{$ENDIF}
begin begin
FIndex := FIndex + Celt; FIndex := FIndex + Celt;
@ -383,13 +428,13 @@ begin
Result := S_FALSE; Result := S_FALSE;
end; end;
function TOLEEnumFormatEtc.Reset: HRESULT; function TOLEEnumFormatEtc.Reset: HRESULT; stdcall;
begin begin
FIndex := 0; FIndex := 0;
Result := S_OK; Result := S_OK;
end; end;
function TOLEEnumFormatEtc.Clone(out Enum: IEnumFormatEtc): HRESULT; function TOLEEnumFormatEtc.Clone(out Enum: IEnumFormatEtc): HRESULT; stdcall;
begin begin
Enum := TOLEEnumFormatEtc.Create(FFormatArray, FNumFormats, FIndex); Enum := TOLEEnumFormatEtc.Create(FFormatArray, FNumFormats, FIndex);
Result := S_OK; Result := S_OK;
@ -407,14 +452,24 @@ begin
FManager := aManager; FManager := aManager;
end; end;
function TOLEDropTarget.DragEnter(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function TOLEDropTarget.DragEnter
{$IFNDEF FPC}
(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
{$ELSE}
(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := FManager.DragEnter(DataObj, grfKeyState, pt, dwEffect); Result := FManager.DragEnter(DataObj, grfKeyState, pt, Longint(dwEffect));
end; end;
function TOLEDropTarget.DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function TOLEDropTarget.DragOver
{$IFNDEF FPC}
(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
{$ELSE}
(grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := FManager.DragOver(grfKeyState, pt, dwEffect); Result := FManager.DragOver(grfKeyState, pt, Longint(dwEffect));
end; end;
function TOLEDropTarget.DragLeave: HRESULT; stdcall; function TOLEDropTarget.DragLeave: HRESULT; stdcall;
@ -422,9 +477,14 @@ begin
Result := FManager.DragLeave; Result := FManager.DragLeave;
end; end;
function TOLEDropTarget.Drop(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall; function TOLEDropTarget.Drop
{$IFNDEF FPC}
(const dataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HRESULT; stdcall;
{$ELSE}
(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := FManager.Drop(dataObj, grfKeyState, pt, dwEffect); Result := FManager.Drop(dataObj, grfKeyState, pt, Longint(dwEffect));
end; end;
@ -432,7 +492,12 @@ end;
// ****************** TOLEDropSource ******************* // ****************** TOLEDropSource *******************
// ***************************************************** // *****************************************************
function TOLEDropSource.QueryContinueDrag(fEscapePressed: bool; grfKeyState: LongInt): HRESULT; stdcall; function TOLEDropSource.QueryContinueDrag
{$IFNDEF FPC}
(fEscapePressed: bool; grfKeyState: LongInt): HRESULT; stdcall;
{$ELSE}
(fEscapePressed: BOOL; grfKeyState: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
if fEscapePressed then if fEscapePressed then
Result := DRAGDROP_S_CANCEL Result := DRAGDROP_S_CANCEL
@ -443,7 +508,12 @@ begin
Result := S_OK; Result := S_OK;
end; end;
function TOLEDropSource.GiveFeedback(dwEffect: LongInt): HRESULT; stdcall; function TOLEDropSource.GiveFeedback
{$IFNDEF FPC}
(dwEffect: LongInt): HRESULT; stdcall;
{$ELSE}
(dwEffect: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := DRAGDROP_S_USEDEFAULTCURSORS; Result := DRAGDROP_S_USEDEFAULTCURSORS;
end; end;
@ -542,14 +612,22 @@ begin
if (i < 0) or ((FFormatArray[i].tymed and TYMED_HGLOBAL) = 0) then if (i < 0) or ((FFormatArray[i].tymed and TYMED_HGLOBAL) = 0) then
begin begin
Medium.tymed := TYMED_NULL; Medium.tymed := TYMED_NULL;
{$IFNDEF FPC}
Medium.unkForRelease := nil; Medium.unkForRelease := nil;
{$ELSE}
Medium.PUnkForRelease := nil;
{$ENDIF}
Medium.hGlobal := 0; Medium.hGlobal := 0;
Result := DV_E_FORMATETC; Result := DV_E_FORMATETC;
end end
else else
begin begin
Medium.tymed := FFormatArray[i].tymed; Medium.tymed := FFormatArray[i].tymed;
{$IFNDEF FPC}
Medium.unkForRelease := nil; Medium.unkForRelease := nil;
{$ELSE}
Medium.PUnkForRelease := nil;
{$ENDIF}
Medium.hGlobal := DupGlobalMem(FMediumArray[i].hGlobal); Medium.hGlobal := DupGlobalMem(FMediumArray[i].hGlobal);
Result := S_OK; Result := S_OK;
end; end;
@ -579,12 +657,22 @@ begin
Result := E_NOTIMPL; Result := E_NOTIMPL;
end; end;
function TOLEDataObject.SetData(const FormatEtc: TFormatEtc; var Medium: TStgMedium; fRelease: Bool): HRESULT; stdcall; function TOLEDataObject.SetData
{$IFNDEF FPC}
(const FormatEtc: TFormatEtc; var Medium: TStgMedium; fRelease: Bool): HRESULT; stdcall;
{$ELSE}
(const pformatetc: FORMATETC; const medium: STGMEDIUM; FRelease: BOOL): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := E_NOTIMPL; Result := E_NOTIMPL;
end; end;
function TOLEDataObject.EnumFormatEtc(dwDirection: LongInt; out aEnumFormatEtc: IEnumFormatEtc): HRESULT; stdcall; function TOLEDataObject.EnumFormatEtc
{$IFNDEF FPC}
(dwDirection: LongInt; out aEnumFormatEtc: IEnumFormatEtc): HRESULT; stdcall;
{$ELSE}
(dwDirection: DWORD; out aEnumFormatEtc: IENUMFORMATETC): HRESULT; stdcall;
{$ENDIF}
begin begin
if (dwDirection = DATADIR_GET) then if (dwDirection = DATADIR_GET) then
begin begin
@ -602,15 +690,22 @@ begin
end; end;
end; end;
function TOLEDataObject.dAdvise(const FormatEtc: TFormatEtc; function TOLEDataObject.dAdvise
advf: LongInt; {$IFNDEF FPC}
const advsink: IAdviseSink; (const FormatEtc: TFormatEtc; advf: LongInt; const advsink: IAdviseSink; out dwConnection: LongInt): HRESULT; stdcall;
out dwConnection: LongInt): HRESULT; stdcall; {$ELSE}
(const formatetc: FORMATETC; advf: DWORD; const AdvSink: IAdviseSink; out dwConnection: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := OLE_E_ADVISENOTSUPPORTED; Result := OLE_E_ADVISENOTSUPPORTED;
end; end;
function TOLEDataObject.dUnadvise(dwConnection: LongInt): HRESULT; stdcall; function TOLEDataObject.dUnadvise
{$IFNDEF FPC}
(dwConnection: LongInt): HRESULT; stdcall;
{$ELSE}
(dwconnection: DWORD): HRESULT; stdcall;
{$ENDIF}
begin begin
Result := OLE_E_ADVISENOTSUPPORTED; Result := OLE_E_ADVISENOTSUPPORTED;
end; end;

View File

@ -80,7 +80,9 @@ type
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF} {$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
TCEFSentinel = class(TComponent) TCEFSentinel = class(TComponent)
protected protected
{$IFDEF MSWINDOWS}
FCompHandle : HWND; FCompHandle : HWND;
{$ENDIF}
FStatus : TSentinelStatus; FStatus : TSentinelStatus;
FStatusCS : TCriticalSection; FStatusCS : TCriticalSection;
FDelayPerProcMs : cardinal; FDelayPerProcMs : cardinal;
@ -99,8 +101,8 @@ type
procedure WndProc(var aMessage: TMessage); procedure WndProc(var aMessage: TMessage);
procedure doStartMsg(var aMessage : TMessage); virtual; procedure doStartMsg(var aMessage : TMessage); virtual;
procedure doCloseMsg(var aMessage : TMessage); virtual; procedure doCloseMsg(var aMessage : TMessage); virtual;
{$ENDIF}
function SendCompMessage(aMsg : cardinal) : boolean; function SendCompMessage(aMsg : cardinal) : boolean;
{$ENDIF}
function CanClose : boolean; virtual; function CanClose : boolean; virtual;
procedure Timer_OnTimer(Sender: TObject); virtual; procedure Timer_OnTimer(Sender: TObject); virtual;
@ -137,7 +139,9 @@ constructor TCEFSentinel.Create(AOwner: TComponent);
begin begin
inherited Create(aOwner); inherited Create(aOwner);
{$IFDEF MSWINDOWS}
FCompHandle := 0; FCompHandle := 0;
{$ENDIF}
FDelayPerProcMs := CEFSENTINEL_DEFAULT_DELAYPERPROCMS; FDelayPerProcMs := CEFSENTINEL_DEFAULT_DELAYPERPROCMS;
FMinInitDelayMs := CEFSENTINEL_DEFAULT_MININITDELAYMS; FMinInitDelayMs := CEFSENTINEL_DEFAULT_MININITDELAYMS;
FFinalDelayMs := CEFSENTINEL_DEFAULT_FINALDELAYMS; FFinalDelayMs := CEFSENTINEL_DEFAULT_FINALDELAYMS;
@ -151,22 +155,13 @@ begin
end; end;
procedure TCEFSentinel.AfterConstruction; procedure TCEFSentinel.AfterConstruction;
{$IFDEF FPC}
var
TempWndMethod : TWndMethod;
{$ENDIF}
begin begin
inherited AfterConstruction; inherited AfterConstruction;
if not(csDesigning in ComponentState) then if not(csDesigning in ComponentState) then
begin begin
{$IFDEF FPC}
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
TempWndMethod := @WndProc; FCompHandle := AllocateHWnd({$IFDEF FPC}@{$ENDIF}WndProc);
FCompHandle := AllocateHWnd(TempWndMethod);
{$ENDIF}
{$ELSE}
FCompHandle := AllocateHWnd(WndProc);
{$ENDIF} {$ENDIF}
FStatusCS := TCriticalSection.Create; FStatusCS := TCriticalSection.Create;
@ -218,12 +213,12 @@ procedure TCEFSentinel.doCloseMsg(var aMessage : TMessage);
begin begin
if assigned(FOnClose) then FOnClose(self); if assigned(FOnClose) then FOnClose(self);
end; end;
{$ENDIF}
function TCEFSentinel.SendCompMessage(aMsg : cardinal) : boolean; function TCEFSentinel.SendCompMessage(aMsg : cardinal) : boolean;
begin begin
Result := (FCompHandle <> 0) and PostMessage(FCompHandle, aMsg, 0, 0); Result := (FCompHandle <> 0) and PostMessage(FCompHandle, aMsg, 0, 0);
end; end;
{$ENDIF}
procedure TCEFSentinel.Start; procedure TCEFSentinel.Start;
begin begin
@ -233,7 +228,9 @@ begin
if (FStatus = ssIdle) then if (FStatus = ssIdle) then
begin begin
FStatus := ssInitialDelay; FStatus := ssInitialDelay;
{$IFDEF MSWINDOWS}
SendCompMessage(CEF_SENTINEL_START); SendCompMessage(CEF_SENTINEL_START);
{$ENDIF}
end; end;
finally finally
if (FStatusCS <> nil) then FStatusCS.Release; if (FStatusCS <> nil) then FStatusCS.Release;
@ -280,7 +277,9 @@ begin
if CanClose then if CanClose then
begin begin
FStatus := ssClosing; FStatus := ssClosing;
{$IFDEF MSWINDOWS}
SendCompMessage(CEF_SENTINEL_DOCLOSE); SendCompMessage(CEF_SENTINEL_DOCLOSE);
{$ENDIF}
end end
else else
begin begin
@ -294,7 +293,9 @@ begin
if CanClose then if CanClose then
begin begin
FStatus := ssClosing; FStatus := ssClosing;
{$IFDEF MSWINDOWS}
SendCompMessage(CEF_SENTINEL_DOCLOSE); SendCompMessage(CEF_SENTINEL_DOCLOSE);
{$ENDIF}
end end
else else
begin begin

View File

@ -133,19 +133,21 @@ begin
end; end;
function TCEFWinControl.TakeSnapshot(var aBitmap : TBitmap) : boolean; function TCEFWinControl.TakeSnapshot(var aBitmap : TBitmap) : boolean;
{$IFDEF MSWINDOWS}
var var
TempHWND : HWND; TempHWND : HWND;
TempDC : HDC; TempDC : HDC;
TempRect : TRect; TempRect : TRect;
TempWidth : Integer; TempWidth : Integer;
TempHeight : Integer; TempHeight : Integer;
{$ENDIF}
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
if (aBitmap = nil) then exit; if (aBitmap = nil) then exit;
TempHWND := ChildWindowHandle; TempHWND := ChildWindowHandle;
if (TempHWND = 0) then exit; if (TempHWND = 0) then exit;
{$IFDEF MSWINDOWS}
{$IFDEF DELPHI16_UP}Winapi.{$ENDIF}Windows.GetClientRect(TempHWND, TempRect); {$IFDEF DELPHI16_UP}Winapi.{$ENDIF}Windows.GetClientRect(TempHWND, TempRect);
TempDC := GetDC(TempHWND); TempDC := GetDC(TempHWND);
TempWidth := TempRect.Right - TempRect.Left; TempWidth := TempRect.Right - TempRect.Left;
@ -163,12 +165,16 @@ begin
end; end;
function TCEFWinControl.DestroyChildWindow : boolean; function TCEFWinControl.DestroyChildWindow : boolean;
{$IFDEF MSWINDOWS}
var var
TempHWND : HWND; TempHWND : HWND;
{$ENDIF}
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
TempHWND := ChildWindowHandle; TempHWND := ChildWindowHandle;
Result := (TempHWND <> 0) and DestroyWindow(TempHWND); Result := (TempHWND <> 0) and DestroyWindow(TempHWND);
{$ELSE}
Result := False;
{$ENDIF} {$ENDIF}
end; end;

View File

@ -166,10 +166,6 @@ begin
end; end;
procedure TCEFWorkScheduler.AfterConstruction; procedure TCEFWorkScheduler.AfterConstruction;
{$IFDEF FPC}
var
TempWndMethod : TWndMethod;
{$ENDIF}
begin begin
inherited AfterConstruction; inherited AfterConstruction;
@ -179,12 +175,7 @@ begin
if (GlobalCEFApp <> nil) and if (GlobalCEFApp <> nil) and
((GlobalCEFApp.ProcessType = ptBrowser) or GlobalCEFApp.SingleProcess) then ((GlobalCEFApp.ProcessType = ptBrowser) or GlobalCEFApp.SingleProcess) then
begin begin
{$IFDEF FPC} FCompHandle := AllocateHWnd({$IFDEF FPC}@{$ENDIF}WndProc);
TempWndMethod := @WndProc;
FCompHandle := AllocateHWnd(TempWndMethod);
{$ELSE}
FCompHandle := AllocateHWnd(WndProc);
{$ENDIF}
end; end;
{$ENDIF} {$ENDIF}
@ -203,7 +194,11 @@ begin
{$IFDEF DELPHI14_UP} {$IFDEF DELPHI14_UP}
FThread.Start; FThread.Start;
{$ELSE} {$ELSE}
{$IFNDEF FPC}
FThread.Resume; FThread.Resume;
{$ELSE}
FThread.Start;
{$ENDIF}
{$ENDIF} {$ENDIF}
end; end;

View File

@ -238,14 +238,7 @@ begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
DeleteCriticalSection(FCriticalSection); DeleteCriticalSection(FCriticalSection);
FCriticalSection.DebugInfo := nil; FillChar(FCriticalSection, SizeOf(FCriticalSection), 0);
FCriticalSection.LockCount := 0;
FCriticalSection.RecursionCount := 0;
FCriticalSection.OwningThread := 0;
FCriticalSection.LockSemaphore := 0;
{$IFNDEF FPC}
FCriticalSection.Reserved := 0;
{$ENDIF}
{$ELSE} {$ELSE}
DoneCriticalSection(FCriticalSection); DoneCriticalSection(FCriticalSection);
{$ENDIF} {$ENDIF}
@ -259,7 +252,7 @@ var
TempSize : int64; TempSize : int64;
begin begin
EnterCriticalSection(FCriticalSection); EnterCriticalSection(FCriticalSection);
try
TempSize := size * n; TempSize := size * n;
if ((FOffset + TempSize) >= FBufferSize) and (Grow(TempSize) = 0) then if ((FOffset + TempSize) >= FBufferSize) and (Grow(TempSize) = 0) then
@ -274,7 +267,9 @@ begin
Result := n; Result := n;
end; end;
finally
LeaveCriticalSection(FCriticalSection); LeaveCriticalSection(FCriticalSection);
end;
end; end;
function TCefBytesWriteHandler.Seek(offset: Int64; whence: Integer): Integer; function TCefBytesWriteHandler.Seek(offset: Int64; whence: Integer): Integer;
@ -352,8 +347,8 @@ function TCefBytesWriteHandler.Grow(size : NativeUInt) : NativeUInt;
var var
TempTotal : int64; TempTotal : int64;
begin begin
try
EnterCriticalSection(FCriticalSection); EnterCriticalSection(FCriticalSection);
try
if (size < FGrow) then if (size < FGrow) then
TempTotal := FGrow TempTotal := FGrow

View File

@ -35,7 +35,7 @@
* *
*) *)
unit uCEFV8Exception; unit uCEFv8Exception;
{$IFDEF FPC} {$IFDEF FPC}
{$MODE OBJFPC}{$H+} {$MODE OBJFPC}{$H+}

View File

@ -133,7 +133,7 @@ implementation
uses uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFv8Accessor, uCEFv8Handler, uCEFv8Exception, uCEFMiscFunctions, uCEFLibFunctions, uCEFv8Accessor, uCEFv8Handler, uCEFv8Exception,
uCEFv8Interceptor, uCEFStringList, uCefv8ArrayBufferReleaseCallback; uCEFv8Interceptor, uCEFStringList, uCEFv8ArrayBufferReleaseCallback;
function TCefv8ValueRef.AdjustExternallyAllocatedMemory(changeInBytes: Integer): Integer; function TCefv8ValueRef.AdjustExternallyAllocatedMemory(changeInBytes: Integer): Integer;
begin begin

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 61, "InternalVersion" : 62,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "78.3.1.0" "Version" : "78.3.1.0"
} }