Skip to content

Commit

Permalink
Renamed some properties
Browse files Browse the repository at this point in the history
  • Loading branch information
DelphiWorlds committed Oct 20, 2023
1 parent cdab8df commit 392dce8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Features/OSEvents/DW.OSEvents.Mac.pas
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ TPlatformOSEvents = class(TObject)

TPlatformKeyPressOSEvents = class(TPlatformOSEvents)
private
FPressedKeys: TKeyCodes;
FDownKeys: TKeyCodes;
protected
function EventTapHandler(const proxy: CGEventTapProxy; const &type: CGEventType; const event: CGEventRef): CGEventRef; override;
public
constructor Create;
function HasMultipleDown: Boolean;
function DownCount: Integer;
function HasMultipleKeysDown: Boolean;
function DownKeysCount: Integer;
property DownKeys: TKeyCodes read FDownKeys;
end;

implementation
Expand Down Expand Up @@ -243,23 +244,23 @@ function TPlatformKeyPressOSEvents.EventTapHandler(const proxy: CGEventTapProxy;
begin
LKeyCode := CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode);
if &type = kCGEventKeyDown then
FPressedKeys.Add(LKeyCode)
FDownKeys.Add(LKeyCode)
else if &type = kCGEventKeyUp then
FPressedKeys.Remove(LKeyCode);
FDownKeys.Remove(LKeyCode);
LHandled := HandleEventTap;
end;
if LHandled then
Result := nil;
end;

function TPlatformKeyPressOSEvents.HasMultipleDown: Boolean;
function TPlatformKeyPressOSEvents.HasMultipleKeysDown: Boolean;
begin
Result := DownCount > 1;
Result := DownKeysCount > 1;
end;

function TPlatformKeyPressOSEvents.DownCount: Integer;
function TPlatformKeyPressOSEvents.DownKeysCount: Integer;
begin
Result := FPressedKeys.Count;
Result := FDownKeys.Count;
end;

end.

0 comments on commit 392dce8

Please sign in to comment.