提交 e973124f 编写于 作者: V vit9696

CrScreenshotDxe: Added dynamic keyboard protocol installation

上级 2d650eff
......@@ -54,6 +54,7 @@ OpenCore Changelog
- Fixed PickerAudioAssist indications played twice in rare cases
- Improved OpenCanopy pointer acceleration
- Added more precise control on `AppleEvent` protocol properties and features
- Added dynamic keyboard protocol installation on CrScreenshotDxe
#### v0.6.7
- Fixed ocvalidate return code to be non-zero when issues are found
......
......@@ -39,6 +39,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <Protocol/SimpleTextInEx.h>
#include <Protocol/SimpleFileSystem.h>
//
// Keyboard protocol arrival event.
//
STATIC EFI_EVENT mProtocolNotification;
STATIC
EFI_STATUS
EFIAPI
......@@ -361,11 +366,10 @@ AppleEventKeyHandler (
}
}
STATIC
EFI_STATUS
EFIAPI
CrScreenshotDxeEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
InstallKeyHandler (
VOID
)
{
EFI_STATUS Status;
......@@ -513,3 +517,58 @@ CrScreenshotDxeEntry (
return EFI_SUCCESS;
}
VOID
EFIAPI
InstallKeyHandlerWrapper (
IN EFI_EVENT Event,
IN VOID *Context
)
{
InstallKeyHandler ();
gBS->CloseEvent (mProtocolNotification);
}
EFI_STATUS
EFIAPI
CrScreenshotDxeEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
VOID *Registration;
Status = InstallKeyHandler ();
if (EFI_ERROR (Status)) {
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
InstallKeyHandlerWrapper,
NULL,
&mProtocolNotification
);
if (!EFI_ERROR (Status)) {
gBS->RegisterProtocolNotify (
&gEfiSimpleTextInputExProtocolGuid,
mProtocolNotification,
&Registration
);
gBS->RegisterProtocolNotify (
&gAppleEventProtocolGuid,
mProtocolNotification,
&Registration
);
} else {
DEBUG ((
DEBUG_INFO,
"CRSCR: Cannot create event for keyboard protocol arrivals %r\n",
Status
));
}
}
return EFI_SUCCESS;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册