提交 ccf5dac7 编写于 作者: M MikeBeaton

AppleEvent: Add GraphicsInputMirroring setting

To allow kb input to reliably reach ConIn GUI apps (e.g. Windows BitLocker) even when an AppleEvent key handler (e.g. CrScreenshotDxe.efi) is active
上级 ca266bf2
......@@ -2,6 +2,7 @@ OpenCore Changelog
==================
#### v0.7.2
- Fixed OSBundleLibraries/OSBundleLibaries64 handling
- Added `GraphicsInputMirroring` to fix lost keystrokes in some non-Apple graphical UEFI apps
#### v0.7.1
- Added `SyncTableIds` quirk to sync modified table OEM identifiers
......
......@@ -6484,6 +6484,30 @@ functioning. Feature highlights:
then increase \texttt{KeySubsequentDelay} by one or two more until this effect goes away.
\end{itemize}
\item
\texttt{GraphicsInputMirroring}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}:
Apple’s own implementation of AppleEvent prevents keyboard input during graphics applications from appearing
on the basic console input stream.
With the default setting of \texttt{false}, OC's builtin implementation of AppleEvent replicates this behaviour.
On non-Apple hardware this can stop keyboard input working in graphics-based applications such as Windows BitLocker
which use non-Apple key input methods.
The recommended setting on all hardware is \texttt{true}.
\emph{Note}: AppleEvent's default behaviour is intended to prevent unwanted queued keystrokes from appearing
after exiting graphics-based UEFI applications; this issue is already handled separately within OpenCore.
\begin{itemize}
\tightlist
\item \texttt{true} --- Allow keyboard input to reach graphics mode apps which are not using Apple input protocols.
\item \texttt{false} --- Prevent key input mirroring to non-Apple protocols when in graphics mode.
\end{itemize}
\item
\texttt{PointerSpeedDiv}\\
\textbf{Type}: \texttt{plist\ integer}\\
......@@ -7093,7 +7117,7 @@ functioning. Feature highlights:
\emph{Note 2}: On systems without native
support for \texttt{ForceDisplayRotationInEFI}, \texttt{DirectGopRendering=true}
is also required for this setting to have a visible effect.
is also required for this setting to have an effect.
\item
\texttt{AppleFramebufferInfo}\\
......
......@@ -1281,6 +1281,8 @@
<integer>50</integer>
<key>KeySubsequentDelay</key>
<integer>5</integer>
<key>GraphicsInputMirroring</key>
<true/>
<key>PointerSpeedDiv</key>
<integer>1</integer>
<key>PointerSpeedMul</key>
......
......@@ -1619,6 +1619,8 @@
<integer>50</integer>
<key>KeySubsequentDelay</key>
<integer>5</integer>
<key>GraphicsInputMirroring</key>
<true/>
<key>PointerSpeedDiv</key>
<integer>1</integer>
<key>PointerSpeedMul</key>
......
......@@ -26,9 +26,13 @@
If false, use Apple OEM protocol where possible.
@param[in] CustomDelays If true, use key delays specified.
If false, use Apple OEM default key delay values.
OC builtin AppleEvent only.
@param[in] KeyInitialDelay Key repeat initial delay in 10ms units.
@param[in] KeySubsequentDelay Key repeat subsequent delay in 10ms units.
If zero, warn and use 1.
@param[in] GraphicsInputMirroring If true, disable Apple default behaviour which can
prevent keyboard input reaching non-Apple GUI UEFI apps.
OC builtin AppleEvent only.
@param[in] PointerSpeedDiv Pointer speed divisor. If zero, warn and use 1.
@param[in] PointerSpeedMul Pointer speed multiplier.
......@@ -41,6 +45,7 @@ OcAppleEventInstallProtocol (
IN BOOLEAN CustomDelays,
IN UINT16 KeyInitialDelay,
IN UINT16 KeySubsequentDelay,
IN BOOLEAN GraphicsInputMirroring,
IN UINT16 PointerSpeedDiv,
IN UINT16 PointerSpeedMul
);
......
......@@ -595,6 +595,7 @@ typedef enum {
_(BOOLEAN , CustomDelays , , FALSE , ()) \
_(UINT16 , KeyInitialDelay , , 50 , ()) \
_(UINT16 , KeySubsequentDelay , , 5 , ()) \
_(BOOLEAN , GraphicsInputMirroring, , FALSE , ()) \
_(UINT16 , PointerSpeedDiv , , 1 , ()) \
_(UINT16 , PointerSpeedMul , , 1 , ())
OC_DECLARE (OC_UEFI_APPLEINPUT)
......
......@@ -154,12 +154,13 @@ EventInputKeyFromAppleKeyCode (
IN BOOLEAN Shifted
);
// InternalSetKeyDelays
// InternalSetKeyBehaviour
VOID
InternalSetKeyDelays (
InternalSetKeyBehaviour (
IN BOOLEAN CustomDelays,
IN UINT16 KeyInitialDelay,
IN UINT16 KeySubsequentDelay
IN UINT16 KeySubsequentDelay,
IN BOOLEAN GraphicsInputMirroring
);
VOID
......
......@@ -72,15 +72,19 @@ STATIC BOOLEAN mCLockChanged = FALSE;
STATIC UINTN mKeyInitialDelay = 50;
STATIC UINTN mKeySubsequentDelay = 5;
// mGraphicsInputMirroring
STATIC BOOLEAN mGraphicsInputMirroring = FALSE;
// mAppleKeyMapAggregator
STATIC APPLE_KEY_MAP_AGGREGATOR_PROTOCOL *mKeyMapAggregator = NULL;
// InternalSetKeyDelays
// InternalSetKeyBehaviour
VOID
InternalSetKeyDelays (
InternalSetKeyBehaviour (
IN BOOLEAN CustomDelays,
IN UINT16 KeyInitialDelay,
IN UINT16 KeySubsequentDelay
IN UINT16 KeySubsequentDelay,
IN BOOLEAN GraphicsInputMirroring
)
{
if (CustomDelays) {
......@@ -100,6 +104,8 @@ InternalSetKeyDelays (
DEBUG ((DEBUG_INFO, "OCAE: Using key delays %d (%d0ms) and %d (%d0ms)\n", mKeyInitialDelay, mKeyInitialDelay, mKeySubsequentDelay, mKeySubsequentDelay));
}
mGraphicsInputMirroring = GraphicsInputMirroring;
}
// InternalGetAppleKeyStrokes
......@@ -596,6 +602,15 @@ InternalAppleEventDataFromCurrentKeyStroke (
&KeyCodes
);
if (!mGraphicsInputMirroring) {
//
// Apple OEM AppleEvent unconditionally includes this logic, but
// when an AppleEvent handler such as CrScreenshotDxe is active
// this code will run and (not entirely consistently across different
// firmware) may prevent keystrokes from reaching ConIn-based UEFI GUI
// apps such as Windows BitLocker.
// REF: https://github.com/acidanthera/bugtracker/issues/1716
//
Mode = EfiConsoleControlScreenGraphics;
Status = gBS->LocateProtocol (
&gEfiConsoleControlProtocolGuid,
......@@ -616,6 +631,7 @@ InternalAppleEventDataFromCurrentKeyStroke (
}
}
}
}
*Modifiers = AppleModifiers;
Status = InternalGetCurrentKeyStroke (
......
......@@ -553,9 +553,13 @@ AppleEventUnload (
If false, use Apple OEM protocol where possible.
@param[in] CustomDelays If true, use key delays specified.
If false, use Apple OEM default key delay values.
OC builtin AppleEvent only.
@param[in] KeyInitialDelay Key repeat initial delay in 10ms units.
@param[in] KeySubsequentDelay Key repeat subsequent delay in 10ms units.
If zero, warn and use 1.
@param[in] GraphicsInputMirroring If true, disable Apple default behaviour which can
prevent keyboard input reaching non-Apple GUI UEFI apps.
OC builtin AppleEvent only.
@param[in] PointerSpeedDiv Pointer speed divisor. If zero, warn and use 1.
@param[in] PointerSpeedMul Pointer speed multiplier.
......@@ -568,6 +572,7 @@ OcAppleEventInstallProtocol (
IN BOOLEAN CustomDelays,
IN UINT16 KeyInitialDelay,
IN UINT16 KeySubsequentDelay,
IN BOOLEAN GraphicsInputMirroring,
IN UINT16 PointerSpeedDiv,
IN UINT16 PointerSpeedMul
)
......@@ -616,7 +621,12 @@ OcAppleEventInstallProtocol (
return NULL;
}
InternalSetKeyDelays (CustomDelays, KeyInitialDelay, KeySubsequentDelay);
InternalSetKeyBehaviour (
CustomDelays,
KeyInitialDelay,
KeySubsequentDelay,
GraphicsInputMirroring
);
InternalSetPointerSpeed (PointerSpeedDiv, PointerSpeedMul);
......
......@@ -724,6 +724,7 @@ OC_SCHEMA
mUefiAppleInputSchema[] = {
OC_SCHEMA_STRING_IN ("AppleEvent", OC_GLOBAL_CONFIG, Uefi.AppleInput.AppleEvent),
OC_SCHEMA_BOOLEAN_IN ("CustomDelays", OC_GLOBAL_CONFIG, Uefi.AppleInput.CustomDelays),
OC_SCHEMA_BOOLEAN_IN ("GraphicsInputMirroring", OC_GLOBAL_CONFIG, Uefi.AppleInput.GraphicsInputMirroring),
OC_SCHEMA_INTEGER_IN ("KeyInitialDelay", OC_GLOBAL_CONFIG, Uefi.AppleInput.KeyInitialDelay),
OC_SCHEMA_INTEGER_IN ("KeySubsequentDelay", OC_GLOBAL_CONFIG, Uefi.AppleInput.KeySubsequentDelay),
OC_SCHEMA_INTEGER_IN ("PointerSpeedDiv", OC_GLOBAL_CONFIG, Uefi.AppleInput.PointerSpeedDiv),
......
......@@ -365,6 +365,7 @@ OcReinstallProtocols (
Config->Uefi.AppleInput.CustomDelays,
Config->Uefi.AppleInput.KeyInitialDelay,
Config->Uefi.AppleInput.KeySubsequentDelay,
Config->Uefi.AppleInput.GraphicsInputMirroring,
Config->Uefi.AppleInput.PointerSpeedDiv,
Config->Uefi.AppleInput.PointerSpeedMul
) == NULL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册