You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Added touch support for Windows 8,8.1,10 to FMXExternalPumpBrowser
- Removed GestureBrowser demo - Added TBufferPanel.OnWrongSize event - Added TFMXBufferPanel.OnWrongSize event - More touch support fixes in SimpleOSRBrowser and KioskOSRBrowser.
This commit is contained in:
@ -92,6 +92,7 @@ type
|
||||
procedure Panel1PointerDown(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
|
||||
procedure Panel1PointerUp(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
|
||||
procedure Panel1PointerUpdate(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
|
||||
procedure Panel1WrongSize(Sender: TObject);
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
@ -131,6 +132,7 @@ type
|
||||
FIMECS : TCriticalSection;
|
||||
FDeviceBounds : TCefRectDynArray;
|
||||
FSelectedRange : TCefRange;
|
||||
FAtLeastWin8 : boolean;
|
||||
|
||||
FLastClickCount : integer;
|
||||
FLastClickTime : integer;
|
||||
@ -142,7 +144,6 @@ type
|
||||
procedure DoResize;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
function AtLeastWin8 : boolean;
|
||||
function ArePointerEventsSupported : boolean;
|
||||
function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
|
||||
function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean;
|
||||
@ -676,6 +677,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var
|
||||
TempMajorVer, TempMinorVer : DWORD;
|
||||
begin
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
@ -686,6 +689,10 @@ begin
|
||||
FClosing := False;
|
||||
FDeviceBounds := nil;
|
||||
|
||||
FAtLeastWin8 := GetWindowsMajorMinorVersion(TempMajorVer, TempMinorVer) and
|
||||
((TempMajorVer > 6) or
|
||||
((TempMajorVer = 6) and (TempMinorVer >= 2)));
|
||||
|
||||
FSelectedRange.from := 0;
|
||||
FSelectedRange.to_ := 0;
|
||||
|
||||
@ -762,7 +769,6 @@ var
|
||||
i : integer;
|
||||
TempTouchInputs : array of TTouchInput;
|
||||
TempPoint : TPoint;
|
||||
TempAtLeastWin8 : boolean;
|
||||
TempLParam : LPARAM;
|
||||
TempResult : LRESULT;
|
||||
begin
|
||||
@ -778,14 +784,12 @@ begin
|
||||
|
||||
if GetTouchInputInfo(TempHTOUCHINPUT, TempNumPoints, @TempTouchInputs[0], SizeOf(TTouchInput)) then
|
||||
begin
|
||||
TempAtLeastWin8 := AtLeastWin8;
|
||||
|
||||
i := 0;
|
||||
while (i < TempNumPoints) do
|
||||
begin
|
||||
TempPoint := TouchPointToPoint(Panel1.Handle, TempTouchInputs[i]);
|
||||
|
||||
if not(TempAtLeastWin8) then
|
||||
if not(FAtLeastWin8) then
|
||||
begin
|
||||
// Windows 7 sends touch events for touches in the non-client area,
|
||||
// whereas Windows 8 does not. In order to unify the behaviour, always
|
||||
@ -836,7 +840,7 @@ var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
@ -886,7 +890,7 @@ var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
|
||||
begin
|
||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||
|
||||
@ -902,7 +906,7 @@ procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TSh
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssTouch in Shift) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
@ -998,7 +1002,7 @@ begin
|
||||
TempTouchEvent.pressure := 0;
|
||||
|
||||
if ((TempPenInfo.penMask and PEN_MASK_ROTATION) <> 0) then
|
||||
TempTouchEvent.rotation_angle := TempPenInfo.rotation / 180 * 3.14159
|
||||
TempTouchEvent.rotation_angle := TempPenInfo.rotation / 180 * Pi
|
||||
else
|
||||
TempTouchEvent.rotation_angle := 0;
|
||||
|
||||
@ -1080,6 +1084,11 @@ begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1WrongSize(Sender: TObject);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TForm1.PendingResizeMsg(var aMessage : TMessage);
|
||||
begin
|
||||
DoResize;
|
||||
@ -1135,20 +1144,12 @@ end;
|
||||
|
||||
function TForm1.ArePointerEventsSupported : boolean;
|
||||
begin
|
||||
Result := (@GetPointerType <> nil) and
|
||||
Result := FAtLeastWin8 and
|
||||
(@GetPointerType <> nil) and
|
||||
(@GetPointerTouchInfo <> nil) and
|
||||
(@GetPointerPenInfo <> nil);
|
||||
end;
|
||||
|
||||
function TForm1.AtLeastWin8 : boolean;
|
||||
var
|
||||
TempMajorVer, TempMinorVer : DWORD;
|
||||
begin
|
||||
Result := GetWindowsMajorMinorVersion(TempMajorVer, TempMinorVer) and
|
||||
((TempMajorVer > 6) or
|
||||
((TempMajorVer = 6) and (TempMinorVer >= 2)));
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
|
Reference in New Issue
Block a user