提交 6b8b363d 编写于 作者: M Marvin Häuser

OcAppleEventLib: Implement OcAppleEventEx protocol

上级 4f7f17cd
......@@ -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 (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册