1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00

Fixed touch events in SimpleOSRBrowser and KioskOSRBrowser demo in Windows 7

- TChromium.AcceptLanguageList is now always updated
- Added GetDigitizerStatus and HasTouchOrPen functions to uCEFMiscFunctions
This commit is contained in:
Salvador Díaz Fau 2020-02-05 14:40:22 +01:00
parent 40328b5724
commit e9601e4ee3
7 changed files with 76 additions and 18 deletions

View File

@ -823,7 +823,7 @@ var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
Panel1.SetFocus;
@ -873,7 +873,7 @@ var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
@ -889,7 +889,7 @@ procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TSh
var
TempEvent : TCefMouseEvent;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
TempEvent.x := X;
TempEvent.y := Y;

View File

@ -836,7 +836,7 @@ var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
Panel1.SetFocus;
@ -886,7 +886,7 @@ var
TempEvent : TCefMouseEvent;
TempTime : integer;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
@ -902,7 +902,7 @@ procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TSh
var
TempEvent : TCefMouseEvent;
begin
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
begin
TempEvent.x := X;
TempEvent.y := Y;

View File

@ -4,7 +4,7 @@
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="7">
<Units Count="9">
<Unit0>
<Filename Value="CookieVisitor.lpr"/>
<IsPartOfProject Value="True"/>
@ -20,10 +20,9 @@
<ComponentName Value="CookieVisitorFrm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="145"/>
<CursorPos X="31" Y="167"/>
<CursorPos X="41" Y="166"/>
<UsageCount Value="24"/>
<Bookmarks Count="1">
<Item0 X="66" Y="256" ID="3"/>
@ -68,16 +67,32 @@
<Unit6>
<Filename Value="..\..\..\source\uCEFSentinel.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="74"/>
<CursorPos X="14" Y="63"/>
<TopLine Value="140"/>
<CursorPos X="58" Y="161"/>
<UsageCount Value="10"/>
<Bookmarks Count="2">
<Item0 X="66" Y="60" ID="1"/>
<Item1 X="76" Y="164" ID="2"/>
</Bookmarks>
</Unit6>
<Unit7>
<Filename Value="..\..\..\source\uCEFWorkScheduler.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="41"/>
<CursorPos X="29" Y="178"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="249"/>
<CursorPos X="5" Y="263"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit8>
</Units>
<JumpHistory Count="23" HistoryIndex="22">
<JumpHistory Count="24" HistoryIndex="23">
<Position1>
<Filename Value="uCookieVisitor.pas"/>
<Caret Line="191" Column="62" TopLine="176"/>
@ -170,6 +185,10 @@
<Filename Value="uCookieVisitor.pas"/>
<Caret Line="78" TopLine="63"/>
</Position23>
<Position24>
<Filename Value="uCookieVisitor.pas"/>
<Caret Line="166" Column="41" TopLine="145"/>
</Position24>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@ -147,7 +147,6 @@ type
property OnPointerDown : TOnHandledMessageEvent read FOnPointerDown write FOnPointerDown;
property OnPointerUp : TOnHandledMessageEvent read FOnPointerUp write FOnPointerUp;
property OnPointerUpdate : TOnHandledMessageEvent read FOnPointerUpdate write FOnPointerUpdate;
{$ENDIF}
property OnPaintParentBkg : TNotifyEvent read FOnPaintParentBkg write FOnPaintParentBkg;

View File

@ -3186,9 +3186,7 @@ begin
UpdatePreference(aBrowser, 'settings.force_google_safesearch', FSafeSearch);
UpdatePreference(aBrowser, 'settings.force_youtube_restrict', FYouTubeRestrict);
UpdatePreference(aBrowser, 'printing.enabled', FPrintingEnabled);
if (length(FAcceptLanguageList) > 0) then
UpdatePreference(aBrowser, 'intl.accept_languages', FAcceptLanguageList);
UpdatePreference(aBrowser, 'intl.accept_languages', FAcceptLanguageList);
if (FMaxConnectionsPerProxy <> CEF_MAX_CONNECTIONS_PER_PROXY_DEFAULT_VALUE) then
UpdatePreference(aBrowser, 'net.max_connections_per_proxy', FMaxConnectionsPerProxy);

View File

@ -82,6 +82,16 @@ type
wProductType: BYTE;
wReserved:BYTE;
end;
{$IFDEF DELPHI14_UP}
TDigitizerStatus = record
IntegratedTouch : boolean;
ExternalTouch : boolean;
IntegratedPen : boolean;
ExternalPen : boolean;
MultiInput : boolean;
Ready : boolean;
end;
{$ENDIF}
function CefColorGetA(color: TCefColor): Byte;
function CefColorGetR(color: TCefColor): byte;
@ -262,6 +272,8 @@ function GetWindowsMajorMinorVersion(var wMajorVersion, wMinorVersion : DWORD)
function GetDefaultCEFUserAgent : string;
{$IFDEF DELPHI14_UP}
function TouchPointToPoint(aHandle : HWND; const TouchPoint: TTouchInput): TPoint;
function GetDigitizerStatus(var aDigitizerStatus : TDigitizerStatus; aDPI : cardinal = 0) : boolean;
function HasTouchOrPen(aDPI : cardinal = 0) : boolean;
{$ENDIF}
{$ENDIF}
@ -288,7 +300,11 @@ function CefGetDataURI(aData : pointer; aSize : integer; const aMimeType : ustri
implementation
uses
{$IFDEF DELPHI14_UP}System.Types,{$ENDIF}
{$IFDEF DELPHI16_UP}
System.Types,
{$ELSE}
{$IFDEF DELPHI14_UP}Types,{$ENDIF}
{$ENDIF}
uCEFApplicationCore, uCEFSchemeHandlerFactory, uCEFValue,
uCEFBinaryValue, uCEFStringList;
@ -2094,6 +2110,32 @@ begin
Result := Point(TouchPoint.X div 100, TouchPoint.Y div 100);
PhysicalToLogicalPoint(aHandle, Result);
end;
function GetDigitizerStatus(var aDigitizerStatus : TDigitizerStatus; aDPI : cardinal) : boolean;
var
TempStatus : integer;
begin
if (aDPI > 0) then
TempStatus := GetSystemMetricsForDpi(SM_DIGITIZER, aDPI)
else
TempStatus := GetSystemMetrics(SM_DIGITIZER);
aDigitizerStatus.IntegratedTouch := ((TempStatus and NID_INTEGRATED_TOUCH) <> 0);
aDigitizerStatus.ExternalTouch := ((TempStatus and NID_EXTERNAL_TOUCH) <> 0);
aDigitizerStatus.IntegratedPen := ((TempStatus and NID_INTEGRATED_PEN) <> 0);
aDigitizerStatus.ExternalPen := ((TempStatus and NID_EXTERNAL_PEN) <> 0);
aDigitizerStatus.MultiInput := ((TempStatus and NID_MULTI_INPUT) <> 0);
aDigitizerStatus.Ready := ((TempStatus and NID_READY) <> 0);
Result := (TempStatus <> 0);
end;
function HasTouchOrPen(aDPI : cardinal) : boolean;
var
TempStatus : TDigitizerStatus;
begin
Result := GetDigitizerStatus(TempStatus, aDPI);
end;
{$ENDIF}
{$ENDIF}

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 92,
"InternalVersion" : 93,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "79.1.36.0"
}