Too many objects get input focus with Monarch?

Hello all,

I’m having a problem with input focus using Monarch with a factory-created screen that has more than 16 game objects. Only 1 game object actually needs input focus. I may be doing something wrong, but I’m not sure what.

My screen has 21 game objects: 5 instances of a 4-object collection, and one object with a GUI component. Only the GUI needs input focus. But I’m loading the screen with Monarch using a collection factory, and Monarch posts an acquire_input_focus message to every game object created by the factory (monarch/monarch.lua:350). With 21 objects, this means the last 5 objects trigger the message WARNING:GAMEOBJECT: Input focus could not be acquired since the buffer is full (16). Depending on timing, the GUI component that actually needs input focus may be in the last 5 objects and input fails.

Reading the code, it seems like the idea is for Monarch to manage input focus for every factory-created object so that enabling, disabling, and transitions handle focus properly without the screen author having to include any additional code. Proxies don’t have the issue because the whole screen’s focus can be managed by messaging the proxy.

Is the intention that factory-created screens should have few game objects? Perhaps if a screen has more than 10-ish game objects, I should switch to using proxies? Or am I missing something?

If I’m not missing something, here’s an idea: maybe Monarch should have a monarch.manage_input_focus(screen_id, [url]) API that registers game object URLs for which Monarch should acquire and release input around transitions. That would enable specific input handling for factory-based screens with only a little code on the part of the screen author. I could probably implement this as a PR next week, if desired. Any registered URLs would disable the all-game-objects input behavior for the given screen, but only for that screen. That would make the API addition backward compatible with current uses. @britzl, does that sound like a desirable change?

Thanks for any insight,

Micah

Please post an issue on GitHub. I will take a look tomorrow