mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcAppleEventLib: Implement OcAppleEventEx protocol
This commit is contained in:
parent
4f7f17cd65
commit
6b8b363ddd
@ -21,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#include <IndustryStandard/AppleHid.h>
|
||||
|
||||
#include <Protocol/AppleEvent.h>
|
||||
#include <Protocol/OcAppleEventEx.h>
|
||||
|
||||
// EventCreateKeyStrokePollEvent
|
||||
EFI_STATUS
|
||||
@ -161,4 +161,6 @@ InternalSetKeyDelays (
|
||||
IN UINT16 KeySubsequentDelay
|
||||
);
|
||||
|
||||
extern UINT32 mPointerScale;
|
||||
|
||||
#endif // APPLE_EVENT_INTERNAL_H_
|
||||
|
||||
@ -509,14 +509,33 @@ InternalUnregisterHandlers (
|
||||
}
|
||||
}
|
||||
|
||||
UINT32
|
||||
EFIAPI
|
||||
OcEventExSetPointerScale (
|
||||
IN OUT OC_APPLE_EVENT_EX_PROTOCOL *This,
|
||||
IN UINT32 Scale
|
||||
)
|
||||
{
|
||||
UINT32 OldScale;
|
||||
|
||||
OldScale = mPointerScale;
|
||||
mPointerScale = Scale;
|
||||
|
||||
return OldScale;
|
||||
}
|
||||
|
||||
// mAppleEventProtocol
|
||||
STATIC APPLE_EVENT_PROTOCOL mAppleEventProtocol = {
|
||||
APPLE_EVENT_PROTOCOL_REVISION,
|
||||
EventRegisterHandler,
|
||||
EventUnregisterHandler,
|
||||
EventSetCursorPosition,
|
||||
EventSetEventName,
|
||||
EventIsCapsLockOn
|
||||
STATIC OC_APPLE_EVENT_EX_PROTOCOL mAppleEventProtocol = {
|
||||
OC_APPLE_EVENT_EX_PROTOCOL_REVISION,
|
||||
OcEventExSetPointerScale,
|
||||
{
|
||||
APPLE_EVENT_PROTOCOL_REVISION,
|
||||
EventRegisterHandler,
|
||||
EventUnregisterHandler,
|
||||
EventSetCursorPosition,
|
||||
EventSetEventName,
|
||||
EventIsCapsLockOn
|
||||
}
|
||||
};
|
||||
|
||||
// AppleEventUnload
|
||||
@ -536,11 +555,13 @@ AppleEventUnload (
|
||||
InternalUnregisterHandlers ();
|
||||
InternalCancelPollEvents ();
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
gImageHandle,
|
||||
&gAppleEventProtocolGuid,
|
||||
(VOID *)&mAppleEventProtocol
|
||||
);
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
gImageHandle,
|
||||
&gAppleEventProtocolGuid,
|
||||
(VOID *)&mAppleEventProtocol.AppleEvent,
|
||||
&gOcAppleEventExProtocolGuid,
|
||||
&mAppleEventProtocol
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -565,7 +586,6 @@ OcAppleEventInstallProtocol (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
APPLE_EVENT_PROTOCOL *Protocol;
|
||||
EFI_HANDLE NewHandle;
|
||||
|
||||
DEBUG ((DEBUG_VERBOSE, "OcAppleEventInstallProtocol\n"));
|
||||
|
||||
@ -590,16 +610,14 @@ OcAppleEventInstallProtocol (
|
||||
|
||||
InternalSetKeyDelays (KeyInitialDelay, KeySubsequentDelay);
|
||||
|
||||
//
|
||||
// Apple code supports unloading, ours does not.
|
||||
//
|
||||
NewHandle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&NewHandle,
|
||||
&gAppleEventProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
(VOID *)&mAppleEventProtocol
|
||||
);
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&gImageHandle,
|
||||
&gAppleEventProtocolGuid,
|
||||
&mAppleEventProtocol.AppleEvent,
|
||||
&gOcAppleEventExProtocolGuid,
|
||||
&mAppleEventProtocol,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
InternalCreateQueueEvent ();
|
||||
@ -614,5 +632,5 @@ OcAppleEventInstallProtocol (
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "OCAE: Installed\n"));
|
||||
return &mAppleEventProtocol;
|
||||
return &mAppleEventProtocol.AppleEvent;
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
[Protocols]
|
||||
gAppleEventProtocolGuid ## SOMETIMES_PRODUCES
|
||||
gOcAppleEventExProtocolGuid ## SOMETIMES_PRODUCES
|
||||
gAppleKeyMapDatabaseProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gAppleKeyMapAggregatorProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiConsoleControlProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
@ -46,6 +46,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define POINTER_POLL_FREQUENCY EFI_TIMER_PERIOD_MILLISECONDS (10)
|
||||
#define MAX_POINTER_POLL_FREQUENCY EFI_TIMER_PERIOD_MILLISECONDS (80)
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mPointerScale = 1;
|
||||
|
||||
STATIC UINT16 mMaximumDoubleClickSpeed = 75; // 374 for 2 ms
|
||||
STATIC UINT16 mMaximumClickDuration = 15; // 74 for 2 ms
|
||||
|
||||
@ -708,9 +710,11 @@ InternalSimplePointerPollNotifyFunction (
|
||||
|
||||
UiScaleX = InternalGetUiScaleData ((INT64)State.RelativeMovementX);
|
||||
UiScaleX = MultS64x64 (UiScaleX, (INT64) mMaxPointerResolutionX);
|
||||
UiScaleX = MultS64x64 (UiScaleX, mPointerScale);
|
||||
|
||||
UiScaleY = InternalGetUiScaleData ((INT64)State.RelativeMovementY);
|
||||
UiScaleY = MultS64x64 (UiScaleY, (INT64) mMaxPointerResolutionY);
|
||||
UiScaleY = MultS64x64 (UiScaleY, mPointerScale);
|
||||
|
||||
if (SimplePointer->Mode->ResolutionX > 0) {
|
||||
UiScaleX = DivS64x64Remainder (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user