mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 15:55:56 +01:00
Update to CEF 81.2.19
This commit is contained in:
parent
9a0c782064
commit
dce556683a
@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
|
||||
|
||||
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 81.2.17 which includes Chromium 81.0.4044.113.
|
||||
CEF4Delphi uses CEF 81.2.19 which includes Chromium 81.0.4044.113.
|
||||
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
||||
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.17%2Bgb382c62%2Bchromium-81.0.4044.113_windows32.tar.bz2)
|
||||
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.17%2Bgb382c62%2Bchromium-81.0.4044.113_windows64.tar.bz2)
|
||||
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.19%2Bg3b56636%2Bchromium-81.0.4044.113_windows32.tar.bz2)
|
||||
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.19%2Bg3b56636%2Bchromium-81.0.4044.113_windows64.tar.bz2)
|
||||
|
||||
|
||||
CEF4Delphi was developed and tested on Delphi 10.3.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.8/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||
|
@ -129,21 +129,25 @@ type
|
||||
function GetMousePosition(var aPoint : TPointF) : boolean;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
function SendCompMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
|
||||
function ArePointerEventsSupported : boolean;
|
||||
function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
|
||||
function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload;
|
||||
function HandlePointerEvent(const aMessage : TMsg) : boolean;
|
||||
{$ENDIF}
|
||||
|
||||
public
|
||||
procedure DoResize;
|
||||
procedure NotifyMoveOrResizeStarted;
|
||||
procedure SendCaptureLostEvent;
|
||||
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure HandleSYSCHAR(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYDOWN(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYUP(const aMessage : TMsg);
|
||||
function HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
var
|
||||
@ -886,6 +890,61 @@ begin
|
||||
if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
begin
|
||||
case Button of
|
||||
TMouseButton.mbRight : Result := MBT_RIGHT;
|
||||
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
|
||||
else Result := MBT_LEFT;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 1;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := TMouseButton.mbLeft;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
{$ELSE}
|
||||
aCurrentTime := 0;
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.SnapshotBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TFMXExternalPumpBrowserFrm.HandleSYSCHAR(const aMessage : TMsg);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
@ -894,8 +953,8 @@ begin
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.windows_key_code := integer(aMessage.wParam);
|
||||
TempKeyEvent.native_key_code := integer(aMessage.lParam);
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
@ -913,8 +972,8 @@ begin
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.windows_key_code := integer(aMessage.wParam);
|
||||
TempKeyEvent.native_key_code := integer(aMessage.lParam);
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
@ -932,8 +991,8 @@ begin
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.windows_key_code := integer(aMessage.wParam);
|
||||
TempKeyEvent.native_key_code := integer(aMessage.lParam);
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
@ -943,18 +1002,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.ArePointerEventsSupported : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
Result := FAtLeastWin8 and
|
||||
(@GetPointerType <> nil) and
|
||||
(@GetPointerTouchInfo <> nil) and
|
||||
(@GetPointerPenInfo <> nil);
|
||||
{$ELSE}
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
begin
|
||||
Result := Panel1.IsFocused and
|
||||
@ -963,18 +1010,31 @@ begin
|
||||
HandlePointerEvent(aMessage);
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.SendCompMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
var
|
||||
TempHandle : TWinWindowHandle;
|
||||
begin
|
||||
TempHandle := WindowHandleToPlatform(Handle);
|
||||
Result := WinApi.Windows.PostMessage(TempHandle.Wnd, aMsg, aWParam, aLParam);
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.ArePointerEventsSupported : boolean;
|
||||
begin
|
||||
Result := FAtLeastWin8 and
|
||||
(@GetPointerType <> nil) and
|
||||
(@GetPointerTouchInfo <> nil) and
|
||||
(@GetPointerPenInfo <> nil);
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.HandlePointerEvent(const aMessage : TMsg) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
const
|
||||
PT_TOUCH = 2;
|
||||
PT_PEN = 3;
|
||||
var
|
||||
TempID : uint32;
|
||||
TempType : POINTER_INPUT_TYPE;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
{$IFDEF MSWINDOWS}
|
||||
TempID := LoWord(aMessage.wParam);
|
||||
|
||||
if GetPointerType(TempID, @TempType) then
|
||||
@ -982,19 +1042,15 @@ begin
|
||||
PT_PEN : Result := HandlePenEvent(TempID, aMessage.message);
|
||||
PT_TOUCH : Result := HandleTouchEvent(TempID, aMessage.message);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
TempPenInfo : POINTER_PEN_INFO;
|
||||
TempTouchEvent : TCefTouchEvent;
|
||||
TempPoint : TPoint;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
{$IFDEF MSWINDOWS}
|
||||
if not(GetPointerPenInfo(aID, @TempPenInfo)) then exit;
|
||||
|
||||
TempTouchEvent.id := aID;
|
||||
@ -1045,19 +1101,15 @@ begin
|
||||
TempTouchEvent.y := TempPoint.y;
|
||||
|
||||
chrmosr.SendTouchEvent(@TempTouchEvent);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
TempTouchInfo : POINTER_TOUCH_INFO;
|
||||
TempTouchEvent : TCefTouchEvent;
|
||||
TempPoint : TPoint;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
{$IFDEF MSWINDOWS}
|
||||
if not(GetPointerTouchInfo(aID, @TempTouchInfo)) then exit;
|
||||
|
||||
TempTouchEvent.id := aID;
|
||||
@ -1096,76 +1148,7 @@ begin
|
||||
TempTouchEvent.y := TempPoint.y;
|
||||
|
||||
chrmosr.SendTouchEvent(@TempTouchEvent);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
begin
|
||||
case Button of
|
||||
TMouseButton.mbRight : Result := MBT_RIGHT;
|
||||
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
|
||||
else Result := MBT_LEFT;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 1;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := TMouseButton.mbLeft;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
{$ELSE}
|
||||
aCurrentTime := 0;
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.SendCompMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
TempHandle : TWinWindowHandle;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
TempHandle := WindowHandleToPlatform(Handle);
|
||||
Result := WinApi.Windows.PostMessage(TempHandle.Wnd, aMsg, aWParam, aLParam);
|
||||
{$ELSE}
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.SnapshotBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
@ -6,7 +6,7 @@
|
||||
<MainSource>FMXTabbedOSRBrowser.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
</PropertyGroup>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,12 +65,14 @@ type
|
||||
procedure CloseBrowser;
|
||||
procedure ResizeBrowser;
|
||||
procedure FocusBrowser;
|
||||
function PostFormMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
|
||||
procedure SendCaptureLostEvent;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure HandleSYSCHAR(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYDOWN(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYUP(const aMessage : TMsg);
|
||||
function HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
|
||||
{$ENDIF}
|
||||
|
||||
property TabID : cardinal read FTabID;
|
||||
property ParentForm : TCustomForm read GetParentForm;
|
||||
@ -105,46 +107,12 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TBrowserTab.PostFormMessage(aMsg, wParam : cardinal; lParam : integer) : boolean;
|
||||
var
|
||||
TempForm : TCustomForm;
|
||||
begin
|
||||
TempForm := ParentForm;
|
||||
Result := (TempForm <> nil) and
|
||||
(TempForm is TMainForm) and
|
||||
TMainForm(TempForm).PostCustomMessage(aMsg, wParam, lParam);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.SendCaptureLostEvent;
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.HandleSYSCHAR(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSCHAR(aMessage);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.HandleSYSKEYDOWN(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSKEYDOWN(aMessage);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.HandleSYSKEYUP(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSKEYUP(aMessage);
|
||||
end;
|
||||
|
||||
function TBrowserTab.HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
begin
|
||||
Result := (FBrowserFrame <> nil) and
|
||||
FBrowserFrame.HandlePOINTER(aMessage);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.NotifyMoveOrResizeStarted;
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
@ -185,7 +153,9 @@ procedure TBrowserTab.BrowserFrame_OnBrowserDestroyed(Sender: TObject);
|
||||
begin
|
||||
// This event is executed in a CEF thread so we have to send a message to
|
||||
// destroy the tab in the main application thread.
|
||||
{$IFDEF MSWINDOWS}
|
||||
PostFormMessage(CEF_DESTROYTAB, TabID);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.BrowserFrame_OnBrowserTitleChange(Sender: TObject; const aTitle : string);
|
||||
@ -195,7 +165,45 @@ end;
|
||||
|
||||
procedure TBrowserTab.BrowserFrame_OnBrowserNeedsResize(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
PostFormMessage(CEF_PENDINGRESIZE, TabID);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TBrowserTab.HandleSYSCHAR(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSCHAR(aMessage);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.HandleSYSKEYDOWN(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSKEYDOWN(aMessage);
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.HandleSYSKEYUP(const aMessage : TMsg);
|
||||
begin
|
||||
if (FBrowserFrame <> nil) then
|
||||
FBrowserFrame.HandleSYSKEYUP(aMessage);
|
||||
end;
|
||||
|
||||
function TBrowserTab.HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
begin
|
||||
Result := (FBrowserFrame <> nil) and
|
||||
FBrowserFrame.HandlePOINTER(aMessage);
|
||||
end;
|
||||
|
||||
function TBrowserTab.PostFormMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
var
|
||||
TempForm : TCustomForm;
|
||||
begin
|
||||
TempForm := ParentForm;
|
||||
Result := (TempForm <> nil) and
|
||||
(TempForm is TMainForm) and
|
||||
TMainForm(TempForm).PostCustomMessage(aMsg, aWParam, aLParam);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
end.
|
||||
|
@ -146,9 +146,12 @@ begin
|
||||
end;
|
||||
|
||||
function TFMXApplicationService.HandleMessage: Boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
TempMsg : TMsg;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if PeekMessage(TempMsg, 0, 0, 0, PM_NOREMOVE) then
|
||||
case TempMsg.Message of
|
||||
WM_MOVE,
|
||||
@ -211,14 +214,15 @@ begin
|
||||
if not(Application.Terminated) and
|
||||
(Application.MainForm <> nil) and
|
||||
(Application.MainForm is TMainForm) then
|
||||
TMainForm(Application.MainForm).ResizeBrowser(TempMsg.wParam);
|
||||
TMainForm(Application.MainForm).ResizeBrowser(cardinal(TempMsg.wParam));
|
||||
|
||||
CEF_DESTROYTAB :
|
||||
if not(Application.Terminated) and
|
||||
(Application.MainForm <> nil) and
|
||||
(Application.MainForm is TMainForm) then
|
||||
TMainForm(Application.MainForm).DestroyTab(TempMsg.wParam);
|
||||
TMainForm(Application.MainForm).DestroyTab(cardinal(TempMsg.wParam));
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
Result := OldFMXApplicationService.HandleMessage;
|
||||
end;
|
||||
|
@ -97,14 +97,16 @@ type
|
||||
procedure DestroyTab(aTabID : cardinal);
|
||||
procedure ResizeBrowser(aTabID : cardinal);
|
||||
procedure SendCaptureLostEvent;
|
||||
procedure NotifyMoveOrResizeStarted;
|
||||
function GetMousePosition(var aPoint : TPointF) : boolean;
|
||||
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure HandleSYSCHAR(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYDOWN(const aMessage : TMsg);
|
||||
procedure HandleSYSKEYUP(const aMessage : TMsg);
|
||||
function HandlePOINTER(const aMessage : TMsg) : boolean;
|
||||
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
|
||||
procedure NotifyMoveOrResizeStarted;
|
||||
function GetMousePosition(var aPoint : TPointF) : boolean;
|
||||
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
var
|
||||
@ -155,12 +157,16 @@ uses
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
begin
|
||||
if (MainForm <> nil) then MainForm.PostCustomMessage(CEF_INITIALIZED);
|
||||
{$IFDEF MSWINDOWS}
|
||||
if (MainForm <> nil) then
|
||||
MainForm.PostCustomMessage(CEF_INITIALIZED);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
begin
|
||||
if (GlobalFMXWorkScheduler <> nil) then GlobalFMXWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
if (GlobalFMXWorkScheduler <> nil) then
|
||||
GlobalFMXWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
@ -223,7 +229,9 @@ var
|
||||
PositionChanged: Boolean;
|
||||
begin
|
||||
PositionChanged := (ALeft <> Left) or (ATop <> Top);
|
||||
|
||||
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
|
||||
if PositionChanged then
|
||||
NotifyMoveOrResizeStarted;
|
||||
end;
|
||||
@ -347,14 +355,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
var
|
||||
TempHWND : HWND;
|
||||
begin
|
||||
TempHWND := FmxHandleToHWND(Handle);
|
||||
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserTabCtrlChange(Sender: TObject);
|
||||
begin
|
||||
if (BrowserTabCtrl.ActiveTab <> nil) then
|
||||
@ -404,6 +404,7 @@ begin
|
||||
TBrowserTab(BrowserTabCtrl.ActiveTab).SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TMainForm.HandleSYSCHAR(const aMessage : TMsg);
|
||||
begin
|
||||
if (BrowserTabCtrl.ActiveTab <> nil) then
|
||||
@ -428,4 +429,13 @@ begin
|
||||
TBrowserTab(BrowserTabCtrl.ActiveTab).HandlePOINTER(aMessage);
|
||||
end;
|
||||
|
||||
function TMainForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
var
|
||||
TempHWND : HWND;
|
||||
begin
|
||||
TempHWND := FmxHandleToHWND(Handle);
|
||||
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
end.
|
||||
|
@ -2,7 +2,7 @@
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||
// browser in Delphi applications.
|
||||
//
|
||||
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||
@ -10,7 +10,7 @@
|
||||
// For more information about CEF4Delphi visit :
|
||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
//
|
||||
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
|
||||
// Copyright © 2020 Salvador Diaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ vvvv Original license and comments below vvvv *************
|
||||
|
@ -135,11 +135,13 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
object SourceURNLbl: TLabel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 57
|
||||
Height = 13
|
||||
Width = 65
|
||||
Height = 21
|
||||
Align = alClient
|
||||
Caption = 'Source URN'
|
||||
Layout = tlCenter
|
||||
ExplicitWidth = 57
|
||||
ExplicitHeight = 13
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -183,6 +185,7 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
Align = alClient
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 1
|
||||
OnChange = MessageMemChange
|
||||
end
|
||||
end
|
||||
object LogGbx: TGroupBox
|
||||
|
@ -114,6 +114,7 @@ type
|
||||
procedure NotifySinksBtnClick(Sender: TObject);
|
||||
procedure NotifyRoutesBtnClick(Sender: TObject);
|
||||
procedure ClearLogBtnClick(Sender: TObject);
|
||||
procedure MessageMemChange(Sender: TObject);
|
||||
|
||||
protected
|
||||
// Variables to control when can we destroy the form safely
|
||||
@ -139,6 +140,7 @@ type
|
||||
procedure UpdateAvailableSinks;
|
||||
procedure UpdateAvailableRoutes;
|
||||
procedure UpdateButtons;
|
||||
procedure AppendPendingLogStrings;
|
||||
procedure AddLogEntry(const aMessage1, aMessage2 : string; aRec : boolean); overload;
|
||||
procedure AddLogEntry(const aMessage1 : string; const aMessage2 : string = ''); overload;
|
||||
end;
|
||||
@ -165,9 +167,11 @@ begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; //LOGSEVERITY_VERBOSE;
|
||||
{
|
||||
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1AfterCreated(Sender: TObject;
|
||||
@ -202,14 +206,14 @@ begin
|
||||
if (result = CEF_MRCR_OK) then
|
||||
begin
|
||||
TempMsg := 'Route created';
|
||||
if (route <> nil) then TempID := route.ID;
|
||||
if (route <> nil) then TempID := 'Route ID : ' + route.ID;
|
||||
end
|
||||
else
|
||||
TempMsg := error;
|
||||
finally
|
||||
PostMessage(Handle, MEDIA_ROUTER_UPDATE_BUTTONS, 0, 0);
|
||||
FMediaCS.Release;
|
||||
if (length(TempMsg) > 0) then AddLogEntry(TempID, TempMsg);
|
||||
PostMessage(Handle, MEDIA_ROUTER_UPDATE_BUTTONS, 0, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -219,9 +223,9 @@ var
|
||||
TempID : string;
|
||||
begin
|
||||
if (route <> nil) then
|
||||
TempID := route.ID;
|
||||
TempID := 'Route ID : ' + route.ID;
|
||||
|
||||
AddLogEntry(TempID, message_, True);
|
||||
AddLogEntry(TempID, 'Message contents : ' + message_, True);
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1Routes(Sender: TObject;
|
||||
@ -235,14 +239,14 @@ procedure TMediaRouterFrm.Chromium1RouteStateChanged(Sender: TObject;
|
||||
var
|
||||
TempMsg, TempID : string;
|
||||
begin
|
||||
if (route <> nil) then TempID := route.ID;
|
||||
if (route <> nil) then TempID := 'Route ID : ' + route.ID;
|
||||
|
||||
case state of
|
||||
CEF_MRCS_CONNECTING : TempMsg := 'State : Connecting.';
|
||||
CEF_MRCS_CONNECTED : TempMsg := 'State : Connected.';
|
||||
CEF_MRCS_CLOSED : TempMsg := 'State : Closed.';
|
||||
CEF_MRCS_TERMINATED : TempMsg := 'State : Terminated.';
|
||||
else TempMsg := 'State : Unknown.';
|
||||
CEF_MRCS_CONNECTING : TempMsg := 'Route state : Connecting.';
|
||||
CEF_MRCS_CONNECTED : TempMsg := 'Route state : Connected.';
|
||||
CEF_MRCS_CLOSED : TempMsg := 'Route state : Closed.';
|
||||
CEF_MRCS_TERMINATED : TempMsg := 'Route state : Terminated.';
|
||||
else TempMsg := 'Route state : Unknown.';
|
||||
end;
|
||||
|
||||
TempMsg := TempMsg + ' ' + dateTimeToStr(now);
|
||||
@ -299,6 +303,11 @@ begin
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.MessageMemChange(Sender: TObject);
|
||||
begin
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.NotifyRoutesBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.NotifyCurrentRoutes;
|
||||
@ -329,8 +338,9 @@ begin
|
||||
if (length(TempMsg) > 0) and
|
||||
(FRoutes[RoutesLbx.ItemIndex].RouteIntf <> nil) then
|
||||
try
|
||||
TempID := FRoutes[RoutesLbx.ItemIndex].RouteIntf.ID;
|
||||
TempID := 'Route ID : ' + FRoutes[RoutesLbx.ItemIndex].RouteIntf.ID;
|
||||
FRoutes[RoutesLbx.ItemIndex].RouteIntf.SendRouteMessage(TempMsg);
|
||||
TempMsg := 'Message contents : ' + TempMsg;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TMediaRouterFrm.SendMsgBtnClick', e) then raise;
|
||||
@ -390,6 +400,11 @@ procedure TMediaRouterFrm.PendingLogLinesMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if FClosing then exit;
|
||||
|
||||
AppendPendingLogStrings;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.AppendPendingLogStrings;
|
||||
begin
|
||||
try
|
||||
FMediaCS.Acquire;
|
||||
|
||||
@ -408,6 +423,7 @@ begin
|
||||
if FClosing then exit;
|
||||
|
||||
UpdateAvailableSinks;
|
||||
AppendPendingLogStrings;
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
@ -416,6 +432,7 @@ begin
|
||||
if FClosing then exit;
|
||||
|
||||
UpdateAvailableRoutes;
|
||||
AppendPendingLogStrings;
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
@ -423,6 +440,7 @@ procedure TMediaRouterFrm.UpdateButtonsMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if FClosing then exit;
|
||||
|
||||
AppendPendingLogStrings;
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<MainSource>PopupBrowser.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
</PropertyGroup>
|
||||
|
@ -4,11 +4,11 @@
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="4">
|
||||
<Units Count="7">
|
||||
<Unit0>
|
||||
<Filename Value="PopupBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="42"/>
|
||||
<CursorPos X="54" Y="47"/>
|
||||
<UsageCount Value="22"/>
|
||||
@ -21,9 +21,8 @@
|
||||
<ComponentName Value="MainForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="122"/>
|
||||
<CursorPos X="31" Y="143"/>
|
||||
<CursorPos X="105" Y="139"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -35,9 +34,10 @@
|
||||
<ComponentName Value="ChildForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="882"/>
|
||||
<CursorPos X="78" Y="906"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="109"/>
|
||||
<CursorPos X="15" Y="122"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="64" Y="173" ID="2"/>
|
||||
@ -55,8 +55,30 @@
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="1751"/>
|
||||
<CursorPos X="2" Y="1772"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\inc\ustringh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="119"/>
|
||||
<CursorPos X="10" Y="134"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\inc\systemh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="421"/>
|
||||
<CursorPos X="3" Y="436"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit6>
|
||||
</Units>
|
||||
<JumpHistory Count="20" HistoryIndex="19">
|
||||
<JumpHistory Count="23" HistoryIndex="22">
|
||||
<Position1>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="81" Column="34" TopLine="68"/>
|
||||
@ -137,6 +159,18 @@
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="340" Column="22" TopLine="332"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/>
|
||||
<Caret Line="244" Column="22" TopLine="223"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="uChildForm.pas"/>
|
||||
<Caret Line="906" Column="78" TopLine="882"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/>
|
||||
<Caret Line="1761" Column="30" TopLine="1751"/>
|
||||
</Position23>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
Binary file not shown.
@ -21,7 +21,7 @@
|
||||
</CompilerOptions>
|
||||
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
|
||||
<License Value="MPL 1.1"/>
|
||||
<Version Major="81" Minor="2" Release="17"/>
|
||||
<Version Major="81" Minor="2" Release="19"/>
|
||||
<Files Count="154">
|
||||
<Item1>
|
||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
|
@ -62,7 +62,7 @@ uses
|
||||
const
|
||||
CEF_SUPPORTED_VERSION_MAJOR = 81;
|
||||
CEF_SUPPORTED_VERSION_MINOR = 2;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 17;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 19;
|
||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||
|
||||
CEF_CHROMEELF_VERSION_MAJOR = 81;
|
||||
|
@ -198,17 +198,25 @@ procedure cef_media_observer_on_route_message_received( self : PCef
|
||||
message_size : NativeUInt); stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
TempMessage : Ansistring;
|
||||
TempAnsiMsg : Ansistring;
|
||||
TempMsg : ustring;
|
||||
begin
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
|
||||
begin
|
||||
if (message_size > 0) and (message_ <> nil) then
|
||||
SetString(TempMessage, PAnsiChar(message_), message_size);
|
||||
begin
|
||||
SetString(TempAnsiMsg, PAnsiChar(message_), message_size);
|
||||
{$IFDEF DELPHI12_UP}
|
||||
TempMsg := Utf8ToString(TempAnsiMsg);
|
||||
{$ELSE}
|
||||
TempMsg := Utf8Decode(TempAnsiMsg);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
TCefMediaObserverOwn(TempObject).OnRouteMessageReceived(TCefMediaRouteRef.UnWrap(route),
|
||||
ustring(TempMessage));
|
||||
TempMsg);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -85,17 +85,23 @@ end;
|
||||
|
||||
procedure TCefMediaRouteRef.SendRouteMessage(const message_: ustring);
|
||||
var
|
||||
TempMsg : pointer;
|
||||
TempSize : NativeUInt;
|
||||
TempMsgPtr : pointer;
|
||||
TempMsg : AnsiString;
|
||||
TempSize : NativeUInt;
|
||||
begin
|
||||
TempSize := length(message_);
|
||||
|
||||
if (TempSize > 0) then
|
||||
TempMsg := @message_[1]
|
||||
begin
|
||||
TempMsg := Utf8Encode(message_);
|
||||
TempMsgPtr := @TempMsg[1];
|
||||
end
|
||||
else
|
||||
TempMsg := nil;
|
||||
TempMsgPtr := nil;
|
||||
|
||||
PCefMediaRoute(FData)^.send_route_message(PCefMediaRoute(FData), TempMsg, TempSize);
|
||||
PCefMediaRoute(FData)^.send_route_message(PCefMediaRoute(FData),
|
||||
TempMsgPtr,
|
||||
TempSize);
|
||||
end;
|
||||
|
||||
procedure TCefMediaRouteRef.Terminate;
|
||||
|
@ -2,9 +2,9 @@
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 120,
|
||||
"InternalVersion" : 121,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "81.2.17.0"
|
||||
"Version" : "81.2.19.0"
|
||||
}
|
||||
],
|
||||
"UpdatePackageData" : {
|
||||
|
Loading…
Reference in New Issue
Block a user