1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Fixed OSRExternalPumpBrowser in Linux

Fixed SimpleOSRBrowser in Linux
Added the TBufferPanel.CopyOriginalBuffer property
Added the TBufferPanel.MustInitBuffer property
Added the TBufferPanel.OrigBuffer property
Added the TBufferPanel.OrigBufferWidth property
Added the TBufferPanel.OrigBufferHeight property
Renamed TBufferPanel.PopupBuffer to TBufferPanel.OrigPopupBuffer
Renamed TBufferPanel.PopupBufferWidth to TBufferPanel.OrigPopupBufferWidth
Renamed TBufferPanel.PopupBufferHeight to TBufferPanel.OrigPopupBufferHeight
Renamed TBufferPanel.PopupBufferBits to TBufferPanel.OrigPopupBufferBits
Renamed TBufferPanel.PopupScanlineSize to TBufferPanel.OrigPopupScanlineSize
Added the TBufferPanel.UpdateOrigBufferDimensions function
Added the TBufferPanel.UpdateOrigPopupBufferDimensions function
This commit is contained in:
Salvador Diaz Fau
2021-01-12 17:06:31 +01:00
parent 1fca56f298
commit 123f45ea08
10 changed files with 667 additions and 517 deletions

View File

@@ -7,7 +7,7 @@
<Unit0>
<Filename Value="MiniBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="6"/>
<EditorIndex Value="1"/>
<TopLine Value="26"/>
<CursorPos X="62" Y="52"/>
<UsageCount Value="22"/>
@@ -20,7 +20,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="183"/>
<TopLine Value="187"/>
<CursorPos Y="352"/>
<FoldState Value=" TJmA1{32 pjZlg1@4 pmOoL1{D1q"/>
<UsageCount Value="22"/>
@@ -70,33 +70,30 @@
</Unit6>
<Unit7>
<Filename Value="../../../source/uCEFChromium.pas"/>
<EditorIndex Value="5"/>
<EditorIndex Value="-1"/>
<TopLine Value="130"/>
<CursorPos X="3" Y="146"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<EditorIndex Value="1"/>
<EditorIndex Value="-1"/>
<TopLine Value="780"/>
<CursorPos X="70" Y="807"/>
<UsageCount Value="10"/>
<Bookmarks Count="1">
<Item0 X="68" Y="793" ID="2"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<EditorIndex Value="3"/>
<EditorIndex Value="-1"/>
<TopLine Value="1950"/>
<CursorPos X="71" Y="1975"/>
<UsageCount Value="10"/>
<Bookmarks Count="1">
<Item0 X="56" Y="1966" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/gtk+/gtk/gtkwidget.inc"/>
@@ -107,144 +104,42 @@
</Unit10>
<Unit11>
<Filename Value="../../../source/uCEFTypes.pas"/>
<EditorIndex Value="2"/>
<EditorIndex Value="-1"/>
<TopLine Value="1228"/>
<CursorPos X="53" Y="1251"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
<EditorIndex Value="4"/>
<EditorIndex Value="-1"/>
<TopLine Value="220"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit12>
</Units>
<OtherDefines Count="1">
<Define0 Value="UseCThreads"/>
</OtherDefines>
<JumpHistory Count="30" HistoryIndex="29">
<JumpHistory Count="5" HistoryIndex="4">
<Position1>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="173" Column="11" TopLine="150"/>
</Position1>
<Position2>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="786" TopLine="767"/>
</Position2>
<Position3>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="142" Column="49" TopLine="121"/>
</Position3>
<Position4>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="148" Column="45" TopLine="121"/>
</Position4>
<Position5>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="447" Column="17" TopLine="426"/>
</Position5>
<Position6>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="1956" Column="3" TopLine="1950"/>
</Position6>
<Position7>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="173" Column="11" TopLine="150"/>
</Position7>
<Position8>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="790" Column="3" TopLine="786"/>
</Position8>
<Position9>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="772" Column="17" TopLine="749"/>
</Position9>
<Position10>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="865" TopLine="829"/>
</Position10>
<Position11>
</Position1>
<Position2>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="158" Column="15" TopLine="137"/>
</Position11>
<Position12>
</Position2>
<Position3>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="863" Column="3" TopLine="829"/>
</Position12>
<Position13>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="76" Column="17" TopLine="53"/>
</Position13>
<Position14>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="157" Column="3" TopLine="146"/>
</Position14>
<Position15>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="70" Column="17" TopLine="47"/>
</Position15>
<Position16>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="146" Column="3" TopLine="133"/>
</Position16>
<Position17>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="447" Column="17" TopLine="426"/>
</Position17>
<Position18>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="1956" Column="3" TopLine="1950"/>
</Position18>
<Position19>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="173" Column="11" TopLine="150"/>
</Position19>
<Position20>
</Position3>
<Position4>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="849" Column="74" TopLine="829"/>
</Position20>
<Position21>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="76" Column="17" TopLine="53"/>
</Position21>
<Position22>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="157" Column="3" TopLine="140"/>
</Position22>
<Position23>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="70" Column="17" TopLine="48"/>
</Position23>
<Position24>
<Filename Value="../../../source/uCEFChromium.pas"/>
<Caret Line="146" Column="3" TopLine="130"/>
</Position24>
<Position25>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="447" Column="17" TopLine="426"/>
</Position25>
<Position26>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="1964" Column="66" TopLine="1950"/>
</Position26>
<Position27>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="173" Column="11" TopLine="150"/>
</Position27>
<Position28>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<Caret Line="1964" Column="56" TopLine="1950"/>
</Position28>
<Position29>
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
<Caret Line="173" Column="11" TopLine="150"/>
</Position29>
<Position30>
</Position4>
<Position5>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="222" Column="47" TopLine="210"/>
</Position30>
</Position5>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@@ -3,15 +3,14 @@
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="108">
<Units Count="112">
<Unit0>
<Filename Value="OSRExternalPumpBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<EditorIndex Value="-1"/>
<TopLine Value="30"/>
<CursorPos X="37" Y="51"/>
<UsageCount Value="82"/>
<Loaded Value="True"/>
<UsageCount Value="90"/>
</Unit0>
<Unit1>
<Filename Value="uosrexternalpumpbrowser.pas"/>
@@ -21,12 +20,16 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="uOSRExternalPumpBrowser"/>
<IsVisibleTab Value="True"/>
<TopLine Value="221"/>
<CursorPos X="43" Y="250"/>
<UsageCount Value="82"/>
<Bookmarks Count="2">
<Item0 X="47" Y="222" ID="2"/>
<Item1 X="76" Y="520" ID="6"/>
<TopLine Value="158"/>
<CursorPos X="75" Y="192"/>
<UsageCount Value="90"/>
<Bookmarks Count="6">
<Item0 Y="713" ID="2"/>
<Item1 X="9" Y="603" ID="3"/>
<Item2 X="13" Y="316" ID="9"/>
<Item3 Y="690" ID="8"/>
<Item4 X="41" Y="280" ID="7"/>
<Item5 X="52" Y="189" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@@ -37,7 +40,7 @@
<UnitName Value="Interfaces"/>
<EditorIndex Value="-1"/>
<CursorPos X="40" Y="20"/>
<UsageCount Value="78"/>
<UsageCount Value="86"/>
</Unit2>
<Unit3>
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lcltype.pp"/>
@@ -126,25 +129,18 @@
</Unit14>
<Unit15>
<Filename Value="../../../source/uCEFBufferPanel.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="1043"/>
<CursorPos X="3" Y="71"/>
<EditorIndex Value="-1"/>
<TopLine Value="469"/>
<CursorPos X="3" Y="482"/>
<UsageCount Value="29"/>
<Bookmarks Count="4">
<Item0 Y="1010" ID="9"/>
<Item1 X="63" Y="581" ID="8"/>
<Item2 X="5" Y="345" ID="7"/>
<Item3 X="5" Y="375" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit15>
<Unit16>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<EditorIndex Value="-1"/>
<TopLine Value="684"/>
<CursorPos X="31" Y="711"/>
<UsageCount Value="9"/>
<TopLine Value="1458"/>
<CursorPos X="15" Y="1482"/>
<UsageCount Value="10"/>
</Unit16>
<Unit17>
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
@@ -202,8 +198,8 @@
<Filename Value="/usr/share/lazarus/2.0.10/lcl/graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="-1"/>
<TopLine Value="1218"/>
<CursorPos X="14" Y="1240"/>
<TopLine Value="1068"/>
<CursorPos X="109" Y="1097"/>
<UsageCount Value="15"/>
</Unit24>
<Unit25>
@@ -403,8 +399,8 @@
<Unit52>
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1122"/>
<CursorPos Y="1147"/>
<TopLine Value="6966"/>
<CursorPos X="78" Y="6355"/>
<UsageCount Value="10"/>
</Unit52>
<Unit53>
@@ -447,9 +443,9 @@
<Unit58>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/application.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="230"/>
<CursorPos X="3" Y="235"/>
<UsageCount Value="8"/>
<TopLine Value="2281"/>
<CursorPos X="3" Y="2285"/>
<UsageCount Value="10"/>
</Unit58>
<Unit59>
<Filename Value="/usr/share/lazarus/2.0.10/lcl/dialogs.pp"/>
@@ -581,9 +577,9 @@
<Unit76>
<Filename Value="../../../source/uCEFTypes.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="1243"/>
<CursorPos X="9" Y="1271"/>
<UsageCount Value="9"/>
<TopLine Value="781"/>
<CursorPos X="3" Y="804"/>
<UsageCount Value="10"/>
</Unit76>
<Unit77>
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/inc/objpash.inc"/>
@@ -799,20 +795,150 @@
<CursorPos X="77" Y="127"/>
<UsageCount Value="10"/>
</Unit107>
<Unit108>
<Filename Value="../../Lazarus_Windows/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="117"/>
<CursorPos X="73" Y="894"/>
<UsageCount Value="10"/>
</Unit108>
<Unit109>
<Filename Value="../../../source/uCEFChromiumOptions.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="77"/>
<CursorPos X="3" Y="60"/>
<UsageCount Value="10"/>
</Unit109>
<Unit110>
<Filename Value="../SimpleOSRBrowser/usimpleosrbrowser.pas"/>
<UnitName Value="uSimpleOSRBrowser"/>
<EditorIndex Value="-1"/>
<TopLine Value="772"/>
<CursorPos X="9" Y="817"/>
<UsageCount Value="10"/>
</Unit110>
<Unit111>
<Filename Value="../SimpleBrowser2/usimplebrowser2.pas"/>
<UnitName Value="uSimpleBrowser2"/>
<EditorIndex Value="-1"/>
<TopLine Value="16"/>
<CursorPos X="78" Y="45"/>
<UsageCount Value="10"/>
</Unit111>
</Units>
<OtherDefines Count="2">
<Define0 Value="UseCthreads"/>
<Define1 Value="EnabledGtkThreading"/>
</OtherDefines>
<JumpHistory Count="2" HistoryIndex="1">
<JumpHistory Count="27" HistoryIndex="26">
<Position1>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="56" Column="63" TopLine="51"/>
<Caret Line="506" TopLine="491"/>
</Position1>
<Position2>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="234" TopLine="223"/>
<Caret Line="740" TopLine="717"/>
</Position2>
<Position3>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="508" Column="3" TopLine="485"/>
</Position3>
<Position4>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="733" Column="31" TopLine="720"/>
</Position4>
<Position5>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="117" Column="15" TopLine="95"/>
</Position5>
<Position6>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="743" Column="36" TopLine="719"/>
</Position6>
<Position7>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="205" Column="73" TopLine="182"/>
</Position7>
<Position8>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="409" TopLine="370"/>
</Position8>
<Position9>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="725" TopLine="700"/>
</Position9>
<Position10>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="724" TopLine="686"/>
</Position10>
<Position11>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="762" Column="9" TopLine="717"/>
</Position11>
<Position12>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="90" Column="45" TopLine="68"/>
</Position12>
<Position13>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="309" Column="3" TopLine="297"/>
</Position13>
<Position14>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="91" Column="24" TopLine="59"/>
</Position14>
<Position15>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="696" Column="37" TopLine="691"/>
</Position15>
<Position16>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="310" TopLine="286"/>
</Position16>
<Position17>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="708" TopLine="682"/>
</Position17>
<Position18>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="709" Column="22" TopLine="682"/>
</Position18>
<Position19>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="706" Column="39" TopLine="682"/>
</Position19>
<Position20>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="72" Column="32" TopLine="54"/>
</Position20>
<Position21>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="117" Column="33" TopLine="92"/>
</Position21>
<Position22>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="88" Column="22" TopLine="61"/>
</Position22>
<Position23>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="328" Column="58" TopLine="308"/>
</Position23>
<Position24>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="216" Column="77" TopLine="205"/>
</Position24>
<Position25>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="87" Column="22" TopLine="60"/>
</Position25>
<Position26>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="73" Column="13" TopLine="63"/>
</Position26>
<Position27>
<Filename Value="uosrexternalpumpbrowser.pas"/>
<Caret Line="410" Column="3" TopLine="406"/>
</Position27>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@@ -2,10 +2,11 @@ object Form1: TForm1
Left = 518
Height = 630
Top = 252
Width = 1000
Width = 1001
Caption = ' Initializing browser. Please wait...'
ClientHeight = 630
ClientWidth = 1000
ClientWidth = 1001
OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
@@ -16,23 +17,23 @@ object Form1: TForm1
Left = 0
Height = 30
Top = 0
Width = 1000
Width = 1001
Align = alTop
ClientHeight = 30
ClientWidth = 1000
ClientWidth = 1001
TabOrder = 0
object AddressEdt: TEdit
Left = 1
Height = 28
Top = 1
Width = 932
Width = 933
Align = alClient
OnEnter = AddressEdtEnter
TabOrder = 0
Text = 'https://www.google.com'
end
object Panel2: TPanel
Left = 933
Left = 934
Height = 28
Top = 1
Width = 66
@@ -71,9 +72,11 @@ object Form1: TForm1
Left = 0
Height = 600
Top = 30
Width = 1000
Width = 1001
Align = alClient
Caption = 'Panel1'
Color = clWhite
ParentColor = False
TabOrder = 1
OnClick = Panel1Click
OnEnter = Panel1Enter

View File

@@ -43,7 +43,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
LCLType, ComCtrls, Types, SyncObjs,
LCLType, ComCtrls, Types, SyncObjs, LMessages,
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
uCEFChromiumEvents;
@@ -82,9 +82,10 @@ type
procedure Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormHide(Sender: TObject);
procedure FormShow(Sender: TObject);
@@ -96,38 +97,25 @@ type
procedure AddressEdtEnter(Sender: TObject);
private
protected
protected
FPopUpBitmap : TBitmap;
FPopUpRect : TRect;
FShowPopUp : boolean;
FResizing : boolean;
FPendingResize : boolean;
FCanClose : boolean;
FClosing : boolean;
FFirstLoad : boolean;
FResizeCS : TCriticalSection;
FBrowserCS : TCriticalSection;
FPanelCursor : TCursor;
FPanelHint : ustring;
function GetPanelCursor : TCursor;
function GetPanelHint : ustring;
procedure SetPanelCursor(aValue : TCursor);
procedure SetPanelHint(const aValue : ustring);
procedure SendCompMessage(aMsg : cardinal);
function getModifiers(Shift: TShiftState): TCefEventFlags;
function GetButton(Button: TMouseButton): TCefMouseButtonType;
procedure DoResize;
procedure BrowserCreatedMsg(Data: PtrInt);
procedure BrowserCloseFormMsg(Data: PtrInt);
procedure PendingResizeMsg(Data: PtrInt);
procedure PendingInvalidateMsg(Data: PtrInt);
procedure PendingCursorUpdateMsg(Data: PtrInt);
procedure PendingHintUpdateMsg(Data: PtrInt);
property PanelCursor : TCursor read GetPanelCursor write SetPanelCursor;
property PanelHint : ustring read GetPanelHint write SetPanelHint;
// CEF needs to handle these messages to call TChromium.NotifyMoveOrResizeStarted
procedure WMMove(var Message: TLMMove); message LM_MOVE;
procedure WMSize(var Message: TLMSize); message LM_SIZE;
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
public
procedure SendCEFKeyEvent(const aCefEvent : TCefKeyEvent);
@@ -143,7 +131,7 @@ implementation
{$R *.lfm}
// This is a simple CEF browser in "off-screen rendering" mode (a.k.a OSR mode)
// with a different executable for the Chromium subprocesses and an external
// with a different executable for the Chromium subprocesses and an external
// message pump
// Chromium needs the key press data available in the GDK signals
@@ -197,21 +185,16 @@ implementation
// to initialize and finalize the WidgetSet at the right time.
// This is the destruction sequence in OSR mode :
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls Chromium1.CloseBrowser(True).
// 2- Chromium1.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
// set "Result" to false and CEF will destroy the internal browser immediately.
// 3- Chromium1.OnBeforeClose is triggered because the internal browser was destroyed.
// FCanClose is set to True and calls SendCompMessage(CEF_BEFORECLOSE) to
// close the form asynchronously.
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and
// calls Chromium1.CloseBrowser(True) which will destroy the internal browser
// immediately.
// 2- Chromium1.OnBeforeClose is triggered because the internal browser was
// destroyed. FCanClose is set to True and we can close the form safely.
uses
Math, gtk2, glib2, gdk2, gtk2proc, gtk2int,
uCEFMiscFunctions, uCEFApplication, uCEFBitmapBitBuffer, uCEFWorkScheduler;
const
CEF_UPDATE_CURSOR = $A0D;
CEF_UPDATE_HINT = $A0E;
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
begin
if (GlobalCEFWorkScheduler <> nil) then
@@ -291,7 +274,10 @@ end;
procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
begin
// Now the browser is fully initialized we can initialize the UI.
SendCompMessage(CEF_AFTERCREATED);
Caption := 'OSR External Pump Browser';
AddressPnl.Enabled := True;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.AddressEdtEnter(Sender: TObject);
@@ -304,6 +290,32 @@ begin
Panel1.SetFocus;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
// You *MUST* call CreateBrowser to create and initialize the browser.
// This will trigger the AfterCreated event when the browser is fully
// initialized and ready to receive commands.
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
// If it's not initialized yet, we use a simple timer to create the browser later.
// Linux needs a visible form to create a browser so we need to use the
// TForm.OnActivate event instead of the TForm.OnShow event
if not(Chromium1.Initialized) then
begin
// We have to update the DeviceScaleFactor here to get the scale of the
// monitor where the main application form is located.
GlobalCEFApp.UpdateDeviceScaleFactor;
// opaque white background color
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
end;
end;
procedure TForm1.Panel1Enter(Sender: TObject);
begin
Chromium1.SendFocusEvent(True);
@@ -396,7 +408,7 @@ procedure TForm1.Chromium1BeforeClose(Sender: TObject;
const browser: ICefBrowser);
begin
FCanClose := True;
SendCompMessage(CEF_BEFORECLOSE);
Close;
end;
procedure TForm1.Chromium1BeforePopup(Sender: TObject;
@@ -416,10 +428,8 @@ procedure TForm1.Chromium1CursorChange(Sender: TObject;
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
var aResult : boolean);
begin
PanelCursor := CefCursorToWindowsCursor(cursorType);
aResult := True;
SendCompMessage(CEF_UPDATE_CURSOR);
Panel1.Cursor := CefCursorToWindowsCursor(cursorType);
aResult := True;
end;
procedure TForm1.Chromium1GetScreenInfo(Sender: TObject;
@@ -493,7 +503,7 @@ var
TempWidth, TempHeight : integer;
TempBufferBits : Pointer;
TempForcedResize : boolean;
TempBitmap : TCEFBitmapBitBuffer;
TempBitmap : TBitmap;
TempSrcRect : TRect;
begin
try
@@ -504,18 +514,41 @@ begin
begin
if (type_ = PET_POPUP) then
begin
Panel1.UpdatePopupBufferDimensions(aWidth, aHeight);
if (FPopUpBitmap = nil) then
begin
FPopUpBitmap := TBitmap.Create;
FPopUpBitmap.PixelFormat := pf32bit;
FPopUpBitmap.HandleType := bmDIB;
FPopUpBitmap.Width := aWidth;
FPopUpBitmap.Height := aHeight;
TempBitmap := Panel1.PopupBuffer;
TempWidth := Panel1.PopupBufferWidth;
TempHeight := Panel1.PopupBufferHeight;
FPopUpBitmap.Canvas.Brush.Color := clWhite;
FPopUpBitmap.Canvas.FillRect(rect(0, 0, aWidth, aHeight));
end;
if (aWidth <> FPopUpBitmap.Width) or
(aHeight <> FPopUpBitmap.Height) then
begin
FPopUpBitmap.Width := aWidth;
FPopUpBitmap.Height := aHeight;
FPopUpBitmap.Canvas.Brush.Color := clWhite;
FPopUpBitmap.Canvas.FillRect(rect(0, 0, aWidth, aHeight));
end;
TempBitmap := FPopUpBitmap;
TempBitmap.BeginUpdate;
TempWidth := FPopUpBitmap.Width;
TempHeight := FPopUpBitmap.Height;
end
else
begin
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or
not(Panel1.BufferIsResized(False));
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
TempBitmap := Panel1.Buffer;
TempBitmap.BeginUpdate;
TempWidth := Panel1.BufferWidth;
TempHeight := Panel1.BufferHeight;
end;
@@ -555,23 +588,24 @@ begin
inc(n);
end;
if FShowPopup then
TempBitmap.EndUpdate;
if FShowPopup and (FPopUpBitmap <> nil) then
begin
TempSrcRect := Rect(0, 0,
FPopUpRect.Right - FPopUpRect.Left,
FPopUpRect.Bottom - FPopUpRect.Top);
min(FPopUpRect.Right - FPopUpRect.Left, FPopUpBitmap.Width),
min(FPopUpRect.Bottom - FPopUpRect.Top, FPopUpBitmap.Height));
Panel1.DrawPopupBuffer(TempSrcRect, FPopUpRect);
Panel1.BufferDraw(FPopUpBitmap, TempSrcRect, FPopUpRect);
end;
Panel1.EndBufferDraw;
SendCompMessage(CEF_PENDINGINVALIDATE);
Panel1.InvalidatePanel;
if (type_ = PET_VIEW) then
begin
if TempForcedResize or FPendingResize then
SendCompMessage(CEF_PENDINGRESIZE);
TThread.Queue(nil, @DoResize);
FResizing := False;
FPendingResize := False;
@@ -607,10 +641,9 @@ end;
procedure TForm1.Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
begin
PanelHint := aText;
Result := True;
SendCompMessage(CEF_UPDATE_HINT);
Panel1.hint := aText;
Panel1.ShowHint := (length(aText) > 0);
Result := True;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
@@ -626,23 +659,24 @@ begin
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
begin
FPopUpBitmap := nil;
FPopUpRect := rect(0, 0, 0, 0);
FShowPopUp := False;
FResizing := False;
FPendingResize := False;
FCanClose := False;
FClosing := False;
FFirstLoad := True;
FResizeCS := TCriticalSection.Create;
FBrowserCS := TCriticalSection.Create;
ConnectKeyPressReleaseEvents(PGtkWidget(Panel1.Handle));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
if (FBrowserCS <> nil) then FreeAndNil(FBrowserCS);
begin
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
end;
procedure TForm1.FormHide(Sender: TObject);
@@ -653,23 +687,8 @@ end;
procedure TForm1.FormShow(Sender: TObject);
begin
if Chromium1.Initialized then
begin
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
end
else
begin
// We have to update the DeviceScaleFactor here to get the scale of the
// monitor where the main application form is located.
GlobalCEFApp.UpdateDeviceScaleFactor;
// opaque white background color
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
end;
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
end;
procedure TForm1.GoBtnEnter(Sender: TObject);
@@ -691,50 +710,6 @@ begin
Timer1.Enabled := True;
end;
procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
begin
Caption := 'Simple OSR Browser';
AddressPnl.Enabled := True;
end;
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
begin
Close;
end;
procedure TForm1.PendingResizeMsg(Data: PtrInt);
begin
DoResize;
end;
procedure TForm1.PendingInvalidateMsg(Data: PtrInt);
begin
Panel1.Invalidate;
end;
procedure TForm1.PendingCursorUpdateMsg(Data: PtrInt);
begin
Panel1.Cursor := PanelCursor;
end;
procedure TForm1.PendingHintUpdateMsg(Data: PtrInt);
begin
Panel1.hint := PanelHint;
Panel1.ShowHint := (length(Panel1.hint) > 0);
end;
procedure TForm1.SendCompMessage(aMsg : cardinal);
begin
case aMsg of
CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreatedMsg, 0);
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
CEF_PENDINGRESIZE : Application.QueueAsyncCall(@PendingResizeMsg, 0);
CEF_PENDINGINVALIDATE : Application.QueueAsyncCall(@PendingInvalidateMsg, 0);
CEF_UPDATE_CURSOR : Application.QueueAsyncCall(@PendingCursorUpdateMsg, 0);
CEF_UPDATE_HINT : Application.QueueAsyncCall(@PendingHintUpdateMsg, 0);
end;
end;
procedure TForm1.DoResize;
begin
try
@@ -753,46 +728,24 @@ begin
finally
FResizeCS.Release;
end;
end;
function TForm1.GetPanelCursor : TCursor;
begin
try
FBrowserCS.Acquire;
Result := FPanelCursor;
finally
FBrowserCS.Release;
end;
end;
function TForm1.GetPanelHint : ustring;
procedure TForm1.WMMove(var Message: TLMMove);
begin
try
FBrowserCS.Acquire;
Result := FPanelHint;
finally
FBrowserCS.Release;
end;
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.SetPanelCursor(aValue : TCursor);
procedure TForm1.WMSize(var Message: TLMSize);
begin
try
FBrowserCS.Acquire;
FPanelCursor := aValue;
finally
FBrowserCS.Release;
end;
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.SetPanelHint(const aValue : ustring);
procedure TForm1.WMWindowPosChanged(var Message: TLMWindowPosChanged);
begin
try
FBrowserCS.Acquire;
FPanelHint := aValue;
finally
FBrowserCS.Release;
end;
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
end.

View File

@@ -10,7 +10,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="29"/>
<CursorPos X="57" Y="58"/>
<UsageCount Value="81"/>
<UsageCount Value="83"/>
</Unit0>
<Unit1>
<Filename Value="usimpleosrbrowser.pas"/>
@@ -20,12 +20,12 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="uSimpleOSRBrowser"/>
<IsVisibleTab Value="True"/>
<TopLine Value="55"/>
<CursorPos X="65" Y="96"/>
<UsageCount Value="81"/>
<TopLine Value="187"/>
<CursorPos X="72" Y="225"/>
<UsageCount Value="83"/>
<Bookmarks Count="2">
<Item0 X="47" Y="222" ID="2"/>
<Item1 X="76" Y="501" ID="6"/>
<Item0 X="49" Y="223" ID="2"/>
<Item1 X="80" Y="528" ID="6"/>
</Bookmarks>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@@ -36,7 +36,7 @@
<UnitName Value="Interfaces"/>
<EditorIndex Value="-1"/>
<CursorPos X="40" Y="20"/>
<UsageCount Value="77"/>
<UsageCount Value="79"/>
</Unit2>
<Unit3>
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lcltype.pp"/>
@@ -126,14 +126,14 @@
<Unit15>
<Filename Value="../../../source/uCEFBufferPanel.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="111"/>
<CursorPos X="17" Y="123"/>
<TopLine Value="1034"/>
<CursorPos X="3" Y="1037"/>
<UsageCount Value="29"/>
<Bookmarks Count="4">
<Item0 Y="1010" ID="9"/>
<Item1 X="63" Y="581" ID="8"/>
<Item2 X="5" Y="345" ID="7"/>
<Item3 X="5" Y="375" ID="1"/>
<Item0 Y="1036" ID="9"/>
<Item1 X="63" Y="589" ID="8"/>
<Item2 X="5" Y="350" ID="7"/>
<Item3 X="5" Y="380" ID="1"/>
</Bookmarks>
</Unit15>
<Unit16>
@@ -706,7 +706,7 @@
<Filename Value="../../../source/uCEFBitmapBitBuffer.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="153"/>
<CursorPos X="58" Y="183"/>
<CursorPos X="3" Y="172"/>
<UsageCount Value="13"/>
</Unit94>
<Unit95>
@@ -802,7 +802,88 @@
<Define0 Value="UseCthreads"/>
<Define1 Value="EnabledGtkThreading"/>
</OtherDefines>
<JumpHistory HistoryIndex="-1"/>
<JumpHistory Count="20" HistoryIndex="19">
<Position1>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="56" Column="63" TopLine="51"/>
</Position1>
<Position2>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="634" Column="63" TopLine="619"/>
</Position2>
<Position3>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="80" Column="15" TopLine="64"/>
</Position3>
<Position4>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="501" Column="35" TopLine="478"/>
</Position4>
<Position5>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="512" Column="52" TopLine="478"/>
</Position5>
<Position6>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="514" Column="38" TopLine="497"/>
</Position6>
<Position7>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="506" Column="70" TopLine="497"/>
</Position7>
<Position8>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="558" Column="39" TopLine="536"/>
</Position8>
<Position9>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="569" Column="56" TopLine="475"/>
</Position9>
<Position10>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="469" Column="61" TopLine="460"/>
</Position10>
<Position11>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="89" Column="15" TopLine="56"/>
</Position11>
<Position12>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="663" Column="3" TopLine="660"/>
</Position12>
<Position13>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="309" Column="3" TopLine="280"/>
</Position13>
<Position14>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="90" Column="24" TopLine="45"/>
</Position14>
<Position15>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="679" Column="12" TopLine="661"/>
</Position15>
<Position16>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="85" Column="15" TopLine="68"/>
</Position16>
<Position17>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="319" Column="12" TopLine="306"/>
</Position17>
<Position18>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="90" Column="15" TopLine="63"/>
</Position18>
<Position19>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="675" TopLine="671"/>
</Position19>
<Position20>
<Filename Value="usimpleosrbrowser.pas"/>
<Caret Line="85" Column="15" TopLine="68"/>
</Position20>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>

View File

@@ -6,6 +6,7 @@ object Form1: TForm1
Caption = ' Initializing browser. Please wait...'
ClientHeight = 630
ClientWidth = 1000
OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
@@ -74,6 +75,8 @@ object Form1: TForm1
Width = 1000
Align = alClient
Caption = 'Panel1'
Color = clWhite
ParentColor = False
TabOrder = 1
OnClick = Panel1Click
OnEnter = Panel1Enter

View File

@@ -43,7 +43,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
LCLType, ComCtrls, Types, SyncObjs,
LCLType, ComCtrls, Types, SyncObjs, LMessages,
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
uCEFChromiumEvents;
@@ -82,6 +82,7 @@ type
procedure Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
procedure FormActivate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@@ -124,7 +125,12 @@ type
procedure PendingResizeMsg(Data: PtrInt);
procedure PendingInvalidateMsg(Data: PtrInt);
procedure PendingCursorUpdateMsg(Data: PtrInt);
procedure PendingHintUpdateMsg(Data: PtrInt);
procedure PendingHintUpdateMsg(Data: PtrInt);
// CEF needs to handle these messages to call TChromium.NotifyMoveOrResizeStarted
procedure WMMove(var Message: TLMMove); message LM_MOVE;
procedure WMSize(var Message: TLMSize); message LM_SIZE;
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
property PanelCursor : TCursor read GetPanelCursor write SetPanelCursor;
property PanelHint : ustring read GetPanelHint write SetPanelHint;
@@ -211,12 +217,12 @@ implementation
// to initialize and finalize the WidgetSet at the right time.
// This is the destruction sequence in OSR mode :
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls Chromium1.CloseBrowser(True).
// 2- Chromium1.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
// set "Result" to false and CEF will destroy the internal browser immediately.
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
// FCanClose is set to True and calls SendCompMessage(CEF_BEFORECLOSE) to
// close the form asynchronously.
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and
// calls Chromium1.CloseBrowser(True) which will destroy the internal browser
// immediately.
// 2- Chromium1.OnBeforeClose is triggered because the internal browser was
// destroyed. FCanClose is set to True and calls
// SendCompMessage(CEF_BEFORECLOSE) to close the form asynchronously.
uses
Math, gtk2, glib2, gdk2, gtk2proc, gtk2int,
@@ -298,6 +304,32 @@ begin
Panel1.SetFocus;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
// You *MUST* call CreateBrowser to create and initialize the browser.
// This will trigger the AfterCreated event when the browser is fully
// initialized and ready to receive commands.
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
// If it's not initialized yet, we use a simple timer to create the browser later.
// Linux needs a visible form to create a browser so we need to use the
// TForm.OnActivate event instead of the TForm.OnShow event
if not(Chromium1.Initialized) then
begin
// We have to update the DeviceScaleFactor here to get the scale of the
// monitor where the main application form is located.
GlobalCEFApp.UpdateDeviceScaleFactor;
// opaque white background color
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
end;
end;
procedure TForm1.Panel1Enter(Sender: TObject);
begin
Chromium1.SendFocusEvent(True);
@@ -498,20 +530,20 @@ begin
begin
if (type_ = PET_POPUP) then
begin
Panel1.UpdatePopupBufferDimensions(aWidth, aHeight);
Panel1.UpdateOrigPopupBufferDimensions(aWidth, aHeight);
TempBitmap := Panel1.PopupBuffer;
TempWidth := Panel1.PopupBufferWidth;
TempHeight := Panel1.PopupBufferHeight;
TempBitmap := Panel1.OrigPopupBuffer;
TempWidth := Panel1.OrigPopupBufferWidth;
TempHeight := Panel1.OrigPopupBufferHeight;
end
else
begin
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or
TempForcedResize := Panel1.UpdateOrigBufferDimensions(aWidth, aHeight) or
not(Panel1.BufferIsResized(False));
TempBitmap := Panel1.Buffer;
TempWidth := Panel1.BufferWidth;
TempHeight := Panel1.BufferHeight;
TempBitmap := Panel1.OrigBuffer;
TempWidth := Panel1.OrigBufferWidth;
TempHeight := Panel1.OrigBufferHeight;
end;
SrcStride := aWidth * SizeOf(TRGBQuad);
@@ -555,7 +587,7 @@ begin
FPopUpRect.Right - FPopUpRect.Left,
FPopUpRect.Bottom - FPopUpRect.Top);
Panel1.DrawPopupBuffer(TempSrcRect, FPopUpRect);
Panel1.DrawOrigPopupBuffer(TempSrcRect, FPopUpRect);
end;
Panel1.EndBufferDraw;
@@ -630,6 +662,8 @@ begin
FResizeCS := TCriticalSection.Create;
FBrowserCS := TCriticalSection.Create;
Panel1.CopyOriginalBuffer := True;
ConnectKeyPressReleaseEvents(PGtkWidget(Panel1.Handle));
end;
@@ -647,23 +681,8 @@ end;
procedure TForm1.FormShow(Sender: TObject);
begin
if Chromium1.Initialized then
begin
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
end
else
begin
// We have to update the DeviceScaleFactor here to get the scale of the
// monitor where the main application form is located.
GlobalCEFApp.UpdateDeviceScaleFactor;
// opaque white background color
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
if not(Chromium1.CreateBrowser) then Timer1.Enabled := True;
end;
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
end;
procedure TForm1.GoBtnEnter(Sender: TObject);
@@ -689,6 +708,8 @@ procedure TForm1.BrowserCreatedMsg(Data: PtrInt);
begin
Caption := 'Simple OSR Browser';
AddressPnl.Enabled := True;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
@@ -787,6 +808,24 @@ begin
finally
FBrowserCS.Release;
end;
end;
procedure TForm1.WMMove(var Message: TLMMove);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.WMSize(var Message: TLMSize);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
procedure TForm1.WMWindowPosChanged(var Message: TLMWindowPosChanged);
begin
inherited;
Chromium1.NotifyMoveOrResizeStarted;
end;
end.

View File

@@ -23,7 +23,7 @@
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="823"/>
<CursorPos Y="825"/>
<CursorPos X="45" Y="830"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>