diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:53:57 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | a550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97 (patch) | |
tree | 16ea0a059e01bb8af07f41dcea5996424c309a95 /EmulatorPkg/Win/Host/WinGopScreen.c | |
parent | e7108d0e9655b1795c94ac372b0449f28dd907df (diff) | |
download | edk2-a550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97.tar.gz edk2-a550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97.tar.bz2 edk2-a550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97.zip |
EmulatorPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the EmulatorPkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'EmulatorPkg/Win/Host/WinGopScreen.c')
-rw-r--r-- | EmulatorPkg/Win/Host/WinGopScreen.c | 705 |
1 files changed, 391 insertions, 314 deletions
diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c b/EmulatorPkg/Win/Host/WinGopScreen.c index 74011e225e..661573d777 100644 --- a/EmulatorPkg/Win/Host/WinGopScreen.c +++ b/EmulatorPkg/Win/Host/WinGopScreen.c @@ -18,8 +18,8 @@ Abstract: #include "WinGop.h"
-DWORD mTlsIndex = TLS_OUT_OF_INDEXES;
-DWORD mTlsIndexUseCount = 0; // lets us know when we can free mTlsIndex.
+DWORD mTlsIndex = TLS_OUT_OF_INDEXES;
+DWORD mTlsIndexUseCount = 0; // lets us know when we can free mTlsIndex.
BOOLEAN
WinNtGopConvertParamToEfiKeyShiftState (
@@ -30,75 +30,78 @@ WinNtGopConvertParamToEfiKeyShiftState ( )
{
switch (*wParam) {
- //
- // BUGBUG: Only GetAsyncKeyState() and GetKeyState() can distinguish
- // left and right Ctrl, and Shift key.
- // Neither of the two is defined in EFI_WIN_NT_THUNK_PROTOCOL.
- // Therefor, we can not set the correct Shift state here.
- //
- case VK_SHIFT:
- if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
+ //
+ // BUGBUG: Only GetAsyncKeyState() and GetKeyState() can distinguish
+ // left and right Ctrl, and Shift key.
+ // Neither of the two is defined in EFI_WIN_NT_THUNK_PROTOCOL.
+ // Therefor, we can not set the correct Shift state here.
+ //
+ case VK_SHIFT:
+ if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
Private->RightShift = Flag;
} else {
Private->LeftShift = Flag;
}
- return TRUE;
- case VK_LSHIFT:
- Private->LeftShift = Flag;
- return TRUE;
+ return TRUE;
- case VK_RSHIFT:
- Private->RightShift = Flag;
- return TRUE;
+ case VK_LSHIFT:
+ Private->LeftShift = Flag;
+ return TRUE;
- case VK_CONTROL:
- if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
- Private->RightCtrl= Flag;
+ case VK_RSHIFT:
+ Private->RightShift = Flag;
+ return TRUE;
+
+ case VK_CONTROL:
+ if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
+ Private->RightCtrl = Flag;
} else {
Private->LeftCtrl = Flag;
}
- return TRUE;
- case VK_LCONTROL:
- Private->LeftCtrl = Flag;
- return TRUE;
+ return TRUE;
- case VK_RCONTROL:
- Private->RightCtrl = Flag;
- return TRUE;
+ case VK_LCONTROL:
+ Private->LeftCtrl = Flag;
+ return TRUE;
- case VK_LWIN:
- Private->LeftLogo = Flag;
- return TRUE;
+ case VK_RCONTROL:
+ Private->RightCtrl = Flag;
+ return TRUE;
- case VK_RWIN:
- Private->RightLogo = Flag;
- return TRUE;
+ case VK_LWIN:
+ Private->LeftLogo = Flag;
+ return TRUE;
- case VK_APPS:
- Private->Menu = Flag;
- return TRUE;
- //
- // BUGBUG: PrintScreen/SysRq can not trigger WM_KEYDOWN message,
- // so SySReq shift state is not supported here.
- //
- case VK_PRINT:
- Private->SysReq = Flag;
- return TRUE;
- //
- // For Alt Keystroke.
- //
- case VK_MENU:
- if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
+ case VK_RWIN:
+ Private->RightLogo = Flag;
+ return TRUE;
+
+ case VK_APPS:
+ Private->Menu = Flag;
+ return TRUE;
+ //
+ // BUGBUG: PrintScreen/SysRq can not trigger WM_KEYDOWN message,
+ // so SySReq shift state is not supported here.
+ //
+ case VK_PRINT:
+ Private->SysReq = Flag;
+ return TRUE;
+ //
+ // For Alt Keystroke.
+ //
+ case VK_MENU:
+ if ((*lParam & GOP_EXTENDED_KEY) == GOP_EXTENDED_KEY) {
Private->RightAlt = Flag;
} else {
Private->LeftAlt = Flag;
}
- return TRUE;
- default:
- return FALSE;
+ return TRUE;
+
+ default:
+ return FALSE;
}
}
@@ -110,68 +113,138 @@ WinNtGopConvertParamToEfiKey ( IN EFI_INPUT_KEY *Key
)
{
- BOOLEAN Flag;
+ BOOLEAN Flag;
+
Flag = FALSE;
switch (*wParam) {
- case VK_HOME: Key->ScanCode = SCAN_HOME; Flag = TRUE; break;
- case VK_END: Key->ScanCode = SCAN_END; Flag = TRUE; break;
- case VK_LEFT: Key->ScanCode = SCAN_LEFT; Flag = TRUE; break;
- case VK_RIGHT: Key->ScanCode = SCAN_RIGHT; Flag = TRUE; break;
- case VK_UP: Key->ScanCode = SCAN_UP; Flag = TRUE; break;
- case VK_DOWN: Key->ScanCode = SCAN_DOWN; Flag = TRUE; break;
- case VK_DELETE: Key->ScanCode = SCAN_DELETE; Flag = TRUE; break;
- case VK_INSERT: Key->ScanCode = SCAN_INSERT; Flag = TRUE; break;
- case VK_PRIOR: Key->ScanCode = SCAN_PAGE_UP; Flag = TRUE; break;
- case VK_NEXT: Key->ScanCode = SCAN_PAGE_DOWN; Flag = TRUE; break;
- case VK_ESCAPE: Key->ScanCode = SCAN_ESC; Flag = TRUE; break;
-
- case VK_F1: Key->ScanCode = SCAN_F1; Flag = TRUE; break;
- case VK_F2: Key->ScanCode = SCAN_F2; Flag = TRUE; break;
- case VK_F3: Key->ScanCode = SCAN_F3; Flag = TRUE; break;
- case VK_F4: Key->ScanCode = SCAN_F4; Flag = TRUE; break;
- case VK_F5: Key->ScanCode = SCAN_F5; Flag = TRUE; break;
- case VK_F6: Key->ScanCode = SCAN_F6; Flag = TRUE; break;
- case VK_F7: Key->ScanCode = SCAN_F7; Flag = TRUE; break;
- case VK_F8: Key->ScanCode = SCAN_F8; Flag = TRUE; break;
- case VK_F9: Key->ScanCode = SCAN_F9; Flag = TRUE; break;
- case VK_F11: Key->ScanCode = SCAN_F11; Flag = TRUE; break;
- case VK_F12: Key->ScanCode = SCAN_F12; Flag = TRUE; break;
-
- case VK_F13: Key->ScanCode = SCAN_F13; Flag = TRUE; break;
- case VK_F14: Key->ScanCode = SCAN_F14; Flag = TRUE; break;
- case VK_F15: Key->ScanCode = SCAN_F15; Flag = TRUE; break;
- case VK_F16: Key->ScanCode = SCAN_F16; Flag = TRUE; break;
- case VK_F17: Key->ScanCode = SCAN_F17; Flag = TRUE; break;
- case VK_F18: Key->ScanCode = SCAN_F18; Flag = TRUE; break;
- case VK_F19: Key->ScanCode = SCAN_F19; Flag = TRUE; break;
- case VK_F20: Key->ScanCode = SCAN_F20; Flag = TRUE; break;
- case VK_F21: Key->ScanCode = SCAN_F21; Flag = TRUE; break;
- case VK_F22: Key->ScanCode = SCAN_F22; Flag = TRUE; break;
- case VK_F23: Key->ScanCode = SCAN_F23; Flag = TRUE; break;
- case VK_F24: Key->ScanCode = SCAN_F24; Flag = TRUE; break;
- case VK_PAUSE: Key->ScanCode = SCAN_PAUSE; Flag = TRUE; break;
-
- //
- // Set toggle state
- //
- case VK_NUMLOCK:
- Private->NumLock = (BOOLEAN)(!Private->NumLock);
- Flag = TRUE;
- break;
- case VK_SCROLL:
- Private->ScrollLock = (BOOLEAN)(!Private->ScrollLock);
- Flag = TRUE;
- break;
- case VK_CAPITAL:
- Private->CapsLock = (BOOLEAN)(!Private->CapsLock);
- Flag = TRUE;
- break;
+ case VK_HOME: Key->ScanCode = SCAN_HOME;
+ Flag = TRUE;
+ break;
+ case VK_END: Key->ScanCode = SCAN_END;
+ Flag = TRUE;
+ break;
+ case VK_LEFT: Key->ScanCode = SCAN_LEFT;
+ Flag = TRUE;
+ break;
+ case VK_RIGHT: Key->ScanCode = SCAN_RIGHT;
+ Flag = TRUE;
+ break;
+ case VK_UP: Key->ScanCode = SCAN_UP;
+ Flag = TRUE;
+ break;
+ case VK_DOWN: Key->ScanCode = SCAN_DOWN;
+ Flag = TRUE;
+ break;
+ case VK_DELETE: Key->ScanCode = SCAN_DELETE;
+ Flag = TRUE;
+ break;
+ case VK_INSERT: Key->ScanCode = SCAN_INSERT;
+ Flag = TRUE;
+ break;
+ case VK_PRIOR: Key->ScanCode = SCAN_PAGE_UP;
+ Flag = TRUE;
+ break;
+ case VK_NEXT: Key->ScanCode = SCAN_PAGE_DOWN;
+ Flag = TRUE;
+ break;
+ case VK_ESCAPE: Key->ScanCode = SCAN_ESC;
+ Flag = TRUE;
+ break;
+
+ case VK_F1: Key->ScanCode = SCAN_F1;
+ Flag = TRUE;
+ break;
+ case VK_F2: Key->ScanCode = SCAN_F2;
+ Flag = TRUE;
+ break;
+ case VK_F3: Key->ScanCode = SCAN_F3;
+ Flag = TRUE;
+ break;
+ case VK_F4: Key->ScanCode = SCAN_F4;
+ Flag = TRUE;
+ break;
+ case VK_F5: Key->ScanCode = SCAN_F5;
+ Flag = TRUE;
+ break;
+ case VK_F6: Key->ScanCode = SCAN_F6;
+ Flag = TRUE;
+ break;
+ case VK_F7: Key->ScanCode = SCAN_F7;
+ Flag = TRUE;
+ break;
+ case VK_F8: Key->ScanCode = SCAN_F8;
+ Flag = TRUE;
+ break;
+ case VK_F9: Key->ScanCode = SCAN_F9;
+ Flag = TRUE;
+ break;
+ case VK_F11: Key->ScanCode = SCAN_F11;
+ Flag = TRUE;
+ break;
+ case VK_F12: Key->ScanCode = SCAN_F12;
+ Flag = TRUE;
+ break;
+
+ case VK_F13: Key->ScanCode = SCAN_F13;
+ Flag = TRUE;
+ break;
+ case VK_F14: Key->ScanCode = SCAN_F14;
+ Flag = TRUE;
+ break;
+ case VK_F15: Key->ScanCode = SCAN_F15;
+ Flag = TRUE;
+ break;
+ case VK_F16: Key->ScanCode = SCAN_F16;
+ Flag = TRUE;
+ break;
+ case VK_F17: Key->ScanCode = SCAN_F17;
+ Flag = TRUE;
+ break;
+ case VK_F18: Key->ScanCode = SCAN_F18;
+ Flag = TRUE;
+ break;
+ case VK_F19: Key->ScanCode = SCAN_F19;
+ Flag = TRUE;
+ break;
+ case VK_F20: Key->ScanCode = SCAN_F20;
+ Flag = TRUE;
+ break;
+ case VK_F21: Key->ScanCode = SCAN_F21;
+ Flag = TRUE;
+ break;
+ case VK_F22: Key->ScanCode = SCAN_F22;
+ Flag = TRUE;
+ break;
+ case VK_F23: Key->ScanCode = SCAN_F23;
+ Flag = TRUE;
+ break;
+ case VK_F24: Key->ScanCode = SCAN_F24;
+ Flag = TRUE;
+ break;
+ case VK_PAUSE: Key->ScanCode = SCAN_PAUSE;
+ Flag = TRUE;
+ break;
+
+ //
+ // Set toggle state
+ //
+ case VK_NUMLOCK:
+ Private->NumLock = (BOOLEAN)(!Private->NumLock);
+ Flag = TRUE;
+ break;
+ case VK_SCROLL:
+ Private->ScrollLock = (BOOLEAN)(!Private->ScrollLock);
+ Flag = TRUE;
+ break;
+ case VK_CAPITAL:
+ Private->CapsLock = (BOOLEAN)(!Private->CapsLock);
+ Flag = TRUE;
+ break;
}
return (WinNtGopConvertParamToEfiKeyShiftState (Private, wParam, lParam, TRUE)) == TRUE ? TRUE : Flag;
}
-
//
// GOP Protocol Member Functions
//
@@ -185,15 +258,15 @@ WinNtWndSize ( IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
IN UINT32 Width,
IN UINT32 Height
-)
+ )
{
- RETURN_STATUS RStatus;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION Info;
- GRAPHICS_PRIVATE_DATA *Private;
- RECT Rect;
- BITMAPV4HEADER *VirtualScreenInfo;
- FRAME_BUFFER_CONFIGURE *FrameBufferConfigure;
- UINTN FrameBufferConfigureSize;
+ RETURN_STATUS RStatus;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION Info;
+ GRAPHICS_PRIVATE_DATA *Private;
+ RECT Rect;
+ BITMAPV4HEADER *VirtualScreenInfo;
+ FRAME_BUFFER_CONFIGURE *FrameBufferConfigure;
+ UINTN FrameBufferConfigureSize;
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
@@ -202,10 +275,10 @@ WinNtWndSize ( // This buffer is the virtual screen/frame buffer.
//
VirtualScreenInfo = HeapAlloc (
- GetProcessHeap (),
- HEAP_ZERO_MEMORY,
- Width * Height * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER)
- );
+ GetProcessHeap (),
+ HEAP_ZERO_MEMORY,
+ Width * Height * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER)
+ );
if (VirtualScreenInfo == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -214,10 +287,10 @@ WinNtWndSize ( // Update the virtual screen info data structure
// Use negative Height to make sure screen/buffer are using the same coordinate.
//
- VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
- VirtualScreenInfo->bV4Width = Width;
- VirtualScreenInfo->bV4Height = -(LONG)Height;
- VirtualScreenInfo->bV4Planes = 1;
+ VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
+ VirtualScreenInfo->bV4Width = Width;
+ VirtualScreenInfo->bV4Height = -(LONG)Height;
+ VirtualScreenInfo->bV4Planes = 1;
VirtualScreenInfo->bV4BitCount = 32;
//
// uncompressed
@@ -229,20 +302,21 @@ WinNtWndSize ( Info.PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
Info.PixelsPerScanLine = Width;
FrameBufferConfigureSize = 0;
- RStatus = FrameBufferBltConfigure (VirtualScreenInfo + 1, &Info, NULL, &FrameBufferConfigureSize);
+ RStatus = FrameBufferBltConfigure (VirtualScreenInfo + 1, &Info, NULL, &FrameBufferConfigureSize);
ASSERT (RStatus == EFI_BUFFER_TOO_SMALL);
FrameBufferConfigure = AllocatePool (FrameBufferConfigureSize);
if (FrameBufferConfigure == NULL) {
HeapFree (GetProcessHeap (), 0, VirtualScreenInfo);
return EFI_OUT_OF_RESOURCES;
}
+
RStatus = FrameBufferBltConfigure (VirtualScreenInfo + 1, &Info, FrameBufferConfigure, &FrameBufferConfigureSize);
ASSERT_RETURN_ERROR (RStatus);
-
if (Private->FrameBufferConfigure != NULL) {
FreePool (Private->FrameBufferConfigure);
}
+
Private->FrameBufferConfigure = FrameBufferConfigure;
//
@@ -253,6 +327,7 @@ WinNtWndSize ( if (Private->VirtualScreenInfo != NULL) {
HeapFree (GetProcessHeap (), 0, Private->VirtualScreenInfo);
}
+
Private->VirtualScreenInfo = VirtualScreenInfo;
Private->Width = Width;
@@ -321,24 +396,27 @@ WinNtWndSize ( // TODO: Delta - add argument and description to function comment
EFI_STATUS
WinNtWndBlt (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
- IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
-)
+ IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo,
+ IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
+ IN EFI_UGA_BLT_OPERATION BltOperation,
+ IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
+ )
{
- RETURN_STATUS RStatus;
- GRAPHICS_PRIVATE_DATA *Private;
- RECT Rect;
+ RETURN_STATUS RStatus;
+ GRAPHICS_PRIVATE_DATA *Private;
+ RECT Rect;
Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
RStatus = FrameBufferBlt (
Private->FrameBufferConfigure,
BltBuffer,
BltOperation,
- Args->SourceX, Args->SourceY,
- Args->DestinationX, Args->DestinationY,
- Args->Width, Args->Height,
+ Args->SourceX,
+ Args->SourceY,
+ Args->DestinationX,
+ Args->DestinationY,
+ Args->Width,
+ Args->Height,
Args->Delta
);
if (RETURN_ERROR (RStatus)) {
@@ -370,8 +448,6 @@ WinNtWndBlt ( return EFI_SUCCESS;
}
-
-
/**
Win32 Windows event handler.
@@ -393,14 +469,14 @@ WinNtGopThreadWindowProc ( IN LPARAM lParam
)
{
- GRAPHICS_PRIVATE_DATA *Private;
- HDC Handle;
- PAINTSTRUCT PaintStruct;
- LPARAM Index;
- EFI_INPUT_KEY Key;
- BOOLEAN AltIsPress;
- INT32 PosX;
- INT32 PosY;
+ GRAPHICS_PRIVATE_DATA *Private;
+ HDC Handle;
+ PAINTSTRUCT PaintStruct;
+ LPARAM Index;
+ EFI_INPUT_KEY Key;
+ BOOLEAN AltIsPress;
+ INT32 PosX;
+ INT32 PosY;
//
// Use mTlsIndex global to get a Thread Local Storage version of Private.
@@ -408,190 +484,195 @@ WinNtGopThreadWindowProc ( // a unique thread.
//
AltIsPress = FALSE;
- Private = TlsGetValue (mTlsIndex);
+ Private = TlsGetValue (mTlsIndex);
ASSERT (NULL != Private);
switch (iMsg) {
- case WM_PAINT:
- Handle = BeginPaint (hwnd, &PaintStruct);
-
- SetDIBitsToDevice (
- Handle, // Destination Device Context
- 0, // Destination X - 0
- 0, // Destination Y - 0
- Private->Width, // Width
- Private->Height, // Height
- 0, // Source X
- 0, // Source Y
- 0, // DIB Start Scan Line
- Private->Height, // Number of scan lines
- Private->VirtualScreenInfo + 1, // Address of array of DIB bits
- (BITMAPINFO *) Private->VirtualScreenInfo, // Address of structure with bitmap info
- DIB_RGB_COLORS // RGB or palette indexes
- );
-
- EndPaint (hwnd, &PaintStruct);
- return 0;
-
- //
- // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
- // WM_SYSKEYDOWN is posted when F10 is pressed or
- // holds down ALT key and then presses another key.
- //
- case WM_SYSKEYDOWN:
-
- Key.ScanCode = 0;
- Key.UnicodeChar = CHAR_NULL;
- switch (wParam) {
- case VK_F10:
- Key.ScanCode = SCAN_F10;
- Key.UnicodeChar = CHAR_NULL;
- GopPrivateAddKey (Private, Key);
+ case WM_PAINT:
+ Handle = BeginPaint (hwnd, &PaintStruct);
+
+ SetDIBitsToDevice (
+ Handle, // Destination Device Context
+ 0, // Destination X - 0
+ 0, // Destination Y - 0
+ Private->Width, // Width
+ Private->Height, // Height
+ 0, // Source X
+ 0, // Source Y
+ 0, // DIB Start Scan Line
+ Private->Height, // Number of scan lines
+ Private->VirtualScreenInfo + 1, // Address of array of DIB bits
+ (BITMAPINFO *)Private->VirtualScreenInfo, // Address of structure with bitmap info
+ DIB_RGB_COLORS // RGB or palette indexes
+ );
+
+ EndPaint (hwnd, &PaintStruct);
return 0;
- }
//
- // If ALT or ALT + modifier key is pressed.
+ // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
+ // WM_SYSKEYDOWN is posted when F10 is pressed or
+ // holds down ALT key and then presses another key.
//
- if (WinNtGopConvertParamToEfiKey (Private, &wParam, &lParam, &Key)) {
- if (Key.ScanCode != 0){
+ case WM_SYSKEYDOWN:
+
+ Key.ScanCode = 0;
+ Key.UnicodeChar = CHAR_NULL;
+ switch (wParam) {
+ case VK_F10:
+ Key.ScanCode = SCAN_F10;
+ Key.UnicodeChar = CHAR_NULL;
+ GopPrivateAddKey (Private, Key);
+ return 0;
+ }
+
+ //
+ // If ALT or ALT + modifier key is pressed.
+ //
+ if (WinNtGopConvertParamToEfiKey (Private, &wParam, &lParam, &Key)) {
+ if (Key.ScanCode != 0) {
+ //
+ // If ALT is pressed with other ScanCode.
+ // Always revers the left Alt for simple.
+ //
+ Private->LeftAlt = TRUE;
+ }
+
+ GopPrivateAddKey (Private, Key);
//
- // If ALT is pressed with other ScanCode.
- // Always revers the left Alt for simple.
+ // When Alt is released there is no windoes message, so
+ // clean it after using it.
//
- Private->LeftAlt = TRUE;
+ Private->RightAlt = FALSE;
+ Private->LeftAlt = FALSE;
+ return 0;
}
- GopPrivateAddKey (Private, Key);
+
+ AltIsPress = TRUE;
+
+ case WM_CHAR:
//
- // When Alt is released there is no windoes message, so
- // clean it after using it.
+ // The ESC key also generate WM_CHAR.
//
- Private->RightAlt = FALSE;
- Private->LeftAlt = FALSE;
+ if (wParam == 0x1B) {
+ return 0;
+ }
+
+ if (AltIsPress == TRUE) {
+ //
+ // If AltIsPress is true that means the Alt key is pressed.
+ //
+ Private->LeftAlt = TRUE;
+ }
+
+ for (Index = 0; Index < (lParam & 0xffff); Index++) {
+ if (wParam != 0) {
+ Key.UnicodeChar = (CHAR16)wParam;
+ Key.ScanCode = SCAN_NULL;
+ GopPrivateAddKey (Private, Key);
+ }
+ }
+
+ if (AltIsPress == TRUE) {
+ //
+ // When Alt is released there is no windoes message, so
+ // clean it after using it.
+ //
+ Private->LeftAlt = FALSE;
+ Private->RightAlt = FALSE;
+ }
+
return 0;
- }
- AltIsPress = TRUE;
- case WM_CHAR:
- //
- // The ESC key also generate WM_CHAR.
- //
- if (wParam == 0x1B) {
+ case WM_SYSKEYUP:
+ //
+ // ALT is pressed with another key released
+ //
+ WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
return 0;
- }
- if (AltIsPress == TRUE) {
+ case WM_KEYDOWN:
+ Key.ScanCode = SCAN_NULL;
+ Key.UnicodeChar = CHAR_NULL;
//
- // If AltIsPress is true that means the Alt key is pressed.
+ // A value key press will cause a WM_KEYDOWN first, then cause a WM_CHAR
+ // So if there is no modifier key updated, skip the WM_KEYDOWN even.
//
- Private->LeftAlt = TRUE;
- }
- for (Index = 0; Index < (lParam & 0xffff); Index++) {
- if (wParam != 0) {
- Key.UnicodeChar = (CHAR16) wParam;
- Key.ScanCode = SCAN_NULL;
+ if (WinNtGopConvertParamToEfiKey (Private, &wParam, &lParam, &Key)) {
+ //
+ // Support the partial keystroke, add all keydown event into the queue.
+ //
GopPrivateAddKey (Private, Key);
}
- }
- if (AltIsPress == TRUE) {
- //
- // When Alt is released there is no windoes message, so
- // clean it after using it.
- //
- Private->LeftAlt = FALSE;
- Private->RightAlt = FALSE;
- }
- return 0;
- case WM_SYSKEYUP:
- //
- // ALT is pressed with another key released
- //
- WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
- return 0;
+ return 0;
- case WM_KEYDOWN:
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = CHAR_NULL;
- //
- // A value key press will cause a WM_KEYDOWN first, then cause a WM_CHAR
- // So if there is no modifier key updated, skip the WM_KEYDOWN even.
- //
- if (WinNtGopConvertParamToEfiKey (Private, &wParam, &lParam, &Key)) {
+ case WM_KEYUP:
+ WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ PosX = GET_X_LPARAM (lParam);
+ PosY = GET_Y_LPARAM (lParam);
+
+ if (Private->PointerPreviousX != PosX) {
+ Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
+ Private->PointerPreviousX = PosX;
+ Private->PointerStateChanged = TRUE;
+ }
+
+ if (Private->PointerPreviousY != PosY) {
+ Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
+ Private->PointerPreviousY = PosY;
+ Private->PointerStateChanged = TRUE;
+ }
+
+ Private->PointerState.RelativeMovementZ = 0;
+ return 0;
+
+ case WM_LBUTTONDOWN:
+ Private->PointerState.LeftButton = TRUE;
+ Private->PointerStateChanged = TRUE;
+ return 0;
+
+ case WM_LBUTTONUP:
+ Private->PointerState.LeftButton = FALSE;
+ Private->PointerStateChanged = TRUE;
+ return 0;
+
+ case WM_RBUTTONDOWN:
+ Private->PointerState.RightButton = TRUE;
+ Private->PointerStateChanged = TRUE;
+ return 0;
+
+ case WM_RBUTTONUP:
+ Private->PointerState.RightButton = FALSE;
+ Private->PointerStateChanged = TRUE;
+ return 0;
+
+ case WM_CLOSE:
//
- // Support the partial keystroke, add all keydown event into the queue.
+ // This close message is issued by user, core is not aware of this,
+ // so don't release the window display resource, just hide the window.
//
- GopPrivateAddKey (Private, Key);
- }
- return 0;
-
- case WM_KEYUP:
- WinNtGopConvertParamToEfiKeyShiftState (Private, &wParam, &lParam, FALSE);
- return 0;
-
- case WM_MOUSEMOVE:
- PosX = GET_X_LPARAM (lParam);
- PosY = GET_Y_LPARAM (lParam);
-
- if (Private->PointerPreviousX != PosX) {
- Private->PointerState.RelativeMovementX += (PosX - Private->PointerPreviousX);
- Private->PointerPreviousX = PosX;
- Private->PointerStateChanged = TRUE;
- }
-
- if (Private->PointerPreviousY != PosY) {
- Private->PointerState.RelativeMovementY += (PosY - Private->PointerPreviousY);
- Private->PointerPreviousY = PosY;
- Private->PointerStateChanged = TRUE;
- }
-
- Private->PointerState.RelativeMovementZ = 0;
- return 0;
-
- case WM_LBUTTONDOWN:
- Private->PointerState.LeftButton = TRUE;
- Private->PointerStateChanged = TRUE;
- return 0;
-
- case WM_LBUTTONUP:
- Private->PointerState.LeftButton = FALSE;
- Private->PointerStateChanged = TRUE;
- return 0;
-
- case WM_RBUTTONDOWN:
- Private->PointerState.RightButton = TRUE;
- Private->PointerStateChanged = TRUE;
- return 0;
-
- case WM_RBUTTONUP:
- Private->PointerState.RightButton = FALSE;
- Private->PointerStateChanged = TRUE;
- return 0;
-
- case WM_CLOSE:
- //
- // This close message is issued by user, core is not aware of this,
- // so don't release the window display resource, just hide the window.
- //
- ShowWindow (Private->WindowHandle, SW_HIDE);
- return 0;
+ ShowWindow (Private->WindowHandle, SW_HIDE);
+ return 0;
- case WM_DESTROY:
- DestroyWindow (hwnd);
- PostQuitMessage (0);
+ case WM_DESTROY:
+ DestroyWindow (hwnd);
+ PostQuitMessage (0);
- HeapFree (GetProcessHeap (), 0, Private->VirtualScreenInfo);
+ HeapFree (GetProcessHeap (), 0, Private->VirtualScreenInfo);
- ExitThread (0);
+ ExitThread (0);
- default:
- break;
- };
+ default:
+ break;
+ }
return DefWindowProc (hwnd, iMsg, wParam, lParam);
}
-
/**
This thread simulates the end of WinMain () application. Each Window needs
to process its events. The messages are dispatched to
@@ -607,14 +688,14 @@ WinNtGopThreadWindowProc ( DWORD
WINAPI
WinNtGopThreadWinMain (
- LPVOID lpParameter
+ LPVOID lpParameter
)
{
MSG Message;
GRAPHICS_PRIVATE_DATA *Private;
RECT Rect;
- Private = (GRAPHICS_PRIVATE_DATA *) lpParameter;
+ Private = (GRAPHICS_PRIVATE_DATA *)lpParameter;
ASSERT (NULL != Private);
//
@@ -624,7 +705,7 @@ WinNtGopThreadWinMain ( //
TlsSetValue (mTlsIndex, Private);
- Private->ThreadId = GetCurrentThreadId ();
+ Private->ThreadId = GetCurrentThreadId ();
Private->WindowsClass.cbSize = sizeof (WNDCLASSEX);
Private->WindowsClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
@@ -645,7 +726,6 @@ WinNtGopThreadWinMain ( Private->Width = 100;
Private->Height = 100;
-
//
// This call will fail after the first time, but thats O.K. since we only need
// WIN_NT_GOP_CLASS_NAME to exist to create the window.
@@ -703,7 +783,6 @@ WinNtGopThreadWinMain ( return (DWORD)Message.wParam;
}
-
/**
TODO: Add function description
@@ -719,11 +798,11 @@ WinNtGopThreadWinMain ( EFI_STATUS
EFIAPI
WinNtGraphicsWindowOpen (
- IN EMU_IO_THUNK_PROTOCOL *This
+ IN EMU_IO_THUNK_PROTOCOL *This
)
{
- DWORD NewThreadId;
- GRAPHICS_PRIVATE_DATA *Private;
+ DWORD NewThreadId;
+ GRAPHICS_PRIVATE_DATA *Private;
Private = AllocateZeroPool (sizeof (*Private));
@@ -758,7 +837,7 @@ WinNtGraphicsWindowOpen ( NULL,
0,
WinNtGopThreadWinMain,
- (VOID *) Private,
+ (VOID *)Private,
0,
&NewThreadId
);
@@ -770,7 +849,7 @@ WinNtGraphicsWindowOpen ( WaitForSingleObject (Private->ThreadInited, INFINITE);
CloseHandle (Private->ThreadInited);
- This->Private = Private;
+ This->Private = Private;
This->Interface = &Private->GraphicsWindowIo;
return EFI_SUCCESS;
@@ -779,10 +858,10 @@ WinNtGraphicsWindowOpen ( EFI_STATUS
EFIAPI
WinNtGraphicsWindowClose (
- IN EMU_IO_THUNK_PROTOCOL *This
-)
+ IN EMU_IO_THUNK_PROTOCOL *This
+ )
{
- GRAPHICS_PRIVATE_DATA *Private;
+ GRAPHICS_PRIVATE_DATA *Private;
Private = (GRAPHICS_PRIVATE_DATA *)This->Private;
@@ -807,16 +886,14 @@ WinNtGraphicsWindowClose ( UnregisterClass (
Private->WindowsClass.lpszClassName,
Private->WindowsClass.hInstance
- );
+ );
}
-
GopPrivateDestroyQ (Private, &Private->QueueForRead);
return EFI_SUCCESS;
}
-
-EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo = {
+EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo = {
&gEmuGraphicsWindowProtocolGuid,
NULL,
NULL,
|