mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 11:29:24 +01:00
Don't register already registered listeners
This commit is contained in:
parent
46757f1f1e
commit
e2b34f1ee9
@ -225,11 +225,15 @@ void VirtualKeyboard::registerListener(KeyboardListener *kl)
|
|||||||
int n_listeners = sizeof(this->listeners) / sizeof(*this->listeners);
|
int n_listeners = sizeof(this->listeners) / sizeof(*this->listeners);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Don't register already registered listeners */
|
||||||
|
for (i = 0; i < n_listeners; i++)
|
||||||
|
if (this->listeners[i] == kl)
|
||||||
|
return;
|
||||||
|
/* Find a free spot */
|
||||||
for (i = 0; i < n_listeners; i++)
|
for (i = 0; i < n_listeners; i++)
|
||||||
{
|
|
||||||
if (!this->listeners[i])
|
if (!this->listeners[i])
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
panic_if(i == n_listeners,
|
panic_if(i == n_listeners,
|
||||||
"No free listeners!\n");
|
"No free listeners!\n");
|
||||||
this->listeners[i] = kl;
|
this->listeners[i] = kl;
|
||||||
@ -334,9 +338,9 @@ void VirtualKeyboard::flushListeners()
|
|||||||
|
|
||||||
void VirtualKeyboard::deactivate()
|
void VirtualKeyboard::deactivate()
|
||||||
{
|
{
|
||||||
this->is_active = false;
|
this->is_active = false;
|
||||||
this->flushListeners();
|
this->flushListeners();
|
||||||
Gui::gui->popView();
|
Gui::gui->popView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::draw(SDL_Surface *where)
|
void VirtualKeyboard::draw(SDL_Surface *where)
|
||||||
|
Loading…
Reference in New Issue
Block a user