41 InitializeCriticalSection (&Queue->Cs);
63 DeleteCriticalSection (&Queue->Cs);
84 EnterCriticalSection (&Queue->Cs);
86 if ((Queue->Rear + 1) % MAX_Q == Queue->Front) {
87 LeaveCriticalSection (&Queue->Cs);
92 Queue->Rear = (Queue->Rear + 1) % MAX_Q;
94 LeaveCriticalSection (&Queue->Cs);
115 EnterCriticalSection (&Queue->Cs);
117 if (Queue->Front == Queue->Rear) {
118 LeaveCriticalSection (&Queue->Cs);
119 return EFI_NOT_READY;
123 Queue->Front = (Queue->Front + 1) % MAX_Q;
125 if ((Key->Key.ScanCode == SCAN_NULL) && (Key->Key.UnicodeChar == CHAR_NULL)) {
126 if (!Private->IsPartialKeySupport) {
130 LeaveCriticalSection (&Queue->Cs);
132 return EFI_NOT_READY;
136 LeaveCriticalSection (&Queue->Cs);
154 if (Queue->Front == Queue->Rear) {
155 return EFI_NOT_READY;
173 KeyState->KeyShiftState = EFI_SHIFT_STATE_VALID;
174 KeyState->KeyToggleState = EFI_TOGGLE_STATE_VALID;
179 if (Private->LeftCtrl) {
180 KeyState->KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;
183 if (Private->RightCtrl) {
184 KeyState->KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;
187 if (Private->LeftAlt) {
188 KeyState->KeyShiftState |= EFI_LEFT_ALT_PRESSED;
191 if (Private->RightAlt) {
192 KeyState->KeyShiftState |= EFI_RIGHT_ALT_PRESSED;
195 if (Private->LeftShift) {
196 KeyState->KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;
199 if (Private->RightShift) {
200 KeyState->KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;
203 if (Private->LeftLogo) {
204 KeyState->KeyShiftState |= EFI_LEFT_LOGO_PRESSED;
207 if (Private->RightLogo) {
208 KeyState->KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;
212 KeyState->KeyShiftState |= EFI_MENU_KEY_PRESSED;
215 if (Private->SysReq) {
216 KeyState->KeyShiftState |= EFI_SYS_REQ_PRESSED;
219 if (Private->CapsLock) {
220 KeyState->KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;
223 if (Private->NumLock) {
224 KeyState->KeyToggleState |= EFI_NUM_LOCK_ACTIVE;
227 if (Private->ScrollLock) {
228 KeyState->KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;
231 if (Private->IsPartialKeySupport) {
232 KeyState->KeyToggleState |= EFI_KEY_STATE_EXPOSED;
260 if ((Private->LeftCtrl || Private->RightCtrl) &&
261 (KeyData.
Key.UnicodeChar >= 1) && (KeyData.
Key.UnicodeChar <= 26)
264 if ((Private->LeftShift || Private->RightShift) == Private->CapsLock) {
265 KeyData.
Key.UnicodeChar = (CHAR16)(KeyData.
Key.UnicodeChar + L
'a' - 1);
267 KeyData.
Key.UnicodeChar = (CHAR16)(KeyData.
Key.UnicodeChar + L
'A' - 1);
274 if (((KeyData.
Key.UnicodeChar >= L
'a') && (KeyData.
Key.UnicodeChar <= L
'z')) ||
275 ((KeyData.
Key.UnicodeChar >= L
'A') && (KeyData.
Key.UnicodeChar <= L
'Z'))
282 if (Private->MakeRegisterdKeyCallback !=
NULL) {
283 Private->MakeRegisterdKeyCallback (Private->RegisterdKeyCallbackContext, &KeyData);
297 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
332 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
334 ZeroMem (&KeyData->Key, sizeof (KeyData->Key));
338 if (!EFI_ERROR (Status)) {
343 if (!EFI_ERROR (Status)) {
348 if (!Private->IsPartialKeySupport) {
349 if ((KeyData->Key.ScanCode == SCAN_NULL) && (KeyData->Key.UnicodeChar == CHAR_NULL)) {
350 Status = EFI_NOT_READY;
368 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
369 Private->ScrollLock =
FALSE;
370 Private->NumLock =
FALSE;
371 Private->CapsLock =
FALSE;
372 Private->IsPartialKeySupport =
FALSE;
374 if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
375 Private->ScrollLock =
TRUE;
378 if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
379 Private->NumLock =
TRUE;
382 if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
383 Private->CapsLock =
TRUE;
386 if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
387 Private->IsPartialKeySupport =
TRUE;
396WinNtWndRegisterKeyNotify (
398 IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
399 IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
405 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
407 if (Private ==
NULL) {
408 return EFI_INVALID_PARAMETER;
411 Private->MakeRegisterdKeyCallback = MakeCallBack;
412 Private->BreakRegisterdKeyCallback = BreakCallBack;
413 Private->RegisterdKeyCallbackContext = Context;
420WinNtWndCheckPointer (
426 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
428 if (!Private->PointerStateChanged) {
429 return EFI_NOT_READY;
437WinNtWndGetPointerState (
444 Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
446 if (!Private->PointerStateChanged) {
447 return EFI_NOT_READY;
453 State->LeftButton = Private->PointerState.
LeftButton;
454 State->RightButton = Private->PointerState.
RightButton;
460 Private->PointerStateChanged =
FALSE;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
UINT8 EFI_KEY_TOGGLE_STATE
EFI_KEY_TOGGLE_STATE KeyToggleState