baseview
baseview copied to clipboard
Add a `set_focus(bool)` interface for getting and losing keyboard focus
This is a compilation of discussions from the discord chat from @ilmai et al.
Changes required in baseview to capture focus, pass it to client gui libraries (ie Vizia), then return focus to host if client requests it to bubble up.
Per @geom3trik in plugin-gui:
“ Vizia has a
cx.focus()
method which is called when a view wants keyboard focus. Presumably this function could then call the appropriate baseview function to capture the input focus, and then when the focus is released back to the window baseview could release it to the host?”
Ilmai explained:
So if you pass a mouse event to vizia and vizia asks for text input focus based on that, you shouldn't also be passing those keyboard events to the host because otherwise pressing the spacebar for example would play/pause the timeline in addition to entering a whitespace in a textbox.