You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a set_focus(bool) interface for getting and losing keyboard focus #152
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.
“ 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.
That's not enough on Windows as you need a separate message window that capture the input since Live and some other hosts don't let keyboard events through to the plugin. And on top of that, you need a message hook to catch modifier key presses since you want to always capture those and not just when the window has input focus.
So, I am giving this a go again. I am reading the baseview code and follow it ok but we need more clarity on what needs to be implemented. Focusing on Mac for now but if we get the interface down it should not be too difficult to implement for other platforms (famous last words 😁).
I had a look at @ilmai 's code from the link above and I can not see where the input_focus boolean interacts with NSWindow. From a discord conversation @ilmai has said:
you don't really need to set input focus yourself like that, but the GUI crate (vizia in this case) asking for input focus should dictate if keyboard events are passed to the parent window or not
That sounds to me as if baseview is not handling the focus but simply storing the boolean and then it is a matter of calling the focus method from Vizia (or other GUI) which I assume already has access to the NSWindow.
Closing as this has been implemented in #202, at least the grabbing focus part.
Releasing focus may be a bit more complex, and I'm not sure releasing focus from the plugin window entirerly is a much needed feature. If it is for you, please tell me here and I'll open a new dedicated issue for focus release.
Activity
Engid commentedon Oct 21, 2023
Per ilmai:
UPDATES 11/12/2023:
NOTES:
set_input_focus()defined here in a permalink urlALSO NOTE: further comment from ilmai:
dathinaios commentedon Feb 26, 2024
(Dionysis from the Rust Audio discord here 🙂👋)
So, I am giving this a go again. I am reading the
baseviewcode and follow it ok but we need more clarity on what needs to be implemented. Focusing on Mac for now but if we get the interface down it should not be too difficult to implement for other platforms (famous last words 😁).I had a look at @ilmai 's code from the link above and I can not see where the
input_focusboolean interacts withNSWindow. From a discord conversation @ilmai has said:That sounds to me as if
baseviewis not handling the focus but simply storing the boolean and then it is a matter of calling the focus method from Vizia (or other GUI) which I assume already has access to theNSWindow.Is this correct? 🤔
prokopyl commentedon Oct 2, 2026
Closing as this has been implemented in #202, at least the grabbing focus part.
Releasing focus may be a bit more complex, and I'm not sure releasing focus from the plugin window entirerly is a much needed feature. If it is for you, please tell me here and I'll open a new dedicated issue for focus release.