1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-04-17 06:57:13 +02:00

Update to CEF 81.2.19

This commit is contained in:
Salvador Díaz Fau 2020-04-21 13:27:34 +02:00
parent 9a0c782064
commit dce556683a
18 changed files with 1315 additions and 1229 deletions

View File

@ -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 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 : 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) * [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.17%2Bgb382c62%2Bchromium-81.0.4044.113_windows64.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. 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.

View File

@ -129,21 +129,25 @@ type
function GetMousePosition(var aPoint : TPointF) : boolean; function GetMousePosition(var aPoint : TPointF) : boolean;
procedure InitializeLastClick; procedure InitializeLastClick;
function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean; function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
{$IFDEF MSWINDOWS}
function SendCompMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean; function SendCompMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
function ArePointerEventsSupported : boolean; function ArePointerEventsSupported : boolean;
function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean; function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload; function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload;
function HandlePointerEvent(const aMessage : TMsg) : boolean; function HandlePointerEvent(const aMessage : TMsg) : boolean;
{$ENDIF}
public public
procedure DoResize; procedure DoResize;
procedure NotifyMoveOrResizeStarted; procedure NotifyMoveOrResizeStarted;
procedure SendCaptureLostEvent; procedure SendCaptureLostEvent;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
{$IFDEF MSWINDOWS}
procedure HandleSYSCHAR(const aMessage : TMsg); procedure HandleSYSCHAR(const aMessage : TMsg);
procedure HandleSYSKEYDOWN(const aMessage : TMsg); procedure HandleSYSKEYDOWN(const aMessage : TMsg);
procedure HandleSYSKEYUP(const aMessage : TMsg); procedure HandleSYSKEYUP(const aMessage : TMsg);
function HandlePOINTER(const aMessage : TMsg) : boolean; function HandlePOINTER(const aMessage : TMsg) : boolean;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override; {$ENDIF}
end; end;
var var
@ -886,6 +890,61 @@ begin
if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent; if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent;
end; 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); procedure TFMXExternalPumpBrowserFrm.HandleSYSCHAR(const aMessage : TMsg);
var var
TempKeyEvent : TCefKeyEvent; TempKeyEvent : TCefKeyEvent;
@ -894,8 +953,8 @@ begin
begin begin
TempKeyEvent.kind := KEYEVENT_CHAR; TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
TempKeyEvent.windows_key_code := aMessage.wParam; TempKeyEvent.windows_key_code := integer(aMessage.wParam);
TempKeyEvent.native_key_code := aMessage.lParam; TempKeyEvent.native_key_code := integer(aMessage.lParam);
TempKeyEvent.is_system_key := ord(True); TempKeyEvent.is_system_key := ord(True);
TempKeyEvent.character := #0; TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0; TempKeyEvent.unmodified_character := #0;
@ -913,8 +972,8 @@ begin
begin begin
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN; TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
TempKeyEvent.windows_key_code := aMessage.wParam; TempKeyEvent.windows_key_code := integer(aMessage.wParam);
TempKeyEvent.native_key_code := aMessage.lParam; TempKeyEvent.native_key_code := integer(aMessage.lParam);
TempKeyEvent.is_system_key := ord(True); TempKeyEvent.is_system_key := ord(True);
TempKeyEvent.character := #0; TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0; TempKeyEvent.unmodified_character := #0;
@ -932,8 +991,8 @@ begin
begin begin
TempKeyEvent.kind := KEYEVENT_KEYUP; TempKeyEvent.kind := KEYEVENT_KEYUP;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
TempKeyEvent.windows_key_code := aMessage.wParam; TempKeyEvent.windows_key_code := integer(aMessage.wParam);
TempKeyEvent.native_key_code := aMessage.lParam; TempKeyEvent.native_key_code := integer(aMessage.lParam);
TempKeyEvent.is_system_key := ord(True); TempKeyEvent.is_system_key := ord(True);
TempKeyEvent.character := #0; TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0; TempKeyEvent.unmodified_character := #0;
@ -943,18 +1002,6 @@ begin
end; end;
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; function TFMXExternalPumpBrowserFrm.HandlePOINTER(const aMessage : TMsg) : boolean;
begin begin
Result := Panel1.IsFocused and Result := Panel1.IsFocused and
@ -963,18 +1010,31 @@ begin
HandlePointerEvent(aMessage); HandlePointerEvent(aMessage);
end; 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; function TFMXExternalPumpBrowserFrm.HandlePointerEvent(const aMessage : TMsg) : boolean;
{$IFDEF MSWINDOWS}
const const
PT_TOUCH = 2; PT_TOUCH = 2;
PT_PEN = 3; PT_PEN = 3;
var var
TempID : uint32; TempID : uint32;
TempType : POINTER_INPUT_TYPE; TempType : POINTER_INPUT_TYPE;
{$ENDIF}
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
TempID := LoWord(aMessage.wParam); TempID := LoWord(aMessage.wParam);
if GetPointerType(TempID, @TempType) then if GetPointerType(TempID, @TempType) then
@ -982,19 +1042,15 @@ begin
PT_PEN : Result := HandlePenEvent(TempID, aMessage.message); PT_PEN : Result := HandlePenEvent(TempID, aMessage.message);
PT_TOUCH : Result := HandleTouchEvent(TempID, aMessage.message); PT_TOUCH : Result := HandleTouchEvent(TempID, aMessage.message);
end; end;
{$ENDIF}
end; end;
function TFMXExternalPumpBrowserFrm.HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean; function TFMXExternalPumpBrowserFrm.HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
{$IFDEF MSWINDOWS}
var var
TempPenInfo : POINTER_PEN_INFO; TempPenInfo : POINTER_PEN_INFO;
TempTouchEvent : TCefTouchEvent; TempTouchEvent : TCefTouchEvent;
TempPoint : TPoint; TempPoint : TPoint;
{$ENDIF}
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
if not(GetPointerPenInfo(aID, @TempPenInfo)) then exit; if not(GetPointerPenInfo(aID, @TempPenInfo)) then exit;
TempTouchEvent.id := aID; TempTouchEvent.id := aID;
@ -1045,19 +1101,15 @@ begin
TempTouchEvent.y := TempPoint.y; TempTouchEvent.y := TempPoint.y;
chrmosr.SendTouchEvent(@TempTouchEvent); chrmosr.SendTouchEvent(@TempTouchEvent);
{$ENDIF}
end; end;
function TFMXExternalPumpBrowserFrm.HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; function TFMXExternalPumpBrowserFrm.HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean;
{$IFDEF MSWINDOWS}
var var
TempTouchInfo : POINTER_TOUCH_INFO; TempTouchInfo : POINTER_TOUCH_INFO;
TempTouchEvent : TCefTouchEvent; TempTouchEvent : TCefTouchEvent;
TempPoint : TPoint; TempPoint : TPoint;
{$ENDIF}
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
if not(GetPointerTouchInfo(aID, @TempTouchInfo)) then exit; if not(GetPointerTouchInfo(aID, @TempTouchInfo)) then exit;
TempTouchEvent.id := aID; TempTouchEvent.id := aID;
@ -1096,76 +1148,7 @@ begin
TempTouchEvent.y := TempPoint.y; TempTouchEvent.y := TempPoint.y;
chrmosr.SendTouchEvent(@TempTouchEvent); chrmosr.SendTouchEvent(@TempTouchEvent);
{$ENDIF}
end; 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} {$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. end.

View File

@ -6,7 +6,7 @@
<MainSource>FMXTabbedOSRBrowser.dpr</MainSource> <MainSource>FMXTabbedOSRBrowser.dpr</MainSource>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config> <Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform> <Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms> <TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
</PropertyGroup> </PropertyGroup>

View File

@ -129,11 +129,13 @@ type
function GetMousePosition(var aPoint : TPointF) : boolean; function GetMousePosition(var aPoint : TPointF) : boolean;
procedure InitializeLastClick; procedure InitializeLastClick;
function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean; function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
function PostFormMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean; {$IFDEF MSWINDOWS}
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
function ArePointerEventsSupported : boolean; function ArePointerEventsSupported : boolean;
function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean; function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload; function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload;
function HandlePointerEvent(const aMessage : TMsg) : boolean; function HandlePointerEvent(const aMessage : TMsg) : boolean;
{$ENDIF}
public public
constructor Create(AOwner : TComponent); override; constructor Create(AOwner : TComponent); override;
@ -141,10 +143,12 @@ type
procedure NotifyMoveOrResizeStarted; procedure NotifyMoveOrResizeStarted;
procedure SendCaptureLostEvent; procedure SendCaptureLostEvent;
{$IFDEF MSWINDOWS}
procedure HandleSYSCHAR(const aMessage : TMsg); procedure HandleSYSCHAR(const aMessage : TMsg);
procedure HandleSYSKEYDOWN(const aMessage : TMsg); procedure HandleSYSKEYDOWN(const aMessage : TMsg);
procedure HandleSYSKEYUP(const aMessage : TMsg); procedure HandleSYSKEYUP(const aMessage : TMsg);
function HandlePOINTER(const aMessage : TMsg) : boolean; function HandlePOINTER(const aMessage : TMsg) : boolean;
{$ENDIF}
procedure CreateBrowser; procedure CreateBrowser;
procedure CloseBrowser; procedure CloseBrowser;
@ -250,64 +254,7 @@ begin
FMXChromium1.SendCaptureLostEvent; FMXChromium1.SendCaptureLostEvent;
end; end;
procedure TBrowserFrame.HandleSYSCHAR(const aMessage : TMsg); procedure TBrowserFrame.StopBtnClick(Sender: TObject);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
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.is_system_key := ord(True);
TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
procedure TBrowserFrame.HandleSYSKEYDOWN(const aMessage : TMsg);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
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.is_system_key := ord(True);
TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
procedure TBrowserFrame.HandleSYSKEYUP(const aMessage : TMsg);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
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.is_system_key := ord(True);
TempKeyEvent.character := #0;
TempKeyEvent.unmodified_character := #0;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
procedure TBrowserFrame.StopBtnClick(Sender: TObject);
begin begin
FMXChromium1.StopLoad; FMXChromium1.StopLoad;
end; end;
@ -932,14 +879,20 @@ end;
function TBrowserFrame.CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean; function TBrowserFrame.CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
begin begin
{$IFDEF MSWINDOWS}
aCurrentTime := GetMessageTime; aCurrentTime := GetMessageTime;
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or (abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime); (cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
{$ELSE}
aCurrentTime := 0;
Result := False;
{$ENDIF}
end; end;
function TBrowserFrame.PostFormMessage(aMsg, wParam : cardinal; lParam : integer) : boolean; {$IFDEF MSWINDOWS}
function TBrowserFrame.PostFormMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
var var
TempTab : TTabItem; TempTab : TTabItem;
@ -947,7 +900,7 @@ begin
TempTab := ParentTab; TempTab := ParentTab;
Result := (TempTab <> nil) and Result := (TempTab <> nil) and
(TempTab is TBrowserTab) and (TempTab is TBrowserTab) and
TBrowserTab(TempTab).PostFormMessage(aMsg, wParam, lParam); TBrowserTab(TempTab).PostFormMessage(aMsg, aWParam, aLParam);
end; end;
function TBrowserFrame.ArePointerEventsSupported : boolean; function TBrowserFrame.ArePointerEventsSupported : boolean;
@ -958,14 +911,6 @@ begin
(@GetPointerPenInfo <> nil); (@GetPointerPenInfo <> nil);
end; end;
function TBrowserFrame.HandlePOINTER(const aMessage : TMsg) : boolean;
begin
Result := FMXBufferPanel1.IsFocused and
(GlobalCEFApp <> nil) and
ArePointerEventsSupported and
HandlePointerEvent(aMessage);
end;
function TBrowserFrame.HandlePointerEvent(const aMessage : TMsg) : boolean; function TBrowserFrame.HandlePointerEvent(const aMessage : TMsg) : boolean;
const const
PT_TOUCH = 2; PT_TOUCH = 2;
@ -1092,4 +1037,71 @@ begin
FMXChromium1.SendTouchEvent(@TempTouchEvent); FMXChromium1.SendTouchEvent(@TempTouchEvent);
end; end;
procedure TBrowserFrame.HandleSYSCHAR(const aMessage : TMsg);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
begin
TempKeyEvent.kind := KEYEVENT_CHAR;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, 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;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
procedure TBrowserFrame.HandleSYSKEYDOWN(const aMessage : TMsg);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
begin
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, 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;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
procedure TBrowserFrame.HandleSYSKEYUP(const aMessage : TMsg);
var
TempKeyEvent : TCefKeyEvent;
begin
if FMXBufferPanel1.IsFocused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
begin
TempKeyEvent.kind := KEYEVENT_KEYUP;
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, 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;
TempKeyEvent.focus_on_editable_field := ord(False);
FMXChromium1.SendKeyEvent(@TempKeyEvent);
end;
end;
function TBrowserFrame.HandlePOINTER(const aMessage : TMsg) : boolean;
begin
Result := FMXBufferPanel1.IsFocused and
(GlobalCEFApp <> nil) and
ArePointerEventsSupported and
HandlePointerEvent(aMessage);
end;
{$ENDIF}
end. end.

View File

@ -65,12 +65,14 @@ type
procedure CloseBrowser; procedure CloseBrowser;
procedure ResizeBrowser; procedure ResizeBrowser;
procedure FocusBrowser; procedure FocusBrowser;
function PostFormMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
procedure SendCaptureLostEvent; procedure SendCaptureLostEvent;
{$IFDEF MSWINDOWS}
procedure HandleSYSCHAR(const aMessage : TMsg); procedure HandleSYSCHAR(const aMessage : TMsg);
procedure HandleSYSKEYDOWN(const aMessage : TMsg); procedure HandleSYSKEYDOWN(const aMessage : TMsg);
procedure HandleSYSKEYUP(const aMessage : TMsg); procedure HandleSYSKEYUP(const aMessage : TMsg);
function HandlePOINTER(const aMessage : TMsg) : boolean; function HandlePOINTER(const aMessage : TMsg) : boolean;
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
{$ENDIF}
property TabID : cardinal read FTabID; property TabID : cardinal read FTabID;
property ParentForm : TCustomForm read GetParentForm; property ParentForm : TCustomForm read GetParentForm;
@ -105,46 +107,12 @@ begin
Result := nil; Result := nil;
end; 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; procedure TBrowserTab.SendCaptureLostEvent;
begin begin
if (FBrowserFrame <> nil) then if (FBrowserFrame <> nil) then
FBrowserFrame.SendCaptureLostEvent; FBrowserFrame.SendCaptureLostEvent;
end; 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; procedure TBrowserTab.NotifyMoveOrResizeStarted;
begin begin
if (FBrowserFrame <> nil) then if (FBrowserFrame <> nil) then
@ -185,7 +153,9 @@ procedure TBrowserTab.BrowserFrame_OnBrowserDestroyed(Sender: TObject);
begin begin
// This event is executed in a CEF thread so we have to send a message to // This event is executed in a CEF thread so we have to send a message to
// destroy the tab in the main application thread. // destroy the tab in the main application thread.
{$IFDEF MSWINDOWS}
PostFormMessage(CEF_DESTROYTAB, TabID); PostFormMessage(CEF_DESTROYTAB, TabID);
{$ENDIF}
end; end;
procedure TBrowserTab.BrowserFrame_OnBrowserTitleChange(Sender: TObject; const aTitle : string); procedure TBrowserTab.BrowserFrame_OnBrowserTitleChange(Sender: TObject; const aTitle : string);
@ -195,7 +165,45 @@ end;
procedure TBrowserTab.BrowserFrame_OnBrowserNeedsResize(Sender: TObject); procedure TBrowserTab.BrowserFrame_OnBrowserNeedsResize(Sender: TObject);
begin begin
{$IFDEF MSWINDOWS}
PostFormMessage(CEF_PENDINGRESIZE, TabID); PostFormMessage(CEF_PENDINGRESIZE, TabID);
{$ENDIF}
end; 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. end.

View File

@ -146,9 +146,12 @@ begin
end; end;
function TFMXApplicationService.HandleMessage: Boolean; function TFMXApplicationService.HandleMessage: Boolean;
{$IFDEF MSWINDOWS}
var var
TempMsg : TMsg; TempMsg : TMsg;
{$ENDIF}
begin begin
{$IFDEF MSWINDOWS}
if PeekMessage(TempMsg, 0, 0, 0, PM_NOREMOVE) then if PeekMessage(TempMsg, 0, 0, 0, PM_NOREMOVE) then
case TempMsg.Message of case TempMsg.Message of
WM_MOVE, WM_MOVE,
@ -211,14 +214,15 @@ begin
if not(Application.Terminated) and if not(Application.Terminated) and
(Application.MainForm <> nil) and (Application.MainForm <> nil) and
(Application.MainForm is TMainForm) then (Application.MainForm is TMainForm) then
TMainForm(Application.MainForm).ResizeBrowser(TempMsg.wParam); TMainForm(Application.MainForm).ResizeBrowser(cardinal(TempMsg.wParam));
CEF_DESTROYTAB : CEF_DESTROYTAB :
if not(Application.Terminated) and if not(Application.Terminated) and
(Application.MainForm <> nil) and (Application.MainForm <> nil) and
(Application.MainForm is TMainForm) then (Application.MainForm is TMainForm) then
TMainForm(Application.MainForm).DestroyTab(TempMsg.wParam); TMainForm(Application.MainForm).DestroyTab(cardinal(TempMsg.wParam));
end; end;
{$ENDIF}
Result := OldFMXApplicationService.HandleMessage; Result := OldFMXApplicationService.HandleMessage;
end; end;

View File

@ -97,14 +97,16 @@ type
procedure DestroyTab(aTabID : cardinal); procedure DestroyTab(aTabID : cardinal);
procedure ResizeBrowser(aTabID : cardinal); procedure ResizeBrowser(aTabID : cardinal);
procedure SendCaptureLostEvent; 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 HandleSYSCHAR(const aMessage : TMsg);
procedure HandleSYSKEYDOWN(const aMessage : TMsg); procedure HandleSYSKEYDOWN(const aMessage : TMsg);
procedure HandleSYSKEYUP(const aMessage : TMsg); procedure HandleSYSKEYUP(const aMessage : TMsg);
function HandlePOINTER(const aMessage : TMsg) : boolean; function HandlePOINTER(const aMessage : TMsg) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean; function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure NotifyMoveOrResizeStarted; {$ENDIF}
function GetMousePosition(var aPoint : TPointF) : boolean;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
end; end;
var var
@ -155,12 +157,16 @@ uses
procedure GlobalCEFApp_OnContextInitialized; procedure GlobalCEFApp_OnContextInitialized;
begin begin
if (MainForm <> nil) then MainForm.PostCustomMessage(CEF_INITIALIZED); {$IFDEF MSWINDOWS}
if (MainForm <> nil) then
MainForm.PostCustomMessage(CEF_INITIALIZED);
{$ENDIF}
end; end;
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64); procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
begin begin
if (GlobalFMXWorkScheduler <> nil) then GlobalFMXWorkScheduler.ScheduleMessagePumpWork(aDelayMS); if (GlobalFMXWorkScheduler <> nil) then
GlobalFMXWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
end; end;
procedure CreateGlobalCEFApp; procedure CreateGlobalCEFApp;
@ -223,7 +229,9 @@ var
PositionChanged: Boolean; PositionChanged: Boolean;
begin begin
PositionChanged := (ALeft <> Left) or (ATop <> Top); PositionChanged := (ALeft <> Left) or (ATop <> Top);
inherited SetBounds(ALeft, ATop, AWidth, AHeight); inherited SetBounds(ALeft, ATop, AWidth, AHeight);
if PositionChanged then if PositionChanged then
NotifyMoveOrResizeStarted; NotifyMoveOrResizeStarted;
end; end;
@ -347,14 +355,6 @@ begin
end; end;
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); procedure TMainForm.BrowserTabCtrlChange(Sender: TObject);
begin begin
if (BrowserTabCtrl.ActiveTab <> nil) then if (BrowserTabCtrl.ActiveTab <> nil) then
@ -404,6 +404,7 @@ begin
TBrowserTab(BrowserTabCtrl.ActiveTab).SendCaptureLostEvent; TBrowserTab(BrowserTabCtrl.ActiveTab).SendCaptureLostEvent;
end; end;
{$IFDEF MSWINDOWS}
procedure TMainForm.HandleSYSCHAR(const aMessage : TMsg); procedure TMainForm.HandleSYSCHAR(const aMessage : TMsg);
begin begin
if (BrowserTabCtrl.ActiveTab <> nil) then if (BrowserTabCtrl.ActiveTab <> nil) then
@ -428,4 +429,13 @@ begin
TBrowserTab(BrowserTabCtrl.ActiveTab).HandlePOINTER(aMessage); TBrowserTab(BrowserTabCtrl.ActiveTab).HandlePOINTER(aMessage);
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;
{$ENDIF}
end. end.

View File

@ -2,7 +2,7 @@
// ***************************** CEF4Delphi ******************************* // ***************************** 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. // browser in Delphi applications.
// //
// The original license of DCEF3 still applies to CEF4Delphi. // The original license of DCEF3 still applies to CEF4Delphi.
@ -10,7 +10,7 @@
// For more information about CEF4Delphi visit : // For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef // https://www.briskbard.com/index.php?lang=en&pageid=cef
// //
// Copyright © 2018 Salvador az Fau. All rights reserved. // Copyright © 2020 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@ -135,11 +135,13 @@ object MediaRouterFrm: TMediaRouterFrm
object SourceURNLbl: TLabel object SourceURNLbl: TLabel
Left = 0 Left = 0
Top = 0 Top = 0
Width = 57 Width = 65
Height = 13 Height = 21
Align = alClient Align = alClient
Caption = 'Source URN' Caption = 'Source URN'
Layout = tlCenter Layout = tlCenter
ExplicitWidth = 57
ExplicitHeight = 13
end end
end end
end end
@ -183,6 +185,7 @@ object MediaRouterFrm: TMediaRouterFrm
Align = alClient Align = alClient
ScrollBars = ssBoth ScrollBars = ssBoth
TabOrder = 1 TabOrder = 1
OnChange = MessageMemChange
end end
end end
object LogGbx: TGroupBox object LogGbx: TGroupBox

View File

@ -114,6 +114,7 @@ type
procedure NotifySinksBtnClick(Sender: TObject); procedure NotifySinksBtnClick(Sender: TObject);
procedure NotifyRoutesBtnClick(Sender: TObject); procedure NotifyRoutesBtnClick(Sender: TObject);
procedure ClearLogBtnClick(Sender: TObject); procedure ClearLogBtnClick(Sender: TObject);
procedure MessageMemChange(Sender: TObject);
protected protected
// Variables to control when can we destroy the form safely // Variables to control when can we destroy the form safely
@ -139,6 +140,7 @@ type
procedure UpdateAvailableSinks; procedure UpdateAvailableSinks;
procedure UpdateAvailableRoutes; procedure UpdateAvailableRoutes;
procedure UpdateButtons; procedure UpdateButtons;
procedure AppendPendingLogStrings;
procedure AddLogEntry(const aMessage1, aMessage2 : string; aRec : boolean); overload; procedure AddLogEntry(const aMessage1, aMessage2 : string; aRec : boolean); overload;
procedure AddLogEntry(const aMessage1 : string; const aMessage2 : string = ''); overload; procedure AddLogEntry(const aMessage1 : string; const aMessage2 : string = ''); overload;
end; end;
@ -165,9 +167,11 @@ begin
GlobalCEFApp := TCefApplication.Create; GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; //LOGSEVERITY_VERBOSE; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; //LOGSEVERITY_VERBOSE;
{
GlobalCEFApp.FrameworkDirPath := 'c:\cef'; GlobalCEFApp.FrameworkDirPath := 'c:\cef';
GlobalCEFApp.ResourcesDirPath := 'c:\cef'; GlobalCEFApp.ResourcesDirPath := 'c:\cef';
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales'; GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
}
end; end;
procedure TMediaRouterFrm.Chromium1AfterCreated(Sender: TObject; procedure TMediaRouterFrm.Chromium1AfterCreated(Sender: TObject;
@ -202,14 +206,14 @@ begin
if (result = CEF_MRCR_OK) then if (result = CEF_MRCR_OK) then
begin begin
TempMsg := 'Route created'; TempMsg := 'Route created';
if (route <> nil) then TempID := route.ID; if (route <> nil) then TempID := 'Route ID : ' + route.ID;
end end
else else
TempMsg := error; TempMsg := error;
finally finally
PostMessage(Handle, MEDIA_ROUTER_UPDATE_BUTTONS, 0, 0);
FMediaCS.Release; FMediaCS.Release;
if (length(TempMsg) > 0) then AddLogEntry(TempID, TempMsg); if (length(TempMsg) > 0) then AddLogEntry(TempID, TempMsg);
PostMessage(Handle, MEDIA_ROUTER_UPDATE_BUTTONS, 0, 0);
end; end;
end; end;
@ -219,9 +223,9 @@ var
TempID : string; TempID : string;
begin begin
if (route <> nil) then if (route <> nil) then
TempID := route.ID; TempID := 'Route ID : ' + route.ID;
AddLogEntry(TempID, message_, True); AddLogEntry(TempID, 'Message contents : ' + message_, True);
end; end;
procedure TMediaRouterFrm.Chromium1Routes(Sender: TObject; procedure TMediaRouterFrm.Chromium1Routes(Sender: TObject;
@ -235,14 +239,14 @@ procedure TMediaRouterFrm.Chromium1RouteStateChanged(Sender: TObject;
var var
TempMsg, TempID : string; TempMsg, TempID : string;
begin begin
if (route <> nil) then TempID := route.ID; if (route <> nil) then TempID := 'Route ID : ' + route.ID;
case state of case state of
CEF_MRCS_CONNECTING : TempMsg := 'State : Connecting.'; CEF_MRCS_CONNECTING : TempMsg := 'Route state : Connecting.';
CEF_MRCS_CONNECTED : TempMsg := 'State : Connected.'; CEF_MRCS_CONNECTED : TempMsg := 'Route state : Connected.';
CEF_MRCS_CLOSED : TempMsg := 'State : Closed.'; CEF_MRCS_CLOSED : TempMsg := 'Route state : Closed.';
CEF_MRCS_TERMINATED : TempMsg := 'State : Terminated.'; CEF_MRCS_TERMINATED : TempMsg := 'Route state : Terminated.';
else TempMsg := 'State : Unknown.'; else TempMsg := 'Route state : Unknown.';
end; end;
TempMsg := TempMsg + ' ' + dateTimeToStr(now); TempMsg := TempMsg + ' ' + dateTimeToStr(now);
@ -299,6 +303,11 @@ begin
Timer1.Enabled := True; Timer1.Enabled := True;
end; end;
procedure TMediaRouterFrm.MessageMemChange(Sender: TObject);
begin
UpdateButtons;
end;
procedure TMediaRouterFrm.NotifyRoutesBtnClick(Sender: TObject); procedure TMediaRouterFrm.NotifyRoutesBtnClick(Sender: TObject);
begin begin
Chromium1.NotifyCurrentRoutes; Chromium1.NotifyCurrentRoutes;
@ -329,8 +338,9 @@ begin
if (length(TempMsg) > 0) and if (length(TempMsg) > 0) and
(FRoutes[RoutesLbx.ItemIndex].RouteIntf <> nil) then (FRoutes[RoutesLbx.ItemIndex].RouteIntf <> nil) then
try try
TempID := FRoutes[RoutesLbx.ItemIndex].RouteIntf.ID; TempID := 'Route ID : ' + FRoutes[RoutesLbx.ItemIndex].RouteIntf.ID;
FRoutes[RoutesLbx.ItemIndex].RouteIntf.SendRouteMessage(TempMsg); FRoutes[RoutesLbx.ItemIndex].RouteIntf.SendRouteMessage(TempMsg);
TempMsg := 'Message contents : ' + TempMsg;
except except
on e : exception do on e : exception do
if CustomExceptionHandler('TMediaRouterFrm.SendMsgBtnClick', e) then raise; if CustomExceptionHandler('TMediaRouterFrm.SendMsgBtnClick', e) then raise;
@ -390,6 +400,11 @@ procedure TMediaRouterFrm.PendingLogLinesMsg(var aMessage : TMessage);
begin begin
if FClosing then exit; if FClosing then exit;
AppendPendingLogStrings;
end;
procedure TMediaRouterFrm.AppendPendingLogStrings;
begin
try try
FMediaCS.Acquire; FMediaCS.Acquire;
@ -408,6 +423,7 @@ begin
if FClosing then exit; if FClosing then exit;
UpdateAvailableSinks; UpdateAvailableSinks;
AppendPendingLogStrings;
UpdateButtons; UpdateButtons;
end; end;
@ -416,6 +432,7 @@ begin
if FClosing then exit; if FClosing then exit;
UpdateAvailableRoutes; UpdateAvailableRoutes;
AppendPendingLogStrings;
UpdateButtons; UpdateButtons;
end; end;
@ -423,6 +440,7 @@ procedure TMediaRouterFrm.UpdateButtonsMsg(var aMessage : TMessage);
begin begin
if FClosing then exit; if FClosing then exit;
AppendPendingLogStrings;
UpdateButtons; UpdateButtons;
end; end;

View File

@ -6,7 +6,7 @@
<MainSource>PopupBrowser.dpr</MainSource> <MainSource>PopupBrowser.dpr</MainSource>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config> <Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform> <Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms> <TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
</PropertyGroup> </PropertyGroup>

View File

@ -4,11 +4,11 @@
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="11"/> <Version Value="11"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="4"> <Units Count="7">
<Unit0> <Unit0>
<Filename Value="PopupBrowser.lpr"/> <Filename Value="PopupBrowser.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="2"/> <EditorIndex Value="3"/>
<TopLine Value="42"/> <TopLine Value="42"/>
<CursorPos X="54" Y="47"/> <CursorPos X="54" Y="47"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
@ -21,9 +21,8 @@
<ComponentName Value="MainForm"/> <ComponentName Value="MainForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="122"/> <TopLine Value="122"/>
<CursorPos X="31" Y="143"/> <CursorPos X="105" Y="139"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@ -35,9 +34,10 @@
<ComponentName Value="ChildForm"/> <ComponentName Value="ChildForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<EditorIndex Value="1"/> <IsVisibleTab Value="True"/>
<TopLine Value="882"/> <EditorIndex Value="2"/>
<CursorPos X="78" Y="906"/> <TopLine Value="109"/>
<CursorPos X="15" Y="122"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
<Bookmarks Count="2"> <Bookmarks Count="2">
<Item0 X="64" Y="173" ID="2"/> <Item0 X="64" Y="173" ID="2"/>
@ -55,8 +55,30 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
<DefaultSyntaxHighlighter Value="Delphi"/> <DefaultSyntaxHighlighter Value="Delphi"/>
</Unit3> </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> </Units>
<JumpHistory Count="20" HistoryIndex="19"> <JumpHistory Count="23" HistoryIndex="22">
<Position1> <Position1>
<Filename Value="uMainForm.pas"/> <Filename Value="uMainForm.pas"/>
<Caret Line="81" Column="34" TopLine="68"/> <Caret Line="81" Column="34" TopLine="68"/>
@ -137,6 +159,18 @@
<Filename Value="uMainForm.pas"/> <Filename Value="uMainForm.pas"/>
<Caret Line="340" Column="22" TopLine="332"/> <Caret Line="340" Column="22" TopLine="332"/>
</Position20> </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> </JumpHistory>
<RunParams> <RunParams>
<FormatVersion Value="2"/> <FormatVersion Value="2"/>

Binary file not shown.

View File

@ -21,7 +21,7 @@
</CompilerOptions> </CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/> <License Value="MPL 1.1"/>
<Version Major="81" Minor="2" Release="17"/> <Version Major="81" Minor="2" Release="19"/>
<Files Count="154"> <Files Count="154">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -62,7 +62,7 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 81; CEF_SUPPORTED_VERSION_MAJOR = 81;
CEF_SUPPORTED_VERSION_MINOR = 2; CEF_SUPPORTED_VERSION_MINOR = 2;
CEF_SUPPORTED_VERSION_RELEASE = 17; CEF_SUPPORTED_VERSION_RELEASE = 19;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 81; CEF_CHROMEELF_VERSION_MAJOR = 81;

View File

@ -198,17 +198,25 @@ procedure cef_media_observer_on_route_message_received( self : PCef
message_size : NativeUInt); stdcall; message_size : NativeUInt); stdcall;
var var
TempObject : TObject; TempObject : TObject;
TempMessage : Ansistring; TempAnsiMsg : Ansistring;
TempMsg : ustring;
begin begin
TempObject := CefGetObject(self); TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
begin begin
if (message_size > 0) and (message_ <> nil) then 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), TCefMediaObserverOwn(TempObject).OnRouteMessageReceived(TCefMediaRouteRef.UnWrap(route),
ustring(TempMessage)); TempMsg);
end; end;
end; end;

View File

@ -85,17 +85,23 @@ end;
procedure TCefMediaRouteRef.SendRouteMessage(const message_: ustring); procedure TCefMediaRouteRef.SendRouteMessage(const message_: ustring);
var var
TempMsg : pointer; TempMsgPtr : pointer;
TempSize : NativeUInt; TempMsg : AnsiString;
TempSize : NativeUInt;
begin begin
TempSize := length(message_); TempSize := length(message_);
if (TempSize > 0) then if (TempSize > 0) then
TempMsg := @message_[1] begin
TempMsg := Utf8Encode(message_);
TempMsgPtr := @TempMsg[1];
end
else else
TempMsg := nil; TempMsgPtr := nil;
PCefMediaRoute(FData)^.send_route_message(PCefMediaRoute(FData), TempMsg, TempSize); PCefMediaRoute(FData)^.send_route_message(PCefMediaRoute(FData),
TempMsgPtr,
TempSize);
end; end;
procedure TCefMediaRouteRef.Terminate; procedure TCefMediaRouteRef.Terminate;

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 120, "InternalVersion" : 121,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "81.2.17.0" "Version" : "81.2.19.0"
} }
], ],
"UpdatePackageData" : { "UpdatePackageData" : {