mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
Fix disconnectscreen grabbing cursor for a frame when shown (Thanks Igor1_)
e.g fixes if you connecting to server timed out, the cursor was always re-centred
This commit is contained in:
parent
4f80b48fcc
commit
2a14d1389e
3 changed files with 9 additions and 8 deletions
|
@ -145,10 +145,6 @@ void Gui_RefreshAll(void) {
|
|||
OnResize(NULL);
|
||||
}
|
||||
|
||||
void Gui_RemoveAll(void) {
|
||||
while (Gui.ScreensCount) Gui_Remove(Gui_Screens[0]);
|
||||
}
|
||||
|
||||
void Gui_Refresh(struct Screen* s) {
|
||||
s->VTABLE->ContextLost(s);
|
||||
s->VTABLE->ContextRecreated(s);
|
||||
|
@ -572,7 +568,8 @@ static void OnReset(void) {
|
|||
}
|
||||
|
||||
static void OnFree(void) {
|
||||
Gui_RemoveAll();
|
||||
while (Gui.ScreensCount) Gui_Remove(Gui_Screens[0]);
|
||||
|
||||
OnContextLost(NULL);
|
||||
OnReset();
|
||||
}
|
||||
|
|
|
@ -225,7 +225,6 @@ void Gui_ShowPauseMenu(void);
|
|||
|
||||
void Gui_LayoutAll(void);
|
||||
void Gui_RefreshAll(void);
|
||||
void Gui_RemoveAll(void);
|
||||
void Gui_Refresh(struct Screen* s);
|
||||
void Gui_RenderGui(double delta);
|
||||
|
||||
|
|
|
@ -1949,6 +1949,7 @@ void DisconnectScreen_Show(const cc_string* title, const cc_string* message) {
|
|||
static const cc_string ban = String_FromConst("Banned ");
|
||||
cc_string why; char whyBuffer[STRING_SIZE];
|
||||
struct DisconnectScreen* s = &DisconnectScreen;
|
||||
int i;
|
||||
|
||||
s->grabsInput = true;
|
||||
s->blocksWorld = true;
|
||||
|
@ -1964,9 +1965,13 @@ void DisconnectScreen_Show(const cc_string* title, const cc_string* message) {
|
|||
s->canReconnect = !(String_CaselessStarts(&why, &kick) || String_CaselessStarts(&why, &ban));
|
||||
s->VTABLE = &DisconnectScreen_VTABLE;
|
||||
|
||||
/* Remove all screens instead of just drawing over them to reduce GPU usage */
|
||||
Gui_RemoveAll();
|
||||
Gui_Add((struct Screen*)s, GUI_PRIORITY_DISCONNECT);
|
||||
/* Remove other screens instead of just drawing over them to reduce GPU usage */
|
||||
for (i = Gui.ScreensCount - 1; i >= 0; i--)
|
||||
{
|
||||
if (Gui_Screens[i] == (struct Screen*)s) continue;
|
||||
Gui_Remove(Gui_Screens[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue