Fix mouse getting centred when clicking on classic controls menu

This commit is contained in:
UnknownShadow200 2024-09-08 22:11:15 +10:00
parent c7ad4a580b
commit 8dc2b45827
2 changed files with 5 additions and 7 deletions

View File

@ -224,9 +224,9 @@ static int IndexOfScreen(struct Screen* s) {
return -1;
}
void Gui_RemoveCore(struct Screen* s) {
static cc_bool Gui_RemoveCore(struct Screen* s) {
int i = IndexOfScreen(s);
if (i == -1) return;
if (i == -1) return false;
for (; i < Gui.ScreensCount - 1; i++)
{
@ -237,6 +237,7 @@ void Gui_RemoveCore(struct Screen* s) {
s->VTABLE->ContextLost(s);
s->VTABLE->Free(s);
return true;
}
CC_NOINLINE static void Gui_OnScreensChanged(void) {
@ -245,8 +246,8 @@ CC_NOINLINE static void Gui_OnScreensChanged(void) {
}
void Gui_Remove(struct Screen* s) {
Gui_RemoveCore(s);
Gui_OnScreensChanged();
cc_bool removed = Gui_RemoveCore(s);
if (removed) Gui_OnScreensChanged();
}
void Gui_Add(struct Screen* s, int priority) {

View File

@ -263,9 +263,6 @@ void Gui_ShowDefault(void);
void Gui_SetTouchUI(cc_bool enabled);
#endif
/* (internal) Removes the screen from the screens list. */
/* NOTE: This does NOT perform the usual 'screens changed' behaviour. */
void Gui_RemoveCore(struct Screen* s);
/* Removes the screen from the screens list. */
CC_API void Gui_Remove(struct Screen* screen);
/* Inserts a screen into the screen lists with the given priority. */