/** @file\r
Implements inputbar interface functions.\r
\r
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
CHAR16 *mPrompt; // Input bar mPrompt string.\r
CHAR16 *mReturnString; // The returned string.\r
UINTN StringSize; // Size of mReturnString space size.\r
+EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mTextInEx;\r
\r
/**\r
Initialize the input bar.\r
+\r
+ @param[in] TextInEx Pointer to SimpleTextInEx instance in System Table.\r
**/\r
VOID\r
-EFIAPI\r
InputBarInit (\r
- VOID\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx\r
)\r
{\r
mPrompt = NULL;\r
mReturnString = NULL;\r
StringSize = 0;\r
+ mTextInEx = TextInEx;\r
}\r
\r
/**\r
Cleanup function for input bar.\r
**/\r
VOID\r
-EFIAPI\r
InputBarCleanup (\r
VOID\r
)\r
@param[in] LastRow The last printable row.\r
**/\r
VOID\r
-EFIAPI\r
InputBarPrintInput (\r
IN UINTN LastColumn,\r
IN UINTN LastRow\r
\r
typedef struct {\r
UINT32 Foreground : 4;\r
- UINT32 Background : 4;\r
+ UINT32 Background : 3;\r
} INPUT_BAR_COLOR_ATTRIBUTES;\r
\r
typedef union {\r
@retval EFI_SUCCESS The operation was successful.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
InputBarRefresh (\r
UINTN LastRow,\r
UINTN LastColumn\r
{\r
INPUT_BAR_COLOR_UNION Orig;\r
INPUT_BAR_COLOR_UNION New;\r
- EFI_INPUT_KEY Key;\r
+ EFI_KEY_DATA KeyData;\r
UINTN Size;\r
EFI_STATUS Status;\r
BOOLEAN NoDisplay;\r
CursorRow = gST->ConOut->Mode->CursorRow;\r
Orig.Data = gST->ConOut->Mode->Attribute;\r
New.Data = 0;\r
- New.Colors.Foreground = Orig.Colors.Background;\r
- New.Colors.Background = Orig.Colors.Foreground;\r
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;\r
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;\r
\r
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
\r
//\r
// clear input bar\r
// wait for user input\r
//\r
for (;;) {\r
- gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);\r
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
+ Status = gBS->WaitForEvent (1, &mTextInEx->WaitForKeyEx, &EventIndex);\r
+ if (EFI_ERROR (Status) || (EventIndex != 0)) {\r
+ continue;\r
+ }\r
+ Status = mTextInEx->ReadKeyStrokeEx (mTextInEx, &KeyData);\r
if (EFI_ERROR (Status)) {\r
continue;\r
}\r
+ if (((KeyData.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) &&\r
+ (KeyData.KeyState.KeyShiftState != EFI_SHIFT_STATE_VALID)) {\r
+ //\r
+ // Shift key pressed.\r
+ //\r
+ continue;\r
+ }\r
//\r
// pressed ESC\r
//\r
- if (Key.ScanCode == SCAN_ESC) {\r
+ if (KeyData.Key.ScanCode == SCAN_ESC) {\r
Size = 0;\r
Status = EFI_NOT_READY;\r
break;\r
//\r
// return pressed\r
//\r
- if (Key.UnicodeChar == CHAR_LINEFEED || Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {\r
+ if (KeyData.Key.UnicodeChar == CHAR_LINEFEED || KeyData.Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {\r
break;\r
- } else if (Key.UnicodeChar == CHAR_BACKSPACE) {\r
+ } else if (KeyData.Key.UnicodeChar == CHAR_BACKSPACE) {\r
//\r
// backspace\r
//\r
\r
}\r
}\r
- } else if (Key.UnicodeChar <= 127 && Key.UnicodeChar >= 32) {\r
+ } else if (KeyData.Key.UnicodeChar <= 127 && KeyData.Key.UnicodeChar >= 32) {\r
//\r
// VALID ASCII char pressed\r
//\r
- mReturnString[Size] = Key.UnicodeChar;\r
+ mReturnString[Size] = KeyData.Key.UnicodeChar;\r
\r
//\r
// should be less than specified length\r
}\r
\r
mReturnString[Size] = CHAR_NULL;\r
- \r
+\r
\r
//\r
// restore screen attributes\r
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
InputBarSetPrompt (\r
IN CONST CHAR16 *Str\r
)\r
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
InputBarSetStringSize (\r
UINTN Size\r
)\r
@return The string that was input.\r
**/\r
CONST CHAR16*\r
-EFIAPI\r
InputBarGetString (\r
VOID\r
)\r