TianoCore EDK2 master
Loading...
Searching...
No Matches
WinGop.h
Go to the documentation of this file.
1
17#ifndef _WIN_GOP_H_
18#define _WIN_GOP_H_
19
20#include "WinHost.h"
21
22#include <Protocol/EmuIoThunk.h>
23#include <Protocol/EmuGraphicsWindow.h>
29
30//
31// WM_SYSKEYDOWN/WM_SYSKEYUP Notification
32// lParam
33// bit 24: Specifies whether the key is an extended key,
34// such as the right-hand ALT and CTRL keys that appear on
35// an enhanced 101- or 102-key keyboard.
36// The value is 1 if it is an extended key; otherwise, it is 0.
37// bit 29:Specifies the context code.
38// The value is 1 if the ALT key is down while the key is pressed/released;
39// it is 0 if the WM_SYSKEYDOWN message is posted to the active window
40// because no window has the keyboard focus.
41#define GOP_EXTENDED_KEY (0x1 << 24)
42#define GOP_ALT_KEY_PRESSED (0x1 << 29)
43
44#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
45
46#define MAX_Q 256
47
48typedef struct {
49 UINTN Front;
50 UINTN Rear;
51 EFI_KEY_DATA Q[MAX_Q];
52 CRITICAL_SECTION Cs;
54
55#define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
56
57typedef struct {
58 UINT64 Signature;
59 EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsWindowIo;
60
61 //
62 // GOP Private Data knowing when to start hardware
63 //
64 BOOLEAN HardwareNeedsStarting;
65
66 CHAR16 *WindowName;
67 CHAR16 Buffer[160];
68
69 HANDLE ThreadInited; // Semaphore
70 HANDLE ThreadHandle; // Thread
71 DWORD ThreadId;
72
73 HWND WindowHandle;
74 WNDCLASSEX WindowsClass;
75
76 UINT32 Width;
77 UINT32 Height;
78 //
79 // This screen is used to redraw the screen when windows events happen. It's
80 // updated in the main thread and displayed in the windows thread.
81 //
82 BITMAPV4HEADER *VirtualScreenInfo;
83
84 FRAME_BUFFER_CONFIGURE *FrameBufferConfigure;
85
86 //
87 // Keyboard Queue used by Simple Text In.
88 // QueueForRead: WinProc thread adds, and main thread removes.
89 //
90 GOP_QUEUE_FIXED QueueForRead;
91
92 EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeRegisterdKeyCallback;
93 EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakRegisterdKeyCallback;
94 VOID *RegisterdKeyCallbackContext;
95
96 EFI_KEY_STATE KeyState;
97 BOOLEAN LeftShift;
98 BOOLEAN RightShift;
99 BOOLEAN LeftAlt;
100 BOOLEAN RightAlt;
101 BOOLEAN LeftCtrl;
102 BOOLEAN RightCtrl;
103 BOOLEAN LeftLogo;
104 BOOLEAN RightLogo;
105 BOOLEAN Menu;
106 BOOLEAN SysReq;
107 BOOLEAN NumLock;
108 BOOLEAN ScrollLock;
109 BOOLEAN CapsLock;
110 BOOLEAN IsPartialKeySupport;
111 INT32 PointerPreviousX;
112 INT32 PointerPreviousY;
113 BOOLEAN PointerStateChanged;
114 EFI_SIMPLE_POINTER_STATE PointerState;
116#define GRAPHICS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('g', 'f', 'x', 'd')
117#define GRAPHICS_PRIVATE_DATA_FROM_THIS(a) \
118 CR(a, GRAPHICS_PRIVATE_DATA, GraphicsWindowIo, GRAPHICS_PRIVATE_DATA_SIGNATURE)
119
120//
121// Gop Hardware abstraction internal worker functions
122//
123
135 IN GRAPHICS_PRIVATE_DATA *Private,
136 IN EFI_INPUT_KEY Key
137 );
138
140EFIAPI
141WinNtWndGetKey (
143 IN EFI_KEY_DATA *KeyData
144 );
145
147EFIAPI
148WinNtWndCheckKey (
150 );
151
153EFIAPI
154WinNtWndKeySetState (
156 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
157 );
158
160EFIAPI
161WinNtWndRegisterKeyNotify (
163 IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
164 IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
165 IN VOID *Context
166 );
167
169EFIAPI
170WinNtWndCheckPointer (
172 );
173
175EFIAPI
176WinNtWndGetPointerState (
179 );
180
183 IN GRAPHICS_PRIVATE_DATA *Private,
184 IN GOP_QUEUE_FIXED *Queue
185 );
186
197 IN GRAPHICS_PRIVATE_DATA *Private,
198 IN GOP_QUEUE_FIXED *Queue
199 );
200
201#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
UINT8 EFI_KEY_TOGGLE_STATE
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_STATUS GopPrivateDestroyQ(IN GRAPHICS_PRIVATE_DATA *Private, IN GOP_QUEUE_FIXED *Queue)
Definition: WinGopInput.c:56
EFI_STATUS GopPrivateCreateQ(IN GRAPHICS_PRIVATE_DATA *Private, IN GOP_QUEUE_FIXED *Queue)
Definition: WinGopInput.c:36
EFI_STATUS GopPrivateAddKey(IN GRAPHICS_PRIVATE_DATA *Private, IN EFI_INPUT_KEY Key)
Definition: WinGopInput.c:247