Added the TChromium.DefaultWindowInfoExStyle property

DefaultWindowInfoExStyle is used to initialize the browser window with that ExStyle. In some cases a focus issue may be fixed if we use the WS_EX_NOACTIVATE value instead of 0 but it may have some side effects.

This could be used to fix issue #282
This commit is contained in:
Salvador Díaz Fau 2020-06-22 16:17:38 +02:00
parent 7e3e8bad24
commit d55d7c0733
2 changed files with 23 additions and 9 deletions

View File

@ -129,13 +129,14 @@ type
FDragDropManager : TCEFDragAndDropMgr;
FDropTargetWnd : HWND;
{$ENDIF}
FDragAndDropInitialized : boolean;
FWebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy;
FWebRTCMultipleRoutes : TCefState;
FWebRTCNonProxiedUDP : TCefState;
FAcceptLanguageList : ustring;
FAcceptCookies : TCefCookiePref;
FBlock3rdPartyCookies : boolean;
FDragAndDropInitialized : boolean;
FWebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy;
FWebRTCMultipleRoutes : TCefState;
FWebRTCNonProxiedUDP : TCefState;
FAcceptLanguageList : ustring;
FAcceptCookies : TCefCookiePref;
FBlock3rdPartyCookies : boolean;
FDefaultWindowInfoExStyle : cardinal;
{$IFDEF MSWINDOWS}
FOldBrowserCompWndPrc : TFNWndProc;
@ -840,6 +841,7 @@ type
property AcceptCookies : TCefCookiePref read FAcceptCookies write SetAcceptCookies;
property Block3rdPartyCookies : boolean read FBlock3rdPartyCookies write SetBlock3rdPartyCookies;
property MultiBrowserMode : boolean read FMultiBrowserMode write SetMultiBrowserMode;
property DefaultWindowInfoExStyle : cardinal read FDefaultWindowInfoExStyle write FDefaultWindowInfoExStyle;
property WebRTCIPHandlingPolicy : TCefWebRTCHandlingPolicy read FWebRTCIPHandlingPolicy write SetWebRTCIPHandlingPolicy;
property WebRTCMultipleRoutes : TCefState read FWebRTCMultipleRoutes write SetWebRTCMultipleRoutes;
@ -1136,6 +1138,18 @@ begin
FAcceptCookies := cpAllow;
FBlock3rdPartyCookies := False;
//
// Somo focus issues in CEF seem to be fixed when you use WS_EX_NOACTIVATE in
// FDefaultWindowInfoExStyle to initialize the browser with that ExStyle but
// it may cause side effects. Read these links for more information :
// https://www.briskbard.com/forum/viewtopic.php?f=10&t=723
// https://bitbucket.org/chromiumembedded/cef/issues/1856/branch-2526-cef-activates-browser-window
//
// It's necessary to set this property before the CreateBrowser call.
//
FDefaultWindowInfoExStyle := 0;
//FDefaultWindowInfoExStyle := WS_EX_NOACTIVATE;
{$IFDEF MSWINDOWS}
FOldBrowserCompWndPrc := nil;
FOldWidgetCompWndPrc := nil;
@ -1783,7 +1797,7 @@ begin
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, ParentFormHandle, aWindowName)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName, FDefaultWindowInfoExStyle);
{$ELSE}
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, 0)

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 147,
"InternalVersion" : 148,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "83.4.0.0"
}