egui-baseview
egui-baseview copied to clipboard
focusing issue in nih-plug / Windows 10
In Windows 10, nih-plug standalone version egui does not get keyboard input, because the parented windows is never focused. always calling .focus() on the window fixes this but its not a nice solution.
this was briefly talked about in the rust audio discord, basically keyboard focus with baseview is kind of a mess on windows, and ableton is partially to blame. i've tried fixing this but haven't had much luck
@murl-digital your idea in past discord conversation + a post from an @Beepster fixed this for me. I have just maintained a fork of egui_baseview to keep this working in my plugins, but here is all I changed in egui_baseview to "make this work" although it doesn't feel like the right way :)
in src/window.rs at bottom of fn on_frame()
if !full_output.platform_output.events.is_empty() ||
full_output.platform_output.ime.is_some() {
#[cfg(target_os = "windows")]
window.focus();
}
That is kind of hacky, but if you think this is a good temporary fix I could merge it upstream.
i recall someone somewhere saying there were problems or it didn't work exactly how it was expected to, but i reckon it's good enough
i think it may be smart to put it behind a feature gate in case it has unintended consequences
Alright, I added a workaround in 6645c14
This same issue also exists on macOS, and the same fix works for it. When writing a plugin with NIH-Plug and loading it in Reaper, the plugin doesn't get any keyboard input. If I modify the above workaround to also call window.focus() on macOS, it works correctly. Could the workaround be updated to apply on both platforms?
I have decided to move my repositories to Codeberg. I have cloned the issues there.