3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2010, Apple, Inc. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 This file produces the Simple Text In for an Uga window.
21 This stuff is linked at the hip to the Window, since the window
22 processing is done in a thread kicked off in UnixUgaImplementation.c
24 Since the window information is processed in an other thread we need
25 a keyboard Queue to pass data about. The Simple Text In code just
26 takes data off the Queue. The WinProc message loop takes keyboard input
27 and places it in the Queue.
34 // Simple Text In implementation.
39 UnixUgaSimpleTextInReset (
40 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
41 IN BOOLEAN ExtendedVerification
47 TODO: Add function description
51 This - TODO: add argument description
52 ExtendedVerification - TODO: add argument description
56 EFI_SUCCESS - TODO: Add description for return value
60 UGA_PRIVATE_DATA
*Private
;
64 Private
= UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
65 if (Private
->UgaIo
== NULL
) {
70 // Enter critical section
72 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
75 // A reset is draining the Queue
77 while (Private
->UgaIo
->UgaGetKey (Private
->UgaIo
, &Key
) == EFI_SUCCESS
)
81 // Leave critical section and return
83 gBS
->RestoreTPL (OldTpl
);
89 UnixUgaSimpleTextInReadKeyStroke (
90 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
91 OUT EFI_INPUT_KEY
*Key
97 TODO: Add function description
101 This - TODO: add argument description
102 Key - TODO: add argument description
106 TODO: add return values
110 UGA_PRIVATE_DATA
*Private
;
113 EFI_KEY_DATA KeyData
;
115 Private
= UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
116 if (Private
->UgaIo
== NULL
) {
117 return EFI_NOT_READY
;
121 // Enter critical section
123 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
125 Status
= Private
->UgaIo
->UgaGetKey(Private
->UgaIo
, &KeyData
);
126 CopyMem (Key
, &KeyData
, sizeof (EFI_INPUT_KEY
));
129 // Leave critical section and return
131 gBS
->RestoreTPL (OldTpl
);
138 UnixUgaSimpleTextInWaitForKey (
146 TODO: Add function description
150 Event - TODO: add argument description
151 Context - TODO: add argument description
155 TODO: add return values
159 UGA_PRIVATE_DATA
*Private
;
163 Private
= (UGA_PRIVATE_DATA
*) Context
;
164 if (Private
->UgaIo
== NULL
) {
169 // Enter critical section
171 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
173 Status
= Private
->UgaIo
->UgaCheckKey(Private
->UgaIo
);
174 if (!EFI_ERROR (Status
)) {
176 // If a there is a key in the queue signal our event.
178 gBS
->SignalEvent (Event
);
181 // Leave critical section and return
183 gBS
->RestoreTPL (OldTpl
);
187 // Simple Pointer implementation.
192 UnixUgaSimplePointerReset (
193 IN EFI_SIMPLE_POINTER_PROTOCOL
*This
,
194 IN BOOLEAN ExtendedVerification
200 TODO: Add function description
204 This - TODO: add argument description
205 ExtendedVerification - TODO: add argument description
209 EFI_SUCCESS - TODO: Add description for return value
213 UGA_PRIVATE_DATA
*Private
;
214 EFI_SIMPLE_POINTER_STATE State
;
217 Private
= UGA_PRIVATE_DATA_FROM_POINTER_THIS (This
);
218 if (Private
->UgaIo
== NULL
) {
223 // Enter critical section
225 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
228 // A reset is draining the Queue
230 while (Private
->UgaIo
->UgaGetPointerState(Private
->UgaIo
, &State
) == EFI_SUCCESS
)
234 // Leave critical section and return
236 gBS
->RestoreTPL (OldTpl
);
242 UnixUgaSimplePointerGetState (
243 IN EFI_SIMPLE_POINTER_PROTOCOL
*This
,
244 IN OUT EFI_SIMPLE_POINTER_STATE
*State
250 TODO: Add function description
254 This - TODO: add argument description
255 Key - TODO: add argument description
259 TODO: add return values
263 UGA_PRIVATE_DATA
*Private
;
267 Private
= UGA_PRIVATE_DATA_FROM_POINTER_THIS (This
);
268 if (Private
->UgaIo
== NULL
) {
269 return EFI_NOT_READY
;
273 // Enter critical section
275 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
277 Status
= Private
->UgaIo
->UgaGetPointerState(Private
->UgaIo
, State
);
279 // Leave critical section and return
281 gBS
->RestoreTPL (OldTpl
);
288 UnixUgaSimplePointerWaitForInput (
296 TODO: Add function description
300 Event - TODO: add argument description
301 Context - TODO: add argument description
305 TODO: add return values
309 UGA_PRIVATE_DATA
*Private
;
313 Private
= (UGA_PRIVATE_DATA
*) Context
;
314 if (Private
->UgaIo
== NULL
) {
319 // Enter critical section
321 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
323 Status
= Private
->UgaIo
->UgaCheckPointer(Private
->UgaIo
);
324 if (!EFI_ERROR (Status
)) {
326 // If the pointer state has changed, signal our event.
328 gBS
->SignalEvent (Event
);
331 // Leave critical section and return
333 gBS
->RestoreTPL (OldTpl
);
337 UnixUgaInitializeSimpleTextInForWindow (
338 IN UGA_PRIVATE_DATA
*Private
344 TODO: Add function description
348 Private - TODO: add argument description
352 TODO: add return values
359 // Initialize Simple Text In protoocol
361 Private
->SimpleTextIn
.Reset
= UnixUgaSimpleTextInReset
;
362 Private
->SimpleTextIn
.ReadKeyStroke
= UnixUgaSimpleTextInReadKeyStroke
;
364 Status
= gBS
->CreateEvent (
367 UnixUgaSimpleTextInWaitForKey
,
369 &Private
->SimpleTextIn
.WaitForKey
376 UnixUgaInitializeSimplePointerForWindow (
377 IN UGA_PRIVATE_DATA
*Private
383 TODO: Add function description
387 Private - TODO: add argument description
391 TODO: add return values
398 // Initialize Simple Pointer protoocol
400 Private
->PointerMode
.ResolutionX
= 1;
401 Private
->PointerMode
.ResolutionY
= 1;
402 Private
->PointerMode
.LeftButton
= TRUE
;
403 Private
->PointerMode
.RightButton
= TRUE
;
405 Private
->SimplePointer
.Reset
= UnixUgaSimplePointerReset
;
406 Private
->SimplePointer
.GetState
= UnixUgaSimplePointerGetState
;
407 Private
->SimplePointer
.Mode
= &Private
->PointerMode
;
409 Status
= gBS
->CreateEvent (
412 UnixUgaSimplePointerWaitForInput
,
414 &Private
->SimplePointer
.WaitForInput