提交 6e13160e 编写于 作者: M Marvin Häuser

OpenCanopy: Pull KeyEvent out of GUI objects

Key events cannot abstractly be propagated, hence there is no point to the abstraction.
上级 8f5719bb
...@@ -877,6 +877,7 @@ VOID ...@@ -877,6 +877,7 @@ VOID
GuiViewInitialize ( GuiViewInitialize (
OUT GUI_DRAWING_CONTEXT *DrawContext, OUT GUI_DRAWING_CONTEXT *DrawContext,
IN OUT GUI_OBJ *Screen, IN OUT GUI_OBJ *Screen,
IN GUI_OBJ_KEY_EVENT KeyEvent,
IN GUI_CURSOR_GET_IMAGE GetCursorImage, IN GUI_CURSOR_GET_IMAGE GetCursorImage,
IN GUI_EXIT_LOOP ExitLoop, IN GUI_EXIT_LOOP ExitLoop,
IN BOOT_PICKER_GUI_CONTEXT *GuiContext IN BOOT_PICKER_GUI_CONTEXT *GuiContext
...@@ -886,6 +887,7 @@ GuiViewInitialize ( ...@@ -886,6 +887,7 @@ GuiViewInitialize (
ASSERT (DrawContext != NULL); ASSERT (DrawContext != NULL);
ASSERT (Screen != NULL); ASSERT (Screen != NULL);
ASSERT (KeyEvent != NULL);
ASSERT (GetCursorImage != NULL); ASSERT (GetCursorImage != NULL);
ASSERT (ExitLoop != NULL); ASSERT (ExitLoop != NULL);
...@@ -896,6 +898,7 @@ GuiViewInitialize ( ...@@ -896,6 +898,7 @@ GuiViewInitialize (
Screen->Height = OutputInfo->VerticalResolution; Screen->Height = OutputInfo->VerticalResolution;
DrawContext->Screen = Screen; DrawContext->Screen = Screen;
DrawContext->KeyEvent = KeyEvent;
DrawContext->GetCursorImage = GetCursorImage; DrawContext->GetCursorImage = GetCursorImage;
DrawContext->ExitLoop = ExitLoop; DrawContext->ExitLoop = ExitLoop;
DrawContext->GuiContext = GuiContext; DrawContext->GuiContext = GuiContext;
...@@ -1086,16 +1089,16 @@ GuiDrawLoop ( ...@@ -1086,16 +1089,16 @@ GuiDrawLoop (
// //
Status = GuiKeyRead (mKeyContext, &InputKey, &Modifier); Status = GuiKeyRead (mKeyContext, &InputKey, &Modifier);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
ASSERT (DrawContext->Screen->KeyEvent != NULL); ASSERT (DrawContext->KeyEvent != NULL);
DrawContext->Screen->KeyEvent ( DrawContext->KeyEvent (
DrawContext->Screen, DrawContext->Screen,
DrawContext, DrawContext,
DrawContext->GuiContext, DrawContext->GuiContext,
0, 0,
0, 0,
InputKey, InputKey,
Modifier Modifier
); );
// //
// If detected key press then disable menu timeout // If detected key press then disable menu timeout
// //
......
...@@ -88,7 +88,6 @@ struct GUI_OBJ_ { ...@@ -88,7 +88,6 @@ struct GUI_OBJ_ {
UINT32 Height; UINT32 Height;
GUI_OBJ_DRAW Draw; GUI_OBJ_DRAW Draw;
GUI_OBJ_PTR_EVENT PtrEvent; GUI_OBJ_PTR_EVENT PtrEvent;
GUI_OBJ_KEY_EVENT KeyEvent;
UINT32 NumChildren; UINT32 NumChildren;
GUI_OBJ_CHILD **Children; GUI_OBJ_CHILD **Children;
}; };
...@@ -128,6 +127,7 @@ struct GUI_DRAWING_CONTEXT_ { ...@@ -128,6 +127,7 @@ struct GUI_DRAWING_CONTEXT_ {
// Scene objects // Scene objects
// //
GUI_OBJ *Screen; GUI_OBJ *Screen;
GUI_OBJ_KEY_EVENT KeyEvent;
GUI_CURSOR_GET_IMAGE GetCursorImage; GUI_CURSOR_GET_IMAGE GetCursorImage;
GUI_EXIT_LOOP ExitLoop; GUI_EXIT_LOOP ExitLoop;
LIST_ENTRY Animations; LIST_ENTRY Animations;
...@@ -240,6 +240,7 @@ VOID ...@@ -240,6 +240,7 @@ VOID
GuiViewInitialize ( GuiViewInitialize (
OUT GUI_DRAWING_CONTEXT *DrawContext, OUT GUI_DRAWING_CONTEXT *DrawContext,
IN OUT GUI_OBJ *Screen, IN OUT GUI_OBJ *Screen,
IN GUI_OBJ_KEY_EVENT KeyEvent,
IN GUI_CURSOR_GET_IMAGE CursorDraw, IN GUI_CURSOR_GET_IMAGE CursorDraw,
IN GUI_EXIT_LOOP ExitLoop, IN GUI_EXIT_LOOP ExitLoop,
IN BOOT_PICKER_GUI_CONTEXT *GuiContext IN BOOT_PICKER_GUI_CONTEXT *GuiContext
......
...@@ -130,96 +130,6 @@ GuiClickableIsHit ( ...@@ -130,96 +130,6 @@ GuiClickableIsHit (
return Image->Buffer[(UINT32) OffsetY * Image->Width + (UINT32) OffsetX].Reserved > 0; return Image->Buffer[(UINT32) OffsetY * Image->Width + (UINT32) OffsetX].Reserved > 0;
} }
VOID
InternalBootPickerViewDraw (
IN OUT GUI_OBJ *This,
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN BOOT_PICKER_GUI_CONTEXT *Context,
IN INT64 BaseX,
IN INT64 BaseY,
IN UINT32 OffsetX,
IN UINT32 OffsetY,
IN UINT32 Width,
IN UINT32 Height
)
{
ASSERT (This != NULL);
ASSERT (DrawContext != NULL);
ASSERT (Context != NULL);
ASSERT (BaseX == 0);
ASSERT (BaseY == 0);
GuiDrawToBufferFill (
&Context->BackgroundColor.Pixel,
DrawContext,
OffsetX,
OffsetY,
Width,
Height
);
if (DrawContext->GuiContext->Background.Buffer != NULL) {
GuiDrawChildImage (
&DrawContext->GuiContext->Background,
0xFF,
DrawContext,
0,
0,
mBackgroundImageOffsetX,
mBackgroundImageOffsetY,
OffsetX,
OffsetY,
Width,
Height
);
}
GuiObjDrawDelegate (
This,
DrawContext,
Context,
0,
0,
OffsetX,
OffsetY,
Width,
Height
);
}
VOID
InternalBootPickerViewKeyEvent (
IN OUT GUI_OBJ *This,
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN BOOT_PICKER_GUI_CONTEXT *Context,
IN INT64 BaseX,
IN INT64 BaseY,
IN INTN Key,
IN BOOLEAN Modifier
)
{
ASSERT (This != NULL);
ASSERT (DrawContext != NULL);
ASSERT (BaseX == 0);
ASSERT (BaseY == 0);
//
// Consider moving between multiple panes with UP/DOWN and store the current
// view within the object - for now, hardcoding this is enough.
//
ASSERT (mBootPicker.Hdr.Obj.KeyEvent != NULL);
mBootPicker.Hdr.Obj.KeyEvent (
&mBootPicker.Hdr.Obj,
DrawContext,
Context,
mBootPickerContainer.Obj.OffsetX + mBootPicker.Hdr.Obj.OffsetX,
mBootPickerContainer.Obj.OffsetY + mBootPicker.Hdr.Obj.OffsetY,
Key,
Modifier
);
}
VOID VOID
InternalBootPickerSelectEntry ( InternalBootPickerSelectEntry (
IN OUT GUI_VOLUME_PICKER *This, IN OUT GUI_VOLUME_PICKER *This,
...@@ -1227,13 +1137,101 @@ InternalBootPickerRestartPtrEvent ( ...@@ -1227,13 +1137,101 @@ InternalBootPickerRestartPtrEvent (
return This; return This;
} }
VOID
InternalBootPickerViewDraw (
IN OUT GUI_OBJ *This,
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN BOOT_PICKER_GUI_CONTEXT *Context,
IN INT64 BaseX,
IN INT64 BaseY,
IN UINT32 OffsetX,
IN UINT32 OffsetY,
IN UINT32 Width,
IN UINT32 Height
)
{
ASSERT (This != NULL);
ASSERT (DrawContext != NULL);
ASSERT (Context != NULL);
ASSERT (BaseX == 0);
ASSERT (BaseY == 0);
GuiDrawToBufferFill (
&Context->BackgroundColor.Pixel,
DrawContext,
OffsetX,
OffsetY,
Width,
Height
);
if (DrawContext->GuiContext->Background.Buffer != NULL) {
GuiDrawChildImage (
&DrawContext->GuiContext->Background,
0xFF,
DrawContext,
0,
0,
mBackgroundImageOffsetX,
mBackgroundImageOffsetY,
OffsetX,
OffsetY,
Width,
Height
);
}
GuiObjDrawDelegate (
This,
DrawContext,
Context,
0,
0,
OffsetX,
OffsetY,
Width,
Height
);
}
VOID
InternalBootPickerViewKeyEvent (
IN OUT GUI_OBJ *This,
IN OUT GUI_DRAWING_CONTEXT *DrawContext,
IN BOOT_PICKER_GUI_CONTEXT *Context,
IN INT64 BaseX,
IN INT64 BaseY,
IN INTN Key,
IN BOOLEAN Modifier
)
{
ASSERT (This != NULL);
ASSERT (DrawContext != NULL);
ASSERT (BaseX == 0);
ASSERT (BaseY == 0);
//
// Consider moving between multiple panes with UP/DOWN and store the current
// view within the object - for now, hardcoding this is enough.
//
InternalBootPickerKeyEvent (
&mBootPicker.Hdr.Obj,
DrawContext,
Context,
mBootPickerContainer.Obj.OffsetX + mBootPicker.Hdr.Obj.OffsetX,
mBootPickerContainer.Obj.OffsetY + mBootPicker.Hdr.Obj.OffsetY,
Key,
Modifier
);
}
GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerSelector = { GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerSelector = {
{ {
{ {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerSelectorDraw, InternalBootPickerSelectorDraw,
InternalBootPickerSelectorPtrEvent, InternalBootPickerSelectorPtrEvent,
NULL,
0, 0,
NULL NULL
}, },
...@@ -1252,7 +1250,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerContainer = { ...@@ -1252,7 +1250,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerContainer = {
0, 0, 0, 0, 0, 0, 0, 0,
GuiObjDrawDelegate, GuiObjDrawDelegate,
GuiObjDelegatePtrEvent, GuiObjDelegatePtrEvent,
NULL,
ARRAY_SIZE (mBootPickerContainerChilds), ARRAY_SIZE (mBootPickerContainerChilds),
mBootPickerContainerChilds mBootPickerContainerChilds
}, },
...@@ -1265,7 +1262,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_VOLUME_PICKER mBootPicker = { ...@@ -1265,7 +1262,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_VOLUME_PICKER mBootPicker = {
0, 0, 0, 0, 0, 0, 0, 0,
GuiObjDrawDelegate, GuiObjDrawDelegate,
GuiObjDelegatePtrEvent, GuiObjDelegatePtrEvent,
InternalBootPickerKeyEvent,
0, 0,
NULL NULL
}, },
...@@ -1280,7 +1276,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerLeftScroll = { ...@@ -1280,7 +1276,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerLeftScroll = {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerLeftScrollDraw, InternalBootPickerLeftScrollDraw,
InternalBootPickerLeftScrollPtrEvent, InternalBootPickerLeftScrollPtrEvent,
NULL,
0, 0,
NULL NULL
}, },
...@@ -1295,7 +1290,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRightScroll = { ...@@ -1295,7 +1290,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRightScroll = {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerRightScrollDraw, InternalBootPickerRightScrollDraw,
InternalBootPickerRightScrollPtrEvent, InternalBootPickerRightScrollPtrEvent,
NULL,
0, 0,
NULL NULL
}, },
...@@ -1310,7 +1304,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRestart = { ...@@ -1310,7 +1304,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRestart = {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerSimpleButtonDraw, InternalBootPickerSimpleButtonDraw,
InternalBootPickerRestartPtrEvent, InternalBootPickerRestartPtrEvent,
NULL,
0, 0,
NULL NULL
}, },
...@@ -1325,7 +1318,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerShutDown = { ...@@ -1325,7 +1318,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerShutDown = {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerSimpleButtonDraw, InternalBootPickerSimpleButtonDraw,
InternalBootPickerShutDownPtrEvent, InternalBootPickerShutDownPtrEvent,
NULL,
0, 0,
NULL NULL
}, },
...@@ -1344,7 +1336,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerActionButtonsContainer = ...@@ -1344,7 +1336,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerActionButtonsContainer =
0, 0, 0, 0, 0, 0, 0, 0,
GuiObjDrawDelegate, GuiObjDrawDelegate,
GuiObjDelegatePtrEvent, GuiObjDelegatePtrEvent,
NULL,
ARRAY_SIZE (mBootPickerActionButtonsContainerChilds), ARRAY_SIZE (mBootPickerActionButtonsContainerChilds),
mBootPickerActionButtonsContainerChilds mBootPickerActionButtonsContainerChilds
}, },
...@@ -1362,7 +1353,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ mBootPickerView = { ...@@ -1362,7 +1353,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ mBootPickerView = {
0, 0, 0, 0, 0, 0, 0, 0,
InternalBootPickerViewDraw, InternalBootPickerViewDraw,
GuiObjDelegatePtrEvent, GuiObjDelegatePtrEvent,
InternalBootPickerViewKeyEvent,
ARRAY_SIZE (mBootPickerViewChilds), ARRAY_SIZE (mBootPickerViewChilds),
mBootPickerViewChilds mBootPickerViewChilds
}; };
...@@ -1786,6 +1776,7 @@ BootPickerViewInitialize ( ...@@ -1786,6 +1776,7 @@ BootPickerViewInitialize (
GuiViewInitialize ( GuiViewInitialize (
DrawContext, DrawContext,
&mBootPickerView, &mBootPickerView,
InternalBootPickerViewKeyEvent,
GetCursorImage, GetCursorImage,
InternalBootPickerExitLoop, InternalBootPickerExitLoop,
GuiContext GuiContext
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册