1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-09-16 08:26:23 +02:00

Fixed IME support in OSR mode

- Added lots of conditional compiler directives to build CEF4DElphi in Linux using Lazarus/FPC
- Updated copyright year
This commit is contained in:
Salvador Díaz Fau
2019-01-08 19:15:25 +01:00
parent ea11d6cd46
commit 769aa4f384
219 changed files with 2231 additions and 334 deletions

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -763,6 +763,7 @@ begin
chrmosr.ShutdownDragAndDrop; chrmosr.ShutdownDragAndDrop;
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
end; end;
procedure TForm1.FormHide(Sender: TObject); procedure TForm1.FormHide(Sender: TObject);

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -108,6 +108,9 @@ object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
Top = 30 Top = 30
Width = 913 Width = 913
Height = 554 Height = 554
OnIMECancelComposition = Panel1IMECancelComposition
OnIMECommitText = Panel1IMECommitText
OnIMESetComposition = Panel1IMESetComposition
Align = alClient Align = alClient
Caption = 'Panel1' Caption = 'Panel1'
TabOrder = 1 TabOrder = 1
@@ -134,6 +137,7 @@ object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
OnPopupSize = chrmosrPopupSize OnPopupSize = chrmosrPopupSize
OnPaint = chrmosrPaint OnPaint = chrmosrPaint
OnCursorChange = chrmosrCursorChange OnCursorChange = chrmosrCursorChange
OnIMECompositionRangeChanged = chrmosrIMECompositionRangeChanged
Left = 24 Left = 24
Top = 56 Top = 56
end end

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -78,6 +78,9 @@ type
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseLeave(Sender: TObject); procedure Panel1MouseLeave(Sender: TObject);
procedure Panel1IMECancelComposition(Sender: TObject);
procedure Panel1IMECommitText(Sender: TObject; const aText: ustring; const replacement_range: PCefRange; relative_cursor_pos: Integer);
procedure Panel1IMESetComposition(Sender: TObject; const aText: ustring; const underlines: TCefCompositionUnderlineDynArray; const replacement_range, selection_range: TCefRange);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@@ -98,6 +101,7 @@ type
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean); procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect);
procedure SnapshotBtnClick(Sender: TObject); procedure SnapshotBtnClick(Sender: TObject);
procedure SnapshotBtnEnter(Sender: TObject); procedure SnapshotBtnEnter(Sender: TObject);
@@ -665,6 +669,7 @@ begin
chrmosr.ShutdownDragAndDrop; chrmosr.ShutdownDragAndDrop;
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
end; end;
procedure TOSRExternalPumpBrowserFrm.FormHide(Sender: TObject); procedure TOSRExternalPumpBrowserFrm.FormHide(Sender: TObject);
@@ -685,6 +690,8 @@ begin
// opaque white background color // opaque white background color
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Panel1.CreateIMEHandler;
if chrmosr.CreateBrowser(nil, '') then if chrmosr.CreateBrowser(nil, '') then
chrmosr.InitializeDragAndDrop(Panel1) chrmosr.InitializeDragAndDrop(Panel1)
else else
@@ -856,4 +863,66 @@ begin
if not(chrmosr.Initialized) then Timer1.Enabled := True; if not(chrmosr.Initialized) then Timer1.Enabled := True;
end; end;
procedure TOSRExternalPumpBrowserFrm.Panel1IMECancelComposition(Sender: TObject);
begin
chrmosr.IMECancelComposition;
end;
procedure TOSRExternalPumpBrowserFrm.Panel1IMECommitText( Sender : TObject;
const aText : ustring;
const replacement_range : PCefRange;
relative_cursor_pos : Integer);
begin
chrmosr.IMECommitText(aText, replacement_range, relative_cursor_pos);
end;
procedure TOSRExternalPumpBrowserFrm.Panel1IMESetComposition( Sender : TObject;
const aText : ustring;
const underlines : TCefCompositionUnderlineDynArray;
const replacement_range : TCefRange;
const selection_range : TCefRange);
begin
chrmosr.IMESetComposition(aText, underlines, @replacement_range, @selection_range);
end;
procedure TOSRExternalPumpBrowserFrm.chrmosrIMECompositionRangeChanged( Sender : TObject;
const browser : ICefBrowser;
const selected_range : PCefRange;
character_boundsCount : NativeUInt;
const character_bounds : PCefRect);
var
TempDeviceBounds : TCefRectDynArray;
TempPRect : PCefRect;
i : NativeUInt;
begin
TempDeviceBounds := nil;
try
if (character_boundsCount > 0) then
begin
SetLength(TempDeviceBounds, character_boundsCount);
i := 0;
TempPRect := character_bounds;
while (i < character_boundsCount) do
begin
TempDeviceBounds[i] := TempPRect^;
LogicalToDevice(TempDeviceBounds[i], GlobalCEFApp.DeviceScaleFactor);
inc(TempPRect);
inc(i);
end;
end;
Panel1.ChangeCompositionRange(selected_range^, TempDeviceBounds);
finally
if (TempDeviceBounds <> nil) then
begin
Finalize(TempDeviceBounds);
TempDeviceBounds := nil;
end;
end;
end;
end. end.

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="10"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags> <Flags>
@@ -24,9 +24,10 @@
<Version Value="2"/> <Version Value="2"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>

View File

@@ -2,17 +2,17 @@
<CONFIG> <CONFIG>
<ProjectSession> <ProjectSession>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="10"/> <Version Value="11"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="19"> <Units Count="25">
<Unit0> <Unit0>
<Filename Value="SimpleLazOSRBrowser.lpr"/> <Filename Value="SimpleLazOSRBrowser.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="24"/> <TopLine Value="24"/>
<CursorPos X="46" Y="33"/> <CursorPos X="46" Y="33"/>
<UsageCount Value="40"/> <UsageCount Value="42"/>
<DefaultSyntaxHighlighter Value="Delphi"/> <DefaultSyntaxHighlighter Value="Delphi"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@@ -21,14 +21,14 @@
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<EditorIndex Value="-1"/> <TopLine Value="19"/>
<TopLine Value="285"/> <CursorPos X="63" Y="204"/>
<CursorPos Y="296"/> <UsageCount Value="42"/>
<UsageCount Value="40"/> <Bookmarks Count="1">
<Bookmarks Count="2"> <Item0 X="40" Y="252" ID="4"/>
<Item0 Y="189" ID="1"/>
<Item1 X="5" Y="801" ID="2"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/> <DefaultSyntaxHighlighter Value="Delphi"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
@@ -43,10 +43,11 @@
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\..\source\uBufferPanel.pas"/> <Filename Value="..\..\source\uBufferPanel.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="5"/>
<TopLine Value="95"/> <TopLine Value="32"/>
<CursorPos X="41" Y="126"/> <CursorPos Y="284"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="..\..\..\..\lcl\lcltype.pp"/> <Filename Value="..\..\..\..\lcl\lcltype.pp"/>
@@ -60,10 +61,11 @@
<Unit5> <Unit5>
<Filename Value="C:\lazarus\lcl\forms.pp"/> <Filename Value="C:\lazarus\lcl\forms.pp"/>
<UnitName Value="Forms"/> <UnitName Value="Forms"/>
<EditorIndex Value="-1"/> <EditorIndex Value="1"/>
<TopLine Value="1549"/> <TopLine Value="243"/>
<CursorPos X="15" Y="1493"/> <CursorPos X="43" Y="268"/>
<UsageCount Value="11"/> <UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="C:\lazarus\lcl\graphics.pp"/> <Filename Value="C:\lazarus\lcl\graphics.pp"/>
@@ -155,18 +157,187 @@
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="..\..\source\uCEFApplication.pas"/> <Filename Value="..\..\source\uCEFApplication.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="6"/>
<TopLine Value="1096"/> <TopLine Value="28"/>
<CursorPos X="59" Y="1103"/> <CursorPos X="59" Y="1103"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Bookmarks Count="1"> <Loaded Value="True"/>
<Item0 X="74" Y="1103" ID="1"/>
</Bookmarks>
</Unit18> </Unit18>
<Unit19>
<Filename Value="..\..\source\uCEFChromium.pas"/>
<EditorIndex Value="7"/>
<TopLine Value="559"/>
<CursorPos Y="570"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit19>
<Unit20>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="97"/>
<CursorPos Y="651"/>
<UsageCount Value="10"/>
<Bookmarks Count="2">
<Item0 X="23" Y="177" ID="2"/>
<Item1 X="58" Y="279" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="..\..\source\uCEFTypes.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="264"/>
<CursorPos X="35" Y="286"/>
<UsageCount Value="10"/>
</Unit21>
<Unit22>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm.pas"/>
<EditorIndex Value="4"/>
<TopLine Value="286"/>
<CursorPos X="33" Y="323"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit22>
<Unit23>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/>
<EditorIndex Value="3"/>
<CursorPos X="23" Y="17"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit23>
<Unit24>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\buildwinutilsbase.pp"/>
<EditorIndex Value="-1"/>
<CursorPos X="67" Y="17"/>
<UsageCount Value="10"/>
</Unit24>
</Units> </Units>
<General> <JumpHistory Count="30" HistoryIndex="29">
<ActiveWindowIndexAtStart Value="-1"/> <Position1>
</General> <Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<JumpHistory HistoryIndex="-1"/> <Caret Line="612" TopLine="591"/>
</Position1>
<Position2>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="624" TopLine="620"/>
</Position2>
<Position3>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="626" TopLine="620"/>
</Position3>
<Position4>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="627" TopLine="620"/>
</Position4>
<Position5>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="629" TopLine="620"/>
</Position5>
<Position6>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="632" TopLine="620"/>
</Position6>
<Position7>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="633" TopLine="620"/>
</Position7>
<Position8>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="635" TopLine="620"/>
</Position8>
<Position9>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="638" TopLine="620"/>
</Position9>
<Position10>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="639" TopLine="620"/>
</Position10>
<Position11>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="640" TopLine="620"/>
</Position11>
<Position12>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="648" TopLine="635"/>
</Position12>
<Position13>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="650" TopLine="635"/>
</Position13>
<Position14>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="651" TopLine="635"/>
</Position14>
<Position15>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="652" TopLine="635"/>
</Position15>
<Position16>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="666" TopLine="653"/>
</Position16>
<Position17>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="673" TopLine="653"/>
</Position17>
<Position18>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="676" TopLine="667"/>
</Position18>
<Position19>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="677" TopLine="667"/>
</Position19>
<Position20>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="678" TopLine="667"/>
</Position20>
<Position21>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="679" TopLine="667"/>
</Position21>
<Position22>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="680" TopLine="667"/>
</Position22>
<Position23>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="681" TopLine="667"/>
</Position23>
<Position24>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="682" TopLine="667"/>
</Position24>
<Position25>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="683" TopLine="667"/>
</Position25>
<Position26>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<Caret Line="685" TopLine="667"/>
</Position26>
<Position27>
<Filename Value="usimplelazosrbrowser.pas"/>
<Caret Line="204" Column="63" TopLine="19"/>
</Position27>
<Position28>
<Filename Value="C:\lazarus\lcl\forms.pp"/>
<Caret Line="750" Column="3" TopLine="728"/>
</Position28>
<Position29>
<Filename Value="C:\lazarus\lcl\forms.pp"/>
<Caret Line="445" Column="50" TopLine="408"/>
</Position29>
<Position30>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/>
<Caret Line="17" Column="23"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode="default"/>
</RunParams>
</ProjectSession> </ProjectSession>
</CONFIG> </CONFIG>

View File

@@ -16,7 +16,7 @@ object Form1: TForm1
OnHide = FormHide OnHide = FormHide
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.8.4.0' LCLVersion = '2.0.0.3'
object NavControlPnl: TPanel object NavControlPnl: TPanel
Left = 0 Left = 0
Height = 21 Height = 21
@@ -90,6 +90,9 @@ object Form1: TForm1
Height = 544 Height = 544
Top = 21 Top = 21
Width = 800 Width = 800
OnIMECancelComposition = Panel1IMECancelComposition
OnIMECommitText = Panel1IMECommitText
OnIMESetComposition = Panel1IMESetComposition
Align = alClient Align = alClient
OnUTF8KeyPress = Panel1UTF8KeyPress OnUTF8KeyPress = Panel1UTF8KeyPress
Caption = 'Panel1' Caption = 'Panel1'
@@ -119,6 +122,7 @@ object Form1: TForm1
OnPopupSize = chrmosrPopupSize OnPopupSize = chrmosrPopupSize
OnPaint = chrmosrPaint OnPaint = chrmosrPaint
OnCursorChange = chrmosrCursorChange OnCursorChange = chrmosrCursorChange
OnIMECompositionRangeChanged = chrmosrIMECompositionRangeChanged
left = 24 left = 24
top = 56 top = 56
end end

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright © 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -43,8 +43,8 @@ interface
uses uses
Windows, LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, SyncObjs, Windows, LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, SyncObjs,
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types,
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uBufferPanel, Types; uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uBufferPanel, uCEFChromiumEvents;
type type
@@ -66,6 +66,9 @@ type
procedure Panel1Enter(Sender: TObject); procedure Panel1Enter(Sender: TObject);
procedure Panel1Exit(Sender: TObject); procedure Panel1Exit(Sender: TObject);
procedure Panel1IMECancelComposition(Sender: TObject);
procedure Panel1IMECommitText(Sender: TObject; const aText: ustring; const replacement_range: PCefRange; relative_cursor_pos: integer);
procedure Panel1IMESetComposition(Sender: TObject; const aText: ustring; const underlines: TCefCompositionUnderlineDynArray; const replacement_range, selection_range: TCefRange);
procedure Panel1Resize(Sender: TObject); procedure Panel1Resize(Sender: TObject);
procedure Panel1Click(Sender: TObject); procedure Panel1Click(Sender: TObject);
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
@@ -96,6 +99,7 @@ type
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect);
procedure SnapshotBtnClick(Sender: TObject); procedure SnapshotBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject);
@@ -111,7 +115,10 @@ type
FPendingResize : boolean; FPendingResize : boolean;
FCanClose : boolean; FCanClose : boolean;
FClosing : boolean; FClosing : boolean;
FResizeCS : TCriticalSection; FResizeCS : TCriticalSection;
FIMECS : TCriticalSection;
FDeviceBounds : TCefRectDynArray;
FSelectedRange : TCefRange;
FLastClickCount : integer; FLastClickCount : integer;
FLastClickTime : integer; FLastClickTime : integer;
@@ -135,7 +142,8 @@ type
procedure WMSysKeyUp(var aMessage: TMessage); message WM_SYSKEYUP; procedure WMSysKeyUp(var aMessage: TMessage); message WM_SYSKEYUP;
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE; procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE;
procedure PendingInvalidateMsg(var aMessage : TMessage); message CEF_PENDINGINVALIDATE; procedure PendingInvalidateMsg(var aMessage : TMessage); message CEF_PENDINGINVALIDATE;
procedure RangeChangedMsg(var aMessage : TMessage); message CEF_IMERANGECHANGED;
public public
{ Public declarations } { Public declarations }
@@ -169,6 +177,55 @@ begin
chrmosr.LoadURL(ComboBox1.Text); chrmosr.LoadURL(ComboBox1.Text);
end; end;
procedure TForm1.chrmosrIMECompositionRangeChanged( Sender : TObject;
const browser : ICefBrowser;
const selected_range : PCefRange;
character_boundsCount : NativeUInt;
const character_bounds : PCefRect);
var
TempPRect : PCefRect;
i : NativeUInt;
begin
try
FIMECS.Acquire;
// TChromium.OnIMECompositionRangeChanged is triggered in a different thread
// and all functions using a IMM context need to be executed in the same
// thread, in this case the main thread. We need to save the parameters and
// send a message to the form to execute Panel1.ChangeCompositionRange in
// the main thread.
if (FDeviceBounds <> nil) then
begin
Finalize(FDeviceBounds);
FDeviceBounds := nil;
end;
FSelectedRange := selected_range^;
if (character_boundsCount > 0) then
begin
SetLength(FDeviceBounds, character_boundsCount);
i := 0;
TempPRect := character_bounds;
while (i < character_boundsCount) do
begin
FDeviceBounds[i] := TempPRect^;
LogicalToDevice(FDeviceBounds[i], GlobalCEFApp.DeviceScaleFactor);
inc(TempPRect);
inc(i);
end;
end;
PostMessage(Handle, CEF_IMERANGECHANGED, 0, 0);
finally
FIMECS.Release;
end;
end;
procedure TForm1.GoBtnEnter(Sender: TObject); procedure TForm1.GoBtnEnter(Sender: TObject);
begin begin
chrmosr.SendFocusEvent(False); chrmosr.SendFocusEvent(False);
@@ -614,7 +671,13 @@ begin
FPendingResize := False; FPendingResize := False;
FCanClose := False; FCanClose := False;
FClosing := False; FClosing := False;
FDeviceBounds := nil;
FSelectedRange.from := 0;
FSelectedRange.to_ := 0;
FResizeCS := TCriticalSection.Create; FResizeCS := TCriticalSection.Create;
FIMECS := TCriticalSection.Create;
InitializeLastClick; InitializeLastClick;
end; end;
@@ -623,7 +686,15 @@ procedure TForm1.FormDestroy(Sender: TObject);
begin begin
chrmosr.ShutdownDragAndDrop; chrmosr.ShutdownDragAndDrop;
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
if (FIMECS <> nil) then FreeAndNil(FIMECS);
if (FDeviceBounds <> nil) then
begin
Finalize(FDeviceBounds);
FDeviceBounds := nil;
end;
end; end;
procedure TForm1.FormHide(Sender: TObject); procedure TForm1.FormHide(Sender: TObject);
@@ -644,6 +715,11 @@ begin
// opaque white background color // opaque white background color
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
// The IME handler needs to be created when Panel1 has a valid handle
// and before the browser creation.
// You can skip this if the user doesn't need an "Input Method Editor".
Panel1.CreateIMEHandler;
if chrmosr.CreateBrowser(nil, '') then if chrmosr.CreateBrowser(nil, '') then
chrmosr.InitializeDragAndDrop(Panel1) chrmosr.InitializeDragAndDrop(Panel1)
else else
@@ -752,6 +828,16 @@ begin
Panel1.Invalidate; Panel1.Invalidate;
end; end;
procedure TForm1.RangeChangedMsg(var aMessage : TMessage);
begin
try
FIMECS.Acquire;
Panel1.ChangeCompositionRange(FSelectedRange, FDeviceBounds);
finally
FIMECS.Release;
end;
end;
procedure TForm1.DoResize; procedure TForm1.DoResize;
begin begin
try try
@@ -800,6 +886,28 @@ begin
chrmosr.SendFocusEvent(False); chrmosr.SendFocusEvent(False);
end; end;
procedure TForm1.Panel1IMECancelComposition(Sender: TObject);
begin
chrmosr.IMECancelComposition;
end;
procedure TForm1.Panel1IMECommitText( Sender : TObject;
const aText : ustring;
const replacement_range : PCefRange;
relative_cursor_pos : Integer);
begin
chrmosr.IMECommitText(aText, replacement_range, relative_cursor_pos);
end;
procedure TForm1.Panel1IMESetComposition( Sender : TObject;
const aText : ustring;
const underlines : TCefCompositionUnderlineDynArray;
const replacement_range : TCefRange;
const selection_range : TCefRange);
begin
chrmosr.IMESetComposition(aText, underlines, @replacement_range, @selection_range);
end;
procedure TForm1.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure TForm1.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var var
TempKeyEvent : TCefKeyEvent; TempKeyEvent : TCefKeyEvent;

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="10"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
@@ -18,9 +18,10 @@
<Version Value="2"/> <Version Value="2"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <FormatVersion Value="2"/>
<FormatVersion Value="1"/> <Modes Count="1">
</local> <Mode0 Name="default"/>
</Modes>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>

View File

@@ -2,16 +2,16 @@
<CONFIG> <CONFIG>
<ProjectSession> <ProjectSession>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="10"/> <Version Value="11"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="49"> <Units Count="52">
<Unit0> <Unit0>
<Filename Value="SimpleLazarusBrowser.lpr"/> <Filename Value="SimpleLazarusBrowser.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="5"/> <TopLine Value="5"/>
<CursorPos X="43" Y="5"/> <CursorPos X="43" Y="5"/>
<UsageCount Value="42"/> <UsageCount Value="43"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="usimplelazarusbrowser.pas"/> <Filename Value="usimplelazarusbrowser.pas"/>
@@ -20,11 +20,11 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="uSimpleLazarusBrowser"/> <UnitName Value="uSimpleLazarusBrowser"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="26"/> <TopLine Value="26"/>
<CursorPos Y="168"/> <CursorPos Y="40"/>
<UsageCount Value="42"/> <UsageCount Value="43"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="..\..\source\uCEFChromium.pas"/> <Filename Value="..\..\source\uCEFChromium.pas"/>
@@ -84,9 +84,13 @@
<Unit9> <Unit9>
<Filename Value="..\..\source\uBufferPanel.pas"/> <Filename Value="..\..\source\uBufferPanel.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="40"/> <TopLine Value="418"/>
<CursorPos X="36" Y="62"/> <CursorPos X="55" Y="426"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Bookmarks Count="2">
<Item0 X="3" Y="265" ID="3"/>
<Item1 X="52" Y="413" ID="4"/>
</Bookmarks>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="..\..\source\uCEFServerComponent.pas"/> <Filename Value="..\..\source\uCEFServerComponent.pas"/>
@@ -360,8 +364,8 @@
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="..\..\source\cef.inc"/> <Filename Value="..\..\source\cef.inc"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="136"/> <TopLine Value="136"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit47> </Unit47>
@@ -372,10 +376,39 @@
<CursorPos X="37" Y="147"/> <CursorPos X="37" Y="147"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit48> </Unit48>
<Unit49>
<Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="116"/>
<CursorPos X="30" Y="116"/>
<UsageCount Value="10"/>
<Bookmarks Count="2">
<Item0 X="33" Y="176" ID="1"/>
<Item1 X="3" Y="138" ID="2"/>
</Bookmarks>
</Unit49>
<Unit50>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="529"/>
<CursorPos X="30" Y="551"/>
<UsageCount Value="10"/>
</Unit50>
<Unit51>
<Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="104"/>
<CursorPos X="3" Y="133"/>
<UsageCount Value="10"/>
</Unit51>
</Units> </Units>
<General> <General>
<ActiveWindowIndexAtStart Value="-1"/> <ActiveWindowIndexAtStart Value="-1"/>
</General> </General>
<JumpHistory HistoryIndex="-1"/> <JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode="default"/>
</RunParams>
</ProjectSession> </ProjectSession>
</CONFIG> </CONFIG>

View File

@@ -1,7 +1,7 @@
object Form1: TForm1 object Form1: TForm1
Left = 298 Left = 298
Height = 574 Height = 574
Top = 142 Top = 218
Width = 878 Width = 878
Caption = 'Initializing browser. Please wait...' Caption = 'Initializing browser. Please wait...'
ClientHeight = 574 ClientHeight = 574
@@ -10,7 +10,7 @@ object Form1: TForm1
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.8.4.0' LCLVersion = '2.0.0.3'
object AddressPnl: TPanel object AddressPnl: TPanel
Left = 0 Left = 0
Height = 23 Height = 23

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright © 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -107,6 +107,9 @@ object Form1: TForm1
Top = 30 Top = 30
Width = 988 Width = 988
Height = 638 Height = 638
OnIMECancelComposition = Panel1IMECancelComposition
OnIMECommitText = Panel1IMECommitText
OnIMESetComposition = Panel1IMESetComposition
Align = alClient Align = alClient
Caption = 'Panel1' Caption = 'Panel1'
TabOrder = 1 TabOrder = 1
@@ -133,6 +136,7 @@ object Form1: TForm1
OnPopupSize = chrmosrPopupSize OnPopupSize = chrmosrPopupSize
OnPaint = chrmosrPaint OnPaint = chrmosrPaint
OnCursorChange = chrmosrCursorChange OnCursorChange = chrmosrCursorChange
OnIMECompositionRangeChanged = chrmosrIMECompositionRangeChanged
Left = 24 Left = 24
Top = 56 Top = 56
end end

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -45,7 +45,7 @@ uses
{$IFDEF DELPHI16_UP} {$IFDEF DELPHI16_UP}
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
System.SyncObjs, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.SyncObjs, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
Vcl.ExtCtrls, Vcl.AppEvnts, Vcl.ExtCtrls, Vcl.AppEvnts, WinApi.imm,
{$ELSE} {$ELSE}
Windows, Messages, SysUtils, Variants, Classes, SyncObjs, Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts,
@@ -78,6 +78,9 @@ type
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure Panel1MouseLeave(Sender: TObject); procedure Panel1MouseLeave(Sender: TObject);
procedure Panel1IMECancelComposition(Sender: TObject);
procedure Panel1IMECommitText(Sender: TObject; const aText: ustring; const replacement_range: PCefRange; relative_cursor_pos: Integer);
procedure Panel1IMESetComposition(Sender: TObject; const aText: ustring; const underlines: TCefCompositionUnderlineDynArray; const replacement_range, selection_range: TCefRange);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@@ -98,6 +101,7 @@ type
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect);
procedure SnapshotBtnClick(Sender: TObject); procedure SnapshotBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject);
@@ -113,6 +117,9 @@ type
FCanClose : boolean; FCanClose : boolean;
FClosing : boolean; FClosing : boolean;
FResizeCS : TCriticalSection; FResizeCS : TCriticalSection;
FIMECS : TCriticalSection;
FDeviceBounds : TCefRectDynArray;
FSelectedRange : TCefRange;
FLastClickCount : integer; FLastClickCount : integer;
FLastClickTime : integer; FLastClickTime : integer;
@@ -133,6 +140,7 @@ type
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE; procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE;
procedure RangeChangedMsg(var aMessage : TMessage); message CEF_IMERANGECHANGED;
public public
{ Public declarations } { Public declarations }
@@ -647,7 +655,13 @@ begin
FPendingResize := False; FPendingResize := False;
FCanClose := False; FCanClose := False;
FClosing := False; FClosing := False;
FDeviceBounds := nil;
FSelectedRange.from := 0;
FSelectedRange.to_ := 0;
FResizeCS := TCriticalSection.Create; FResizeCS := TCriticalSection.Create;
FIMECS := TCriticalSection.Create;
InitializeLastClick; InitializeLastClick;
end; end;
@@ -657,6 +671,14 @@ begin
chrmosr.ShutdownDragAndDrop; chrmosr.ShutdownDragAndDrop;
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
if (FIMECS <> nil) then FreeAndNil(FIMECS);
if (FDeviceBounds <> nil) then
begin
Finalize(FDeviceBounds);
FDeviceBounds := nil;
end;
end; end;
procedure TForm1.FormHide(Sender: TObject); procedure TForm1.FormHide(Sender: TObject);
@@ -677,6 +699,11 @@ begin
// opaque white background color // opaque white background color
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
// The IME handler needs to be created when Panel1 has a valid handle
// and before the browser creation.
// You can skip this if the user doesn't need an "Input Method Editor".
Panel1.CreateIMEHandler;
if chrmosr.CreateBrowser(nil, '') then if chrmosr.CreateBrowser(nil, '') then
chrmosr.InitializeDragAndDrop(Panel1) chrmosr.InitializeDragAndDrop(Panel1)
else else
@@ -780,6 +807,16 @@ begin
DoResize; DoResize;
end; end;
procedure TForm1.RangeChangedMsg(var aMessage : TMessage);
begin
try
FIMECS.Acquire;
Panel1.ChangeCompositionRange(FSelectedRange, FDeviceBounds);
finally
FIMECS.Release;
end;
end;
procedure TForm1.DoResize; procedure TForm1.DoResize;
begin begin
try try
@@ -848,4 +885,75 @@ begin
if not(chrmosr.Initialized) then Timer1.Enabled := True; if not(chrmosr.Initialized) then Timer1.Enabled := True;
end; end;
procedure TForm1.chrmosrIMECompositionRangeChanged( Sender : TObject;
const browser : ICefBrowser;
const selected_range : PCefRange;
character_boundsCount : NativeUInt;
const character_bounds : PCefRect);
var
TempPRect : PCefRect;
i : NativeUInt;
begin
try
FIMECS.Acquire;
// TChromium.OnIMECompositionRangeChanged is triggered in a different thread
// and all functions using a IMM context need to be executed in the same
// thread, in this case the main thread. We need to save the parameters and
// send a message to the form to execute Panel1.ChangeCompositionRange in
// the main thread.
if (FDeviceBounds <> nil) then
begin
Finalize(FDeviceBounds);
FDeviceBounds := nil;
end;
FSelectedRange := selected_range^;
if (character_boundsCount > 0) then
begin
SetLength(FDeviceBounds, character_boundsCount);
i := 0;
TempPRect := character_bounds;
while (i < character_boundsCount) do
begin
FDeviceBounds[i] := TempPRect^;
LogicalToDevice(FDeviceBounds[i], GlobalCEFApp.DeviceScaleFactor);
inc(TempPRect);
inc(i);
end;
end;
PostMessage(Handle, CEF_IMERANGECHANGED, 0, 0);
finally
FIMECS.Release;
end;
end;
procedure TForm1.Panel1IMECancelComposition(Sender: TObject);
begin
chrmosr.IMECancelComposition;
end;
procedure TForm1.Panel1IMECommitText( Sender : TObject;
const aText : ustring;
const replacement_range : PCefRange;
relative_cursor_pos : Integer);
begin
chrmosr.IMECommitText(aText, replacement_range, relative_cursor_pos);
end;
procedure TForm1.Panel1IMESetComposition( Sender : TObject;
const aText : ustring;
const underlines : TCefCompositionUnderlineDynArray;
const replacement_range : TCefRange;
const selection_range : TCefRange);
begin
chrmosr.IMESetComposition(aText, underlines, @replacement_range, @selection_range);
end;
end. end.

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 D�az Fau. All rights reserved. // Copyright � 2019 Salvador D�az Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -166,7 +166,8 @@ contains
uCEFWinControl in '..\source\uCEFWinControl.pas', uCEFWinControl in '..\source\uCEFWinControl.pas',
uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas',
uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas',
uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas',
uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas';
end. end.

View File

@@ -163,6 +163,7 @@ contains
uCEFWinControl in '..\source\uCEFWinControl.pas', uCEFWinControl in '..\source\uCEFWinControl.pas',
uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas',
uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas',
uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas',
uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas';
end. end.

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -170,7 +170,8 @@ contains
uCEFWinControl in '..\source\uCEFWinControl.pas', uCEFWinControl in '..\source\uCEFWinControl.pas',
uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas',
uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas',
uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas',
uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas';
end. end.

View File

@@ -272,6 +272,7 @@
<DCCReference Include="..\source\uCEFLinkedWindowParent.pas"/> <DCCReference Include="..\source\uCEFLinkedWindowParent.pas"/>
<DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/> <DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/>
<DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/> <DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/>
<DCCReference Include="..\source\uCEFOSRIMEHandler.pas"/>
<BuildConfiguration Include="Base"> <BuildConfiguration Include="Base">
<Key>Base</Key> <Key>Base</Key>
</BuildConfiguration> </BuildConfiguration>

Binary file not shown.

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -21,7 +21,7 @@
</CompilerOptions> </CompilerOptions>
<Description Value="CEF4Delphi"/> <Description Value="CEF4Delphi"/>
<Version Major="1"/> <Version Major="1"/>
<Files Count="137"> <Files Count="138">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
<UnitName Value="uCEFAccessibilityHandler"/> <UnitName Value="uCEFAccessibilityHandler"/>
@@ -578,6 +578,10 @@
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="uCEFUrlRequestClientComponent"/> <UnitName Value="uCEFUrlRequestClientComponent"/>
</Item137> </Item137>
<Item138>
<Filename Value="..\source\uCEFOSRIMEHandler.pas"/>
<UnitName Value="uCEFOSRIMEHandler"/>
</Item138>
</Files> </Files>
<RequiredPkgs Count="3"> <RequiredPkgs Count="3">
<Item1> <Item1>

View File

@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="10"/>
<Units Count="10">
<Unit0>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<IsVisibleTab Value="True"/>
<TopLine Value="1397"/>
<CursorPos Y="1412"/>
<UsageCount Value="11"/>
<Bookmarks Count="5">
<Item0 X="31" Y="209" ID="1"/>
<Item1 X="19" Y="1717" ID="2"/>
<Item2 X="45" Y="404" ID="3"/>
<Item3 X="71" Y="736" ID="4"/>
<Item4 X="25" Y="1270" ID="5"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../source/uCEFImage.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="40"/>
<CursorPos X="41" Y="55"/>
<UsageCount Value="11"/>
</Unit1>
<Unit2>
<Filename Value="../source/uCEFv8Handler.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="41"/>
<CursorPos Y="56"/>
<UsageCount Value="11"/>
</Unit2>
<Unit3>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/datih.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="106"/>
<CursorPos X="11" Y="120"/>
<UsageCount Value="11"/>
</Unit3>
<Unit4>
<Filename Value="../../fpCEF3/cef3lib.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="315"/>
<CursorPos X="3" Y="325"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="../source/uCEFApplication.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="34"/>
<CursorPos X="46" Y="36"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/typinfo.pp"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="/usr/share/fpcsrc/3.0.4/packages/fcl-db/src/dbase/dbf_wnix.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="170"/>
<CursorPos X="37" Y="185"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/linux/ossysc.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="595"/>
<CursorPos X="10" Y="609"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/bsd/system.pp"/>
<UnitName Value="System"/>
<EditorIndex Value="-1"/>
<TopLine Value="303"/>
<CursorPos X="22" Y="315"/>
<UsageCount Value="10"/>
</Unit9>
</Units>
<JumpHistory Count="28" HistoryIndex="27">
<Position1>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="56" Column="41" TopLine="42"/>
</Position1>
<Position2>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="56" Column="37" TopLine="42"/>
</Position2>
<Position3>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="733" Column="71" TopLine="719"/>
</Position3>
<Position4>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="55" Column="85" TopLine="41"/>
</Position4>
<Position5>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="64" Column="54" TopLine="42"/>
</Position5>
<Position6>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="731" Column="52" TopLine="719"/>
</Position6>
<Position7>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="55" Column="130" TopLine="42"/>
</Position7>
<Position8>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1113" Column="16" TopLine="1099"/>
</Position8>
<Position9>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="727" Column="7" TopLine="718"/>
</Position9>
<Position10>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1109" Column="19" TopLine="1099"/>
</Position10>
<Position11>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="163" Column="22" TopLine="148"/>
</Position11>
<Position12>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1111" Column="19" TopLine="1101"/>
</Position12>
<Position13>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="419" Column="3" TopLine="401"/>
</Position13>
<Position14>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1147" Column="10" TopLine="1128"/>
</Position14>
<Position15>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="13" Column="82"/>
</Position15>
<Position16>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="164" Column="16" TopLine="141"/>
</Position16>
<Position17>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1256" Column="11" TopLine="1230"/>
</Position17>
<Position18>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1269" Column="36" TopLine="1259"/>
</Position18>
<Position19>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="176" Column="12" TopLine="160"/>
</Position19>
<Position20>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1270" Column="25" TopLine="1256"/>
</Position20>
<Position21>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1287" Column="45" TopLine="1271"/>
</Position21>
<Position22>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="180" Column="18" TopLine="165"/>
</Position22>
<Position23>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1329" Column="3" TopLine="1323"/>
</Position23>
<Position24>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="177" Column="22" TopLine="166"/>
</Position24>
<Position25>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1321" Column="10" TopLine="1307"/>
</Position25>
<Position26>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1411" Column="13" TopLine="1397"/>
</Position26>
<Position27>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="736" Column="71" TopLine="722"/>
</Position27>
<Position28>
<Filename Value="../source/uCEFMiscFunctions.pas"/>
<Caret Line="1411" Column="13" TopLine="1857"/>
</Position28>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@@ -46,7 +46,8 @@ uses
uCEFWriteHandler, uCEFX509Certificate, uCEFX509CertPrincipal, uCEFXmlReader, uCEFWriteHandler, uCEFX509Certificate, uCEFX509CertPrincipal, uCEFXmlReader,
uCEFZipReader, uCEFChromium, uBufferPanel, uCEFServer, uCEFServerComponent, uCEFZipReader, uCEFChromium, uBufferPanel, uCEFServer, uCEFServerComponent,
uCEFServerEvents, uCEFServerHandler, uCEFWinControl, uCEFLinkedWindowParent, uCEFServerEvents, uCEFServerHandler, uCEFWinControl, uCEFLinkedWindowParent,
uCEFUrlRequestClientEvents, uCEFUrlRequestClientComponent, LazarusPackageIntf; uCEFUrlRequestClientEvents, uCEFUrlRequestClientComponent,
uCEFOSRIMEHandler, LazarusPackageIntf;
implementation implementation

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -47,10 +47,10 @@ interface
uses uses
{$IFDEF DELPHI16_UP} {$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}Winapi.Windows, Winapi.Messages, Vcl.ExtCtrls, Vcl.Controls, Vcl.Graphics,{$ENDIF} {$IFDEF MSWINDOWS}Winapi.Windows, Winapi.Messages, Vcl.ExtCtrls, Vcl.Controls, Vcl.Graphics, WinApi.Imm,{$ENDIF}
System.Classes, System.SyncObjs, System.SysUtils, System.Classes, System.SyncObjs, System.SysUtils,
{$ELSE} {$ELSE}
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics, {$IFDEF MSWINDOWS}Windows, imm, {$ENDIF} Classes, Forms, Controls, Graphics,
{$IFDEF FPC} {$IFDEF FPC}
LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase, LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
{$ELSE} {$ELSE}
@@ -58,15 +58,24 @@ uses
{$ENDIF} {$ENDIF}
ExtCtrls, SyncObjs, SysUtils, ExtCtrls, SyncObjs, SysUtils,
{$ENDIF} {$ENDIF}
uCEFConstants; {$IFDEF MSWINDOWS}uCEFOSRIMEHandler,{$ENDIF} uCEFConstants, uCEFTypes;
type type
TOnIMECommitTextEvent = procedure(Sender: TObject; const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer) of object;
TOnIMESetCompositionEvent = procedure(Sender: TObject; const aText : ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : TCefRange) of object;
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF} {$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
TBufferPanel = class(TCustomPanel) TBufferPanel = class(TCustomPanel)
protected protected
FMutex : THandle; FMutex : THandle;
FBuffer : TBitmap; FBuffer : TBitmap;
FScanlineSize : integer; FScanlineSize : integer;
{$IFDEF MSWINDOWS}
FIMEHandler : TCEFOSRIMEHandler;
FOnIMECancelComposition : TNotifyEvent;
FOnIMECommitText : TOnIMECommitTextEvent;
FOnIMESetComposition : TOnIMESetCompositionEvent;
{$ENDIF}
procedure CreateSyncObj; procedure CreateSyncObj;
@@ -81,8 +90,14 @@ type
function SaveBufferToFile(const aFilename : string) : boolean; function SaveBufferToFile(const aFilename : string) : boolean;
procedure Paint; override; procedure Paint; override;
{$IFDEF MSWINDOWS}
procedure WndProc(var aMessage: TMessage); override;
procedure WMEraseBkgnd(var aMessage : TWMEraseBkgnd); message WM_ERASEBKGND; procedure WMEraseBkgnd(var aMessage : TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMIMEStartComp(var aMessage: TMessage);
procedure WMIMEEndComp(var aMessage: TMessage);
procedure WMIMESetContext(var aMessage: TMessage);
procedure WMIMEComposition(var aMessage: TMessage);
{$ENDIF}
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@@ -95,6 +110,8 @@ type
procedure BufferDraw(x, y : integer; const aBitmap : TBitmap); procedure BufferDraw(x, y : integer; const aBitmap : TBitmap);
function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean; function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
function BufferIsResized(aUseMutex : boolean = True) : boolean; function BufferIsResized(aUseMutex : boolean = True) : boolean;
procedure CreateIMEHandler;
procedure ChangeCompositionRange(const selection_range : TCefRange; const character_bounds : TCefRectDynArray);
property Buffer : TBitmap read FBuffer; property Buffer : TBitmap read FBuffer;
property ScanlineSize : integer read FScanlineSize; property ScanlineSize : integer read FScanlineSize;
@@ -105,6 +122,12 @@ type
property DockManager; property DockManager;
published published
{$IFDEF MSWINDOWS}
property OnIMECancelComposition : TNotifyEvent read FOnIMECancelComposition write FOnIMECancelComposition;
property OnIMECommitText : TOnIMECommitTextEvent read FOnIMECommitText write FOnIMECommitText;
property OnIMESetComposition : TOnIMESetCompositionEvent read FOnIMESetComposition write FOnIMESetComposition;
{$ENDIF}
property Align; property Align;
property Alignment; property Alignment;
property Anchors; property Anchors;
@@ -210,6 +233,13 @@ begin
FMutex := 0; FMutex := 0;
FBuffer := nil; FBuffer := nil;
{$IFDEF MSWINDOWS}
FIMEHandler := nil;
FOnIMECancelComposition := nil;
FOnIMECommitText := nil;
FOnIMESetComposition := nil;
{$ENDIF}
end; end;
destructor TBufferPanel.Destroy; destructor TBufferPanel.Destroy;
@@ -217,6 +247,10 @@ begin
DestroyBuffer; DestroyBuffer;
DestroySyncObj; DestroySyncObj;
{$IFDEF MSWINDOWS}
if (FIMEHandler <> nil) then FreeAndNil(FIMEHandler);
{$ENDIF}
inherited Destroy; inherited Destroy;
end; end;
@@ -225,20 +259,48 @@ begin
inherited AfterConstruction; inherited AfterConstruction;
CreateSyncObj; CreateSyncObj;
{$IFDEF MSWINDOWS}
{$IFNDEF FPC}
ImeMode := imDontCare;
ImeName := '';
{$ENDIF}
{$ENDIF}
end;
procedure TBufferPanel.CreateIMEHandler;
begin
{$IFDEF MSWINDOWS}
if (FIMEHandler = nil) and HandleAllocated then
FIMEHandler := TCEFOSRIMEHandler.Create(Handle);
{$ENDIF}
end;
procedure TBufferPanel.ChangeCompositionRange(const selection_range : TCefRange;
const character_bounds : TCefRectDynArray);
begin
{$IFDEF MSWINDOWS}
if (FIMEHandler <> nil) then
FIMEHandler.ChangeCompositionRange(selection_range, character_bounds);
{$ENDIF}
end; end;
procedure TBufferPanel.CreateSyncObj; procedure TBufferPanel.CreateSyncObj;
begin begin
{$IFDEF MSWINDOWS}
FMutex := CreateMutex(nil, False, nil); FMutex := CreateMutex(nil, False, nil);
{$ENDIF}
end; end;
procedure TBufferPanel.DestroySyncObj; procedure TBufferPanel.DestroySyncObj;
begin begin
{$IFDEF MSWINDOWS}
if (FMutex <> 0) then if (FMutex <> 0) then
begin begin
CloseHandle(FMutex); CloseHandle(FMutex);
FMutex := 0; FMutex := 0;
end; end;
{$ENDIF}
end; end;
procedure TBufferPanel.DestroyBuffer; procedure TBufferPanel.DestroyBuffer;
@@ -279,17 +341,23 @@ end;
function TBufferPanel.InvalidatePanel : boolean; function TBufferPanel.InvalidatePanel : boolean;
begin begin
{$IFDEF MSWINDOWS}
Result := HandleAllocated and PostMessage(Handle, CM_INVALIDATE, 0, 0); Result := HandleAllocated and PostMessage(Handle, CM_INVALIDATE, 0, 0);
{$ENDIF}
end; end;
function TBufferPanel.BeginBufferDraw : boolean; function TBufferPanel.BeginBufferDraw : boolean;
begin begin
{$IFDEF MSWINDOWS}
Result := (FMutex <> 0) and (WaitForSingleObject(FMutex, 5000) = WAIT_OBJECT_0); Result := (FMutex <> 0) and (WaitForSingleObject(FMutex, 5000) = WAIT_OBJECT_0);
{$ENDIF}
end; end;
procedure TBufferPanel.EndBufferDraw; procedure TBufferPanel.EndBufferDraw;
begin begin
{$IFDEF MSWINDOWS}
if (FMutex <> 0) then ReleaseMutex(FMutex); if (FMutex <> 0) then ReleaseMutex(FMutex);
{$ENDIF}
end; end;
function TBufferPanel.CopyBuffer : boolean; function TBufferPanel.CopyBuffer : boolean;
@@ -327,11 +395,130 @@ begin
end; end;
end; end;
{$IFDEF MSWINDOWS}
procedure TBufferPanel.WndProc(var aMessage: TMessage);
begin
case aMessage.Msg of
WM_IME_STARTCOMPOSITION : WMIMEStartComp(aMessage);
WM_IME_COMPOSITION : WMIMEComposition(aMessage);
WM_IME_ENDCOMPOSITION :
begin
WMIMEEndComp(aMessage);
inherited WndProc(aMessage);
end;
WM_IME_SETCONTEXT :
begin
aMessage.LParam := aMessage.LParam and not(ISC_SHOWUICOMPOSITIONWINDOW);
inherited WndProc(aMessage);
WMIMESetContext(aMessage);
end;
else inherited WndProc(aMessage);
end;
end;
procedure TBufferPanel.WMEraseBkgnd(var aMessage : TWMEraseBkgnd); procedure TBufferPanel.WMEraseBkgnd(var aMessage : TWMEraseBkgnd);
begin begin
aMessage.Result := 1; aMessage.Result := 1;
end; end;
procedure TBufferPanel.WMIMEStartComp(var aMessage: TMessage);
begin
if (FIMEHandler <> nil) then
begin
{$IFNDEF FPC}
FInImeComposition := False;
{$ENDIF}
FIMEHandler.CreateImeWindow;
FIMEHandler.MoveImeWindow;
FIMEHandler.ResetComposition;
end;
end;
procedure TBufferPanel.WMIMEEndComp(var aMessage: TMessage);
begin
if assigned(FOnIMECancelComposition) then FOnIMECancelComposition(self);
if (FIMEHandler <> nil) then
begin
FIMEHandler.ResetComposition;
FIMEHandler.DestroyImeWindow;
end;
end;
procedure TBufferPanel.WMIMESetContext(var aMessage: TMessage);
begin
if (FIMEHandler <> nil) then
begin
FIMEHandler.CreateImeWindow;
FIMEHandler.MoveImeWindow;
end;
end;
procedure TBufferPanel.WMIMEComposition(var aMessage: TMessage);
var
TempText : ustring;
TempRange : TCefRange;
TempCompStart : integer;
TempUnderlines : TCefCompositionUnderlineDynArray;
TempSelection : TCefRange;
begin
TempText := '';
TempCompStart := 0;
TempUnderlines := nil;
try
if (FIMEHandler <> nil) then
begin
if FIMEHandler.GetResult(aMessage.LParam, TempText) then
begin
if assigned(FOnIMECommitText) then
begin
TempRange.from := high(Integer);
TempRange.to_ := high(Integer);
FOnIMECommitText(self, TempText, @TempRange, 0);
end;
FIMEHandler.ResetComposition;
end;
if FIMEHandler.GetComposition(aMessage.LParam, TempText, TempUnderlines, TempCompStart) then
begin
if assigned(FOnIMESetComposition) then
begin
TempRange.from := high(Integer);
TempRange.to_ := high(Integer);
TempSelection.from := TempCompStart;
TempSelection.to_ := TempCompStart + length(TempText);
FOnIMESetComposition(self, TempText, TempUnderlines, TempRange, TempSelection);
end;
FIMEHandler.UpdateCaretPosition(pred(TempCompStart));
end
else
begin
if assigned(FOnIMECancelComposition) then FOnIMECancelComposition(self);
FIMEHandler.ResetComposition;
FIMEHandler.DestroyImeWindow;
end;
end;
finally
if (TempUnderlines <> nil) then
begin
Finalize(TempUnderlines);
TempUnderlines := nil;
end;
end;
end;
{$ENDIF}
function TBufferPanel.GetBufferBits : pointer; function TBufferPanel.GetBufferBits : pointer;
begin begin
if (FBuffer <> nil) then if (FBuffer <> nil) then

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -67,8 +67,13 @@ const
CEF_CHROMEELF_VERSION_RELEASE = 3578; CEF_CHROMEELF_VERSION_RELEASE = 3578;
CEF_CHROMEELF_VERSION_BUILD = 80; CEF_CHROMEELF_VERSION_BUILD = 80;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll'; LIBCEF_DLL = 'libcef.dll';
CHROMEELF_DLL = 'chrome_elf.dll'; CHROMEELF_DLL = 'chrome_elf.dll';
{$ELSE}
LIBCEF_DLL = 'libcef.so';
CHROMEELF_DLL = '';
{$ENDIF}
type type
TCefApplication = class TCefApplication = class
@@ -271,7 +276,9 @@ type
function SingleExeProcessing : boolean; function SingleExeProcessing : boolean;
function CheckCEFLibrary : boolean; function CheckCEFLibrary : boolean;
procedure RegisterWidevineCDM; procedure RegisterWidevineCDM;
{$IFDEF MSWINDOWS}
function FindFlashDLL(var aFileName : string) : boolean; function FindFlashDLL(var aFileName : string) : boolean;
{$ENDIF}
procedure ShowErrorMessageDlg(const aError : string); virtual; procedure ShowErrorMessageDlg(const aError : string); virtual;
function ParseProcessType : TCefProcessType; function ParseProcessType : TCefProcessType;
@@ -601,7 +608,9 @@ begin
FChromeVersionInfo.Release := CEF_CHROMEELF_VERSION_RELEASE; FChromeVersionInfo.Release := CEF_CHROMEELF_VERSION_RELEASE;
FChromeVersionInfo.Build := CEF_CHROMEELF_VERSION_BUILD; FChromeVersionInfo.Build := CEF_CHROMEELF_VERSION_BUILD;
{$IFDEF MSWINDOWS}
if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo); if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
{$ENDIF}
IsMultiThread := True; IsMultiThread := True;
@@ -808,7 +817,9 @@ begin
else else
FFrameworkDirPath := ''; FFrameworkDirPath := '';
{$IFDEF MSWINDOWS}
if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo); if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
{$ENDIF}
end; end;
procedure TCefApplication.SetResourcesDirPath(const aValue : ustring); procedure TCefApplication.SetResourcesDirPath(const aValue : ustring);
@@ -858,6 +869,9 @@ var
TempMachine : integer; TempMachine : integer;
TempVersionInfo : TFileVersionInfo; TempVersionInfo : TFileVersionInfo;
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
@@ -894,7 +908,6 @@ begin
CEF_SUPPORTED_VERSION_RELEASE, CEF_SUPPORTED_VERSION_RELEASE,
CEF_SUPPORTED_VERSION_BUILD) then CEF_SUPPORTED_VERSION_BUILD) then
begin begin
{$IFDEF MSWINDOWS}
if GetDLLHeaderMachine(LibCefPath, TempMachine) then if GetDLLHeaderMachine(LibCefPath, TempMachine) then
case TempMachine of case TempMachine of
CEF_IMAGE_FILE_MACHINE_I386 : CEF_IMAGE_FILE_MACHINE_I386 :
@@ -937,9 +950,6 @@ begin
end end
else else
Result := True; Result := True;
{$ELSE}
Result := True;
{$ENDIF}
end end
else else
begin begin
@@ -959,6 +969,7 @@ begin
if FSetCurrentDir then chdir(TempOldDir); if FSetCurrentDir then chdir(TempOldDir);
end; end;
{$ENDIF}
end; end;
function TCefApplication.StartMainProcess : boolean; function TCefApplication.StartMainProcess : boolean;
@@ -1173,7 +1184,11 @@ begin
TempNewDir := TempOldDir + '(' + inttostr(i) + ')'; TempNewDir := TempOldDir + '(' + inttostr(i) + ')';
until not(DirectoryExists(TempNewDir)); until not(DirectoryExists(TempNewDir));
{$IFDEF MSWINDOWS}
if MoveFileW(PWideChar(TempOldDir + chr(0)), PWideChar(TempNewDir + chr(0))) then if MoveFileW(PWideChar(TempOldDir + chr(0)), PWideChar(TempNewDir + chr(0))) then
{$ELSE}
if RenameFile(TempOldDir, TempNewDir) then
{$ENDIF}
begin begin
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir); TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
{$IFDEF DELPHI14_UP} {$IFDEF DELPHI14_UP}
@@ -1216,6 +1231,7 @@ begin
end; end;
end; end;
{$IFDEF MSWINDOWS}
function TCefApplication.FindFlashDLL(var aFileName : string) : boolean; function TCefApplication.FindFlashDLL(var aFileName : string) : boolean;
var var
TempSearchRec : TSearchRec; TempSearchRec : TSearchRec;
@@ -1249,6 +1265,7 @@ begin
if CustomExceptionHandler('TCefApplication.FindFlashDLL', e) then raise; if CustomExceptionHandler('TCefApplication.FindFlashDLL', e) then raise;
end; end;
end; end;
{$ENDIF}
procedure TCefApplication.ShowErrorMessageDlg(const aError : string); procedure TCefApplication.ShowErrorMessageDlg(const aError : string);
begin begin
@@ -1443,6 +1460,7 @@ var
begin begin
if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then
begin begin
{$IFDEF MSWINDOWS}
if FindFlashDLL(TempFileName) and if FindFlashDLL(TempFileName) and
GetDLLVersion(TempFileName, TempVersionInfo) then GetDLLVersion(TempFileName, TempVersionInfo) then
begin begin
@@ -1453,6 +1471,7 @@ begin
commandLine.AppendSwitchWithValue('--ppapi-flash-version', FileVersionInfoToString(TempVersionInfo)); commandLine.AppendSwitchWithValue('--ppapi-flash-version', FileVersionInfoToString(TempVersionInfo));
end end
else else
{$ENDIF}
if FFlashEnabled then if FFlashEnabled then
begin begin
if FEnableGPU then commandLine.AppendSwitch('--enable-gpu-plugin'); if FEnableGPU then commandLine.AppendSwitch('--enable-gpu-plugin');
@@ -1779,9 +1798,14 @@ begin
if (FLibHandle = 0) then if (FLibHandle = 0) then
begin begin
FStatus := asErrorLoadingLibrary; FStatus := asErrorLoadingLibrary;
{$IFDEF MSWINDOWS}
TempString := 'Error loading libcef.dll' + CRLF + CRLF + TempString := 'Error loading libcef.dll' + CRLF + CRLF +
'Error code : 0x' + inttohex(GetLastError, 8); 'Error code : 0x' + inttohex(GetLastError, 8);
{$ELSE}
TempString := 'Error loading the CEF binaries';
{$ENDIF}
ShowErrorMessageDlg(TempString); ShowErrorMessageDlg(TempString);
exit; exit;

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -131,7 +131,7 @@ type
procedure NotifyMoveOrResizeStarted; procedure NotifyMoveOrResizeStarted;
function GetWindowlessFrameRate : Integer; function GetWindowlessFrameRate : Integer;
procedure SetWindowlessFrameRate(frameRate: Integer); procedure SetWindowlessFrameRate(frameRate: Integer);
procedure IMESetComposition(const text: ustring; underlinesCount : NativeUInt; const underlines : PCefCompositionUnderline; const replacement_range, selection_range : PCefRange); procedure IMESetComposition(const text: ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : PCefRange);
procedure IMECommitText(const text: ustring; const replacement_range : PCefRange; relative_cursor_pos : integer); procedure IMECommitText(const text: ustring; const replacement_range : PCefRange; relative_cursor_pos : integer);
procedure IMEFinishComposingText(keep_selection : boolean); procedure IMEFinishComposingText(keep_selection : boolean);
procedure IMECancelComposition; procedure IMECancelComposition;
@@ -577,20 +577,50 @@ begin
end; end;
procedure TCefBrowserHostRef.IMESetComposition(const text : ustring; procedure TCefBrowserHostRef.IMESetComposition(const text : ustring;
underlinesCount : NativeUInt; const underlines : TCefCompositionUnderlineDynArray;
const underlines : PCefCompositionUnderline;
const replacement_range : PCefRange; const replacement_range : PCefRange;
const selection_range : PCefRange); const selection_range : PCefRange);
var var
TempString : TCefString; TempString : TCefString;
TempCount, i : NativeUInt;
TempUnderlines : PCefCompositionUnderline;
TempItem : PCefCompositionUnderline;
begin begin
TempString := CefString(text); TempCount := 0;
PCefBrowserHost(FData)^.ime_set_composition(PCefBrowserHost(FData), TempUnderlines := nil;
@TempString,
underlinesCount, try
underlines, TempString := CefString(text);
replacement_range,
selection_range); if (underlines <> nil) then
begin
TempCount := length(underlines);
GetMem(TempUnderlines, TempCount * SizeOf(TCefCompositionUnderline));
TempItem := TempUnderlines;
i := 0;
while (i < TempCount) do
begin
TempItem^.range := underlines[i].range;
TempItem^.color := underlines[i].color;
TempItem^.background_color := underlines[i].background_color;
TempItem^.thick := underlines[i].thick;
inc(i);
inc(TempItem);
end;
end;
PCefBrowserHost(FData)^.ime_set_composition(PCefBrowserHost(FData),
@TempString,
TempCount,
TempUnderlines,
replacement_range,
selection_range);
finally
if (TempUnderlines <> nil) then FreeMem(TempUnderlines);
end;
end; end;
procedure TCefBrowserHostRef.IMECommitText(const text: ustring; const replacement_range : PCefRange; relative_cursor_pos : integer); procedure TCefBrowserHostRef.IMECommitText(const text: ustring; const replacement_range : PCefRange; relative_cursor_pos : integer);

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -252,7 +252,7 @@ type
function GetZoomLevel : double; function GetZoomLevel : double;
function GetZoomPct : double; function GetZoomPct : double;
function GetIsPopUp : boolean; function GetIsPopUp : boolean;
function GetWindowHandle : THandle; function GetWindowHandle : TCefWindowHandle;
function GetWindowlessFrameRate : integer; function GetWindowlessFrameRate : integer;
function GetFrameIsFocused : boolean; function GetFrameIsFocused : boolean;
function GetInitialized : boolean; function GetInitialized : boolean;
@@ -331,8 +331,9 @@ type
function MustCreateJsDialogHandler : boolean; virtual; function MustCreateJsDialogHandler : boolean; virtual;
function MustCreateDragHandler : boolean; virtual; function MustCreateDragHandler : boolean; virtual;
function MustCreateFindHandler : boolean; virtual; function MustCreateFindHandler : boolean; virtual;
{$IFDEF MSWINDOWS}
procedure PrefsAvailableMsg(var aMessage : TMessage); procedure PrefsAvailableMsg(var aMessage : TMessage);
{$ENDIF}
function GetParentForm : TCustomForm; function GetParentForm : TCustomForm;
procedure ApplyZoomStep; procedure ApplyZoomStep;
procedure DelayedDragging; procedure DelayedDragging;
@@ -342,10 +343,12 @@ type
procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual; procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual;
procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual; procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual;
procedure FreeAndNilStub(var aStub : pointer); {$IFDEF MSWINDOWS}
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
procedure WndProc(var aMessage: TMessage); procedure WndProc(var aMessage: TMessage);
{$IFNDEF FPC} {$ENDIF}
{$IFNDEF FPC}
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
procedure FreeAndNilStub(var aStub : pointer);
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);
@@ -564,6 +567,11 @@ type
procedure DragSourceEndedAt(x, y: Integer; op: TCefDragOperation); procedure DragSourceEndedAt(x, y: Integer; op: TCefDragOperation);
procedure DragSourceSystemDragEnded; procedure DragSourceSystemDragEnded;
procedure IMESetComposition(const text: ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : PCefRange);
procedure IMECommitText(const text: ustring; const replacement_range : PCefRange; relative_cursor_pos : integer);
procedure IMEFinishComposingText(keep_selection : boolean);
procedure IMECancelComposition;
property DefaultUrl : ustring read FDefaultUrl write FDefaultUrl; property DefaultUrl : ustring read FDefaultUrl write FDefaultUrl;
property Options : TChromiumOptions read FOptions write FOptions; property Options : TChromiumOptions read FOptions write FOptions;
@@ -585,7 +593,7 @@ type
property CanGoBack : boolean read GetCanGoBack; property CanGoBack : boolean read GetCanGoBack;
property CanGoForward : boolean read GetCanGoForward; property CanGoForward : boolean read GetCanGoForward;
property IsPopUp : boolean read GetIsPopUp; property IsPopUp : boolean read GetIsPopUp;
property WindowHandle : THandle read GetWindowHandle; property WindowHandle : TCefWindowHandle read GetWindowHandle;
property BrowserHandle : THandle read FBrowserCompHWND; property BrowserHandle : THandle read FBrowserCompHWND;
property WidgetHandle : THandle read FWidgetCompHWND; property WidgetHandle : THandle read FWidgetCompHWND;
property RenderHandle : THandle read FRenderCompHWND; property RenderHandle : THandle read FRenderCompHWND;
@@ -793,7 +801,7 @@ begin
FBrowserCompStub := nil; FBrowserCompStub := nil;
FWidgetCompStub := nil; FWidgetCompStub := nil;
FRenderCompStub := nil; FRenderCompStub := nil;
{$ENDIF} {$ENDIF}
FBrowserCompHWND := 0; FBrowserCompHWND := 0;
FWidgetCompHWND := 0; FWidgetCompHWND := 0;
FRenderCompHWND := 0; FRenderCompHWND := 0;
@@ -893,6 +901,7 @@ begin
FBrowserId := 0; FBrowserId := 0;
end; end;
{$IFNDEF FPC}
procedure TChromium.CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure TChromium.CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
begin begin
if (aStub = nil) then aStub := MakeObjectInstance(aMethod); if (aStub = nil) then aStub := MakeObjectInstance(aMethod);
@@ -906,6 +915,7 @@ begin
aStub := nil; aStub := nil;
end; end;
end; end;
{$ENDIF}
procedure TChromium.DestroyClientHandler; procedure TChromium.DestroyClientHandler;
begin begin
@@ -933,8 +943,10 @@ begin
if not(csDesigning in ComponentState) then if not(csDesigning in ComponentState) then
begin begin
{$IFDEF FPC} {$IFDEF FPC}
{$IFDEF MSWINDOWS}
TempWndMethod := @WndProc; TempWndMethod := @WndProc;
FCompHandle := AllocateHWnd(TempWndMethod); FCompHandle := AllocateHWnd(TempWndMethod);
{$ENDIF}
{$ELSE} {$ELSE}
FCompHandle := AllocateHWnd(WndProc); FCompHandle := AllocateHWnd(WndProc);
{$ENDIF} {$ENDIF}
@@ -1182,23 +1194,39 @@ procedure TChromium.InitializeWindowInfo( aParentHandle : HWND;
aParentRect : TRect; aParentRect : TRect;
const aWindowName : ustring); const aWindowName : ustring);
begin begin
{$IFDEF MSWINDOWS}
if FIsOSR then if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName) WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName)
else else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName); WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
{$ELSE}
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, FCompHandle)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect);
{$ENDIF}
end; end;
procedure TChromium.InitializeDevToolsWindowInfo(aDevTools : TWinControl); procedure TChromium.InitializeDevToolsWindowInfo(aDevTools : TWinControl);
begin begin
{$IFDEF MSWINDOWS}
if (aDevTools <> nil) then if (aDevTools <> nil) then
WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name) WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name)
else else
WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME); WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME);
{$ELSE}
if (aDevTools <> nil) then
WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect)
else
WindowInfoAsPopUp(FDevWindowInfo, WindowHandle);
{$ENDIF}
end; end;
procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl : TWinControl); procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl : TWinControl);
{$IFNDEF FPC}
var var
TempDropTarget : IDropTarget; TempDropTarget : IDropTarget;
{$ENDIF}
begin begin
{$IFNDEF FPC} {$IFNDEF FPC}
if FIsOSR and if FIsOSR and
@@ -1238,15 +1266,18 @@ end;
procedure TChromium.ShutdownDragAndDrop; procedure TChromium.ShutdownDragAndDrop;
begin begin
{$IFDEF MSWINDOWS}
if FDragAndDropInitialized and (FDropTargetCtrl <> nil) then if FDragAndDropInitialized and (FDropTargetCtrl <> nil) then
begin begin
RevokeDragDrop(FDropTargetCtrl.Handle); RevokeDragDrop(FDropTargetCtrl.Handle);
FDragAndDropInitialized := False; FDragAndDropInitialized := False;
end; end;
{$ENDIF}
end; end;
procedure TChromium.ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent); procedure TChromium.ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent);
begin begin
{$IFDEF MSWINDOWS}
if (FDropTargetCtrl <> nil) then if (FDropTargetCtrl <> nil) then
begin begin
pt := FDropTargetCtrl.ScreenToClient(pt); pt := FDropTargetCtrl.ScreenToClient(pt);
@@ -1254,6 +1285,7 @@ begin
aMouseEvent.y := pt.y; aMouseEvent.y := pt.y;
aMouseEvent.modifiers := GetCefMouseModifiers(grfKeyState); aMouseEvent.modifiers := GetCefMouseModifiers(grfKeyState);
end; end;
{$ENDIF}
end; end;
procedure TChromium.DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint); procedure TChromium.DragDropManager_OnDragEnter(Sender: TObject; const aDragData : ICefDragData; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint);
@@ -1263,6 +1295,7 @@ var
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
{$IFDEF MSWINDOWS}
ToMouseEvent(grfKeyState, pt, TempMouseEvent); ToMouseEvent(grfKeyState, pt, TempMouseEvent);
DropEffectToDragOperation(dwEffect, TempAllowedOps); DropEffectToDragOperation(dwEffect, TempAllowedOps);
DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor); DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor);
@@ -1271,6 +1304,7 @@ begin
DragTargetDragOver(@TempMouseEvent, TempAllowedOps); DragTargetDragOver(@TempMouseEvent, TempAllowedOps);
DragOperationToDropEffect(FDragOperations, dwEffect); DragOperationToDropEffect(FDragOperations, dwEffect);
{$ENDIF}
end; end;
end; end;
@@ -1281,6 +1315,7 @@ var
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
{$IFDEF MSWINDOWS}
ToMouseEvent(grfKeyState, pt, TempMouseEvent); ToMouseEvent(grfKeyState, pt, TempMouseEvent);
DropEffectToDragOperation(dwEffect, TempAllowedOps); DropEffectToDragOperation(dwEffect, TempAllowedOps);
DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor); DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor);
@@ -1288,6 +1323,7 @@ begin
DragTargetDragOver(@TempMouseEvent, TempAllowedOps); DragTargetDragOver(@TempMouseEvent, TempAllowedOps);
DragOperationToDropEffect(FDragOperations, dwEffect); DragOperationToDropEffect(FDragOperations, dwEffect);
{$ENDIF}
end; end;
end; end;
@@ -1303,6 +1339,7 @@ var
begin begin
if (GlobalCEFApp <> nil) then if (GlobalCEFApp <> nil) then
begin begin
{$IFDEF MSWINDOWS}
ToMouseEvent(grfKeyState, pt, TempMouseEvent); ToMouseEvent(grfKeyState, pt, TempMouseEvent);
DropEffectToDragOperation(dwEffect, TempAllowedOps); DropEffectToDragOperation(dwEffect, TempAllowedOps);
DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor); DeviceToLogical(TempMouseEvent, GlobalCEFApp.DeviceScaleFactor);
@@ -1311,6 +1348,7 @@ begin
DragTargetDrop(@TempMouseEvent); DragTargetDrop(@TempMouseEvent);
DragOperationToDropEffect(FDragOperations, dwEffect); DragOperationToDropEffect(FDragOperations, dwEffect);
{$ENDIF}
end; end;
end; end;
@@ -1688,7 +1726,7 @@ begin
Result := (FBrowser <> nil); Result := (FBrowser <> nil);
end; end;
function TChromium.GetWindowHandle : THandle; function TChromium.GetWindowHandle : TCefWindowHandle;
begin begin
if Initialized then if Initialized then
Result := FBrowser.Host.WindowHandle Result := FBrowser.Host.WindowHandle
@@ -2258,6 +2296,7 @@ var
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
if not(FIsOSR) then if not(FIsOSR) then
begin begin
TempHWND := GetWindowHandle; TempHWND := GetWindowHandle;
@@ -2282,6 +2321,7 @@ begin
ReleaseDC(TempHWND, TempDC); ReleaseDC(TempHWND, TempDC);
end; end;
end; end;
{$ENDIF}
end; end;
function TChromium.IsSameBrowser(const aBrowser : ICefBrowser) : boolean; function TChromium.IsSameBrowser(const aBrowser : ICefBrowser) : boolean;
@@ -2813,6 +2853,7 @@ var
TempPrefs : TStringList; TempPrefs : TStringList;
begin begin
Result := False; Result := False;
{$IFDEF MSWINDOWS}
TempPrefs := nil; TempPrefs := nil;
try try
@@ -2833,6 +2874,7 @@ begin
SendCompMessage(CEF_PREFERENCES_SAVED, Ord(Result)); SendCompMessage(CEF_PREFERENCES_SAVED, Ord(Result));
if (TempPrefs <> nil) then FreeAndNil(TempPrefs); if (TempPrefs <> nil) then FreeAndNil(TempPrefs);
end; end;
{$ENDIF}
end; end;
procedure TChromium.doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); procedure TChromium.doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings);
@@ -2912,10 +2954,12 @@ begin
Result := assigned(FOnFindResult); Result := assigned(FOnFindResult);
end; end;
{$IFDEF MSWINDOWS}
procedure TChromium.PrefsAvailableMsg(var aMessage : TMessage); procedure TChromium.PrefsAvailableMsg(var aMessage : TMessage);
begin begin
if assigned(FOnPrefsAvailable) then FOnPrefsAvailable(self, (aMessage.WParam <> 0)); if assigned(FOnPrefsAvailable) then FOnPrefsAvailable(self, (aMessage.WParam <> 0));
end; end;
{$ENDIF}
function TChromium.SendCompMessage(aMsg : cardinal; wParam : cardinal; lParam : integer) : boolean; function TChromium.SendCompMessage(aMsg : cardinal; wParam : cardinal; lParam : integer) : boolean;
begin begin
@@ -3035,14 +3079,17 @@ begin
{$IFDEF DELPHI16_UP} {$IFDEF DELPHI16_UP}
WinApi.Windows.SetParent(GetWindow(aDevTools.Handle, GW_CHILD), 0); WinApi.Windows.SetParent(GetWindow(aDevTools.Handle, GW_CHILD), 0);
{$ELSE} {$ELSE}
{$IFDEF MSWINDOWS}
Windows.SetParent(GetWindow(aDevTools.Handle, GW_CHILD), 0); Windows.SetParent(GetWindow(aDevTools.Handle, GW_CHILD), 0);
{$ENDIF} {$ENDIF}
{$ENDIF}
end; end;
if (FBrowser <> nil) then FBrowser.Host.CloseDevTools; if (FBrowser <> nil) then FBrowser.Host.CloseDevTools;
end; end;
end; end;
{$IFDEF MSWINDOWS}
procedure TChromium.WndProc(var aMessage: TMessage); procedure TChromium.WndProc(var aMessage: TMessage);
begin begin
case aMessage.Msg of case aMessage.Msg of
@@ -3052,6 +3099,7 @@ begin
else aMessage.Result := DefWindowProc(FCompHandle, aMessage.Msg, aMessage.WParam, aMessage.LParam); else aMessage.Result := DefWindowProc(FCompHandle, aMessage.Msg, aMessage.WParam, aMessage.LParam);
end; end;
end; end;
{$ENDIF}
{$IFNDEF FPC} {$IFNDEF FPC}
procedure TChromium.BrowserCompWndProc(var aMessage: TMessage); procedure TChromium.BrowserCompWndProc(var aMessage: TMessage);
@@ -3642,13 +3690,13 @@ begin
(browser.Identifier = FBrowserId) then (browser.Identifier = FBrowserId) then
begin begin
FBrowserCompHWND := browser.Host.WindowHandle; FBrowserCompHWND := browser.Host.WindowHandle;
{$IFDEF MSWINDOWS}
if (FBrowserCompHWND <> 0) then if (FBrowserCompHWND <> 0) then
FWidgetCompHWND := FindWindowEx(FBrowserCompHWND, 0, 'Chrome_WidgetWin_0', ''); FWidgetCompHWND := FindWindowEx(FBrowserCompHWND, 0, 'Chrome_WidgetWin_0', '');
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');
{$ENDIF}
{$IFNDEF FPC} {$IFNDEF FPC}
if assigned(FOnBrowserCompMsg) and (FBrowserCompHWND <> 0) and (FOldBrowserCompWndPrc = nil) then if assigned(FOnBrowserCompMsg) and (FBrowserCompHWND <> 0) and (FOldBrowserCompWndPrc = nil) then
begin begin
@@ -4043,6 +4091,33 @@ begin
if Initialized then FBrowser.Host.DragSourceSystemDragEnded; if Initialized then FBrowser.Host.DragSourceSystemDragEnded;
end; end;
procedure TChromium.IMESetComposition(const text : ustring;
const underlines : TCefCompositionUnderlineDynArray;
const replacement_range : PCefRange;
const selection_range : PCefRange);
begin
if Initialized then
FBrowser.Host.IMESetComposition(text, underlines, replacement_range, selection_range);
end;
procedure TChromium.IMECommitText(const text : ustring;
const replacement_range : PCefRange;
relative_cursor_pos : integer);
begin
if Initialized then
FBrowser.Host.IMECommitText(text, replacement_range, relative_cursor_pos);
end;
procedure TChromium.IMEFinishComposingText(keep_selection : boolean);
begin
if Initialized then FBrowser.Host.IMEFinishComposingText(keep_selection);
end;
procedure TChromium.IMECancelComposition;
begin
if Initialized then FBrowser.Host.IMECancelComposition;
end;
{$IFDEF FPC} {$IFDEF FPC}
procedure Register; procedure Register;
begin begin

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************
@@ -72,6 +72,7 @@ type
FUseSetFocus : boolean; FUseSetFocus : boolean;
function GetBrowserInitialized : boolean; function GetBrowserInitialized : boolean;
{$IFDEF MSWINDOWS}
function GetChildWindowHandle : THandle; override; function GetChildWindowHandle : THandle; override;
procedure WndProc(var aMessage: TMessage); override; procedure WndProc(var aMessage: TMessage); override;
@@ -79,7 +80,7 @@ type
procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE; procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;
procedure OnBeforeCloseMsg(var aMessage : TMessage); message CEF_DOONBEFORECLOSE; procedure OnBeforeCloseMsg(var aMessage : TMessage); message CEF_DOONBEFORECLOSE;
procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
{$ENDIF}
procedure WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); procedure WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser); procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
@@ -139,6 +140,7 @@ begin
end; end;
end; end;
{$IFDEF MSWINDOWS}
function TChromiumWindow.GetChildWindowHandle : THandle; function TChromiumWindow.GetChildWindowHandle : THandle;
begin begin
Result := 0; Result := 0;
@@ -180,6 +182,7 @@ begin
else inherited WndProc(aMessage); else inherited WndProc(aMessage);
end; end;
end; end;
{$ENDIF}
function TChromiumWindow.GetBrowserInitialized : boolean; function TChromiumWindow.GetBrowserInitialized : boolean;
begin begin
@@ -188,25 +191,31 @@ end;
procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
begin begin
Result := False;
{$IFDEF MSWINDOWS}
if assigned(FOnClose) then if assigned(FOnClose) then
begin begin
PostMessage(Handle, CEF_DOONCLOSE, 0, 0); PostMessage(Handle, CEF_DOONCLOSE, 0, 0);
Result := True; Result := True;
end end;
else {$ENDIF}
Result := False;
end; end;
procedure TChromiumWindow.WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); procedure TChromiumWindow.WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
begin begin
{$IFDEF MSWINDOWS}
if assigned(FOnBeforeClose) then PostMessage(Handle, CEF_DOONBEFORECLOSE, 0, 0); if assigned(FOnBeforeClose) then PostMessage(Handle, CEF_DOONBEFORECLOSE, 0, 0);
{$ENDIF}
end; end;
procedure TChromiumWindow.WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser); procedure TChromiumWindow.WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
begin begin
{$IFDEF MSWINDOWS}
PostMessage(Handle, CEF_AFTERCREATED, 0, 0); PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
{$ENDIF}
end; end;
{$IFDEF MSWINDOWS}
procedure TChromiumWindow.OnCloseMsg(var aMessage : TMessage); procedure TChromiumWindow.OnCloseMsg(var aMessage : TMessage);
begin begin
if assigned(FOnClose) then FOnClose(self); if assigned(FOnClose) then FOnClose(self);
@@ -222,6 +231,7 @@ begin
UpdateSize; UpdateSize;
if assigned(FOnAfterCreated) then FOnAfterCreated(self); if assigned(FOnAfterCreated) then FOnAfterCreated(self);
end; end;
{$ENDIF}
function TChromiumWindow.CreateBrowser : boolean; function TChromiumWindow.CreateBrowser : boolean;
begin begin

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

View File

@@ -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 Diaz Fau. All rights reserved. // Copyright � 2019 Salvador Diaz Fau. All rights reserved.
// //
// ************************************************************************ // ************************************************************************
// ************ vvvv Original license and comments below vvvv ************* // ************ vvvv Original license and comments below vvvv *************

Some files were not shown because too many files have changed in this diff Show More