diff --git a/src/Gui.c b/src/Gui.c index 79a0a15cf..02e77f8c7 100644 --- a/src/Gui.c +++ b/src/Gui.c @@ -70,6 +70,11 @@ bool Gui_Contains(int recX, int recY, int width, int height, int x, int y) { return x >= recX && y >= recY && x < (recX + width) && y < (recY + height); } +void Gui_ShowDefault(void) { + StatusScreen_Show(); + HUDScreen_Show(); +} + static void Gui_ContextLost(void* obj) { struct Screen* s; int i; @@ -120,9 +125,7 @@ static void Gui_Init(void) { Event_RegisterVoid(&GfxEvents.ContextLost, NULL, Gui_ContextLost); Event_RegisterVoid(&GfxEvents.ContextRecreated, NULL, Gui_ContextRecreated); Gui_LoadOptions(); - - StatusScreen_Show(); - HUDScreen_Show(); + Gui_ShowDefault(); } static void Gui_Reset(void) { diff --git a/src/Gui.h b/src/Gui.h index 2e650dd80..f72fcb9fe 100644 --- a/src/Gui.h +++ b/src/Gui.h @@ -115,6 +115,8 @@ extern int Gui_ScreensCount; int Gui_CalcPos(uint8_t anchor, int offset, int size, int axisLen); /* Returns whether the given rectangle contains the given point. */ bool Gui_Contains(int recX, int recY, int width, int height, int x, int y); +/* Shows HUD and Status screens. */ +void Gui_ShowDefault(void); /* Returns index of the given screen in the screens list, -1 if not */ int Gui_Index(struct Screen* screen); diff --git a/src/Menus.c b/src/Menus.c index 7d7a1d935..bca53f0e2 100644 --- a/src/Menus.c +++ b/src/Menus.c @@ -2885,12 +2885,9 @@ static bool TexIdsOverlay_KeyDown(void* screen, Key key) { return false; } -static bool TexIdsOverlay_KeyPress(void* screen, char keyChar) { return false; } -static bool TexIdsOverlay_KeyUp(void* screen, Key key) { return false; } - static const struct ScreenVTABLE TexIdsOverlay_VTABLE = { TexIdsOverlay_Init, TexIdsOverlay_Render, MenuScreen_Free, - TexIdsOverlay_KeyDown, TexIdsOverlay_KeyUp, TexIdsOverlay_KeyPress, + TexIdsOverlay_KeyDown, Screen_FKey, Screen_FKeyPress, Menu_MouseDown, Screen_TMouse, Menu_MouseMove, MenuScreen_MouseScroll, Menu_OnResize, TexIdsOverlay_ContextLost, TexIdsOverlay_ContextRecreated }; diff --git a/src/Screens.c b/src/Screens.c index 39a4b2dd0..7982fa12b 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -1363,7 +1363,12 @@ static bool DisconnectScreen_MouseDown(void* screen, int x, int y, MouseButton b struct ButtonWidget* w = &s->reconnect; if (btn != MOUSE_LEFT) return true; - if (!w->disabled && Widget_Contains(w, x, y)) Server.BeginConnect(); + + if (!w->disabled && Widget_Contains(w, x, y)) { + Gui_Remove((struct Screen*)s); + Gui_ShowDefault(); + Server.BeginConnect(); + } return true; }