diff --git a/Platform/OpenCanopy/OpenCanopy.c b/Platform/OpenCanopy/OpenCanopy.c index f5831e45040b946829c371ddc3f735aa58efd397..6e1ece4ea556977fa7cb41e40971f0a0c3224888 100644 --- a/Platform/OpenCanopy/OpenCanopy.c +++ b/Platform/OpenCanopy/OpenCanopy.c @@ -877,6 +877,7 @@ VOID GuiViewInitialize ( OUT GUI_DRAWING_CONTEXT *DrawContext, IN OUT GUI_OBJ *Screen, + IN GUI_OBJ_KEY_EVENT KeyEvent, IN GUI_CURSOR_GET_IMAGE GetCursorImage, IN GUI_EXIT_LOOP ExitLoop, IN BOOT_PICKER_GUI_CONTEXT *GuiContext @@ -886,6 +887,7 @@ GuiViewInitialize ( ASSERT (DrawContext != NULL); ASSERT (Screen != NULL); + ASSERT (KeyEvent != NULL); ASSERT (GetCursorImage != NULL); ASSERT (ExitLoop != NULL); @@ -896,6 +898,7 @@ GuiViewInitialize ( Screen->Height = OutputInfo->VerticalResolution; DrawContext->Screen = Screen; + DrawContext->KeyEvent = KeyEvent; DrawContext->GetCursorImage = GetCursorImage; DrawContext->ExitLoop = ExitLoop; DrawContext->GuiContext = GuiContext; @@ -1086,16 +1089,16 @@ GuiDrawLoop ( // Status = GuiKeyRead (mKeyContext, &InputKey, &Modifier); if (!EFI_ERROR (Status)) { - ASSERT (DrawContext->Screen->KeyEvent != NULL); - DrawContext->Screen->KeyEvent ( - DrawContext->Screen, - DrawContext, - DrawContext->GuiContext, - 0, - 0, - InputKey, - Modifier - ); + ASSERT (DrawContext->KeyEvent != NULL); + DrawContext->KeyEvent ( + DrawContext->Screen, + DrawContext, + DrawContext->GuiContext, + 0, + 0, + InputKey, + Modifier + ); // // If detected key press then disable menu timeout // diff --git a/Platform/OpenCanopy/OpenCanopy.h b/Platform/OpenCanopy/OpenCanopy.h index e2ae132f281d91270667a4ac5c939f4a1a673f3e..183eaa1aa92adaa0f9eee114f953c094dba71f19 100644 --- a/Platform/OpenCanopy/OpenCanopy.h +++ b/Platform/OpenCanopy/OpenCanopy.h @@ -88,7 +88,6 @@ struct GUI_OBJ_ { UINT32 Height; GUI_OBJ_DRAW Draw; GUI_OBJ_PTR_EVENT PtrEvent; - GUI_OBJ_KEY_EVENT KeyEvent; UINT32 NumChildren; GUI_OBJ_CHILD **Children; }; @@ -128,6 +127,7 @@ struct GUI_DRAWING_CONTEXT_ { // Scene objects // GUI_OBJ *Screen; + GUI_OBJ_KEY_EVENT KeyEvent; GUI_CURSOR_GET_IMAGE GetCursorImage; GUI_EXIT_LOOP ExitLoop; LIST_ENTRY Animations; @@ -240,6 +240,7 @@ VOID GuiViewInitialize ( OUT GUI_DRAWING_CONTEXT *DrawContext, IN OUT GUI_OBJ *Screen, + IN GUI_OBJ_KEY_EVENT KeyEvent, IN GUI_CURSOR_GET_IMAGE CursorDraw, IN GUI_EXIT_LOOP ExitLoop, IN BOOT_PICKER_GUI_CONTEXT *GuiContext diff --git a/Platform/OpenCanopy/Views/BootPicker.c b/Platform/OpenCanopy/Views/BootPicker.c index f765ad5a38ad22789853fcf91149dcb48871a185..627d22881584cf69cdcb7db1d6c0eb924fc3f5e1 100644 --- a/Platform/OpenCanopy/Views/BootPicker.c +++ b/Platform/OpenCanopy/Views/BootPicker.c @@ -130,96 +130,6 @@ GuiClickableIsHit ( 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 InternalBootPickerSelectEntry ( IN OUT GUI_VOLUME_PICKER *This, @@ -1227,13 +1137,101 @@ InternalBootPickerRestartPtrEvent ( 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 = { { { 0, 0, 0, 0, InternalBootPickerSelectorDraw, InternalBootPickerSelectorPtrEvent, - NULL, 0, NULL }, @@ -1252,7 +1250,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerContainer = { 0, 0, 0, 0, GuiObjDrawDelegate, GuiObjDelegatePtrEvent, - NULL, ARRAY_SIZE (mBootPickerContainerChilds), mBootPickerContainerChilds }, @@ -1265,7 +1262,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_VOLUME_PICKER mBootPicker = { 0, 0, 0, 0, GuiObjDrawDelegate, GuiObjDelegatePtrEvent, - InternalBootPickerKeyEvent, 0, NULL }, @@ -1280,7 +1276,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerLeftScroll = { 0, 0, 0, 0, InternalBootPickerLeftScrollDraw, InternalBootPickerLeftScrollPtrEvent, - NULL, 0, NULL }, @@ -1295,7 +1290,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRightScroll = { 0, 0, 0, 0, InternalBootPickerRightScrollDraw, InternalBootPickerRightScrollPtrEvent, - NULL, 0, NULL }, @@ -1310,7 +1304,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerRestart = { 0, 0, 0, 0, InternalBootPickerSimpleButtonDraw, InternalBootPickerRestartPtrEvent, - NULL, 0, NULL }, @@ -1325,7 +1318,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CLICKABLE mBootPickerShutDown = { 0, 0, 0, 0, InternalBootPickerSimpleButtonDraw, InternalBootPickerShutDownPtrEvent, - NULL, 0, NULL }, @@ -1344,7 +1336,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ_CHILD mBootPickerActionButtonsContainer = 0, 0, 0, 0, GuiObjDrawDelegate, GuiObjDelegatePtrEvent, - NULL, ARRAY_SIZE (mBootPickerActionButtonsContainerChilds), mBootPickerActionButtonsContainerChilds }, @@ -1362,7 +1353,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED GUI_OBJ mBootPickerView = { 0, 0, 0, 0, InternalBootPickerViewDraw, GuiObjDelegatePtrEvent, - InternalBootPickerViewKeyEvent, ARRAY_SIZE (mBootPickerViewChilds), mBootPickerViewChilds }; @@ -1786,6 +1776,7 @@ BootPickerViewInitialize ( GuiViewInitialize ( DrawContext, &mBootPickerView, + InternalBootPickerViewKeyEvent, GetCursorImage, InternalBootPickerExitLoop, GuiContext