BUG: M1/Apple Silicon: Keyboard focus lost permanently in Logic when plugin is resized

Please update to Sonoma 14.2 for which the issue has been moved to “Software Changed”.

4 Likes

Just for my understanding: I have a very similar as it seems right now. I open my plugin editor and sometimes (I couldn’t find a pattern yet) the key commands I bound are not passed to my plugin editor but to logic. Clicking into the UI doesn’t help. Interacting with the UI (e.g. clicking on a button) doesn’t help.

@Rincewind That sounds like the same symptoms – in your case, is it only after resizing the UI? Or is it all the time? (the case we found was that this state only started after resizing the UI, and then it was “stuck” this way)

For me it is not related to resize. I open the editor and cannot get any keyevents passed into it.
But I think this is a Logic bug that has been fixed by now. I have to juggle between a few versions of Logic for unrelated Logic Bugs.

It was an issue in macOS, not Logic Pro. And the keyboard focus issue has been fixed with macOS 14.2, please update.

This issue seems to persist in macOS14.3. Can anyone else confirm if this is the case for them as well?

2 Likes

I’m on macOS 15.1 here, and it still happens regularly inside the latest version of Logic. My plugin loses keyboard focus, and is never able to get keyboard focus back again.

Since I’m developing an audio patching plugin, not being able to type anything or use keyboard shortcuts renders the whole plugin unusable :frowning:

Is anyone aware of a code snippet that would allow the plug-in to detect if it’s in the status of “permanently lost focus”?

I suddenly seem to be triggering very similar behaviour on macOS 15.6.1 and latest Logic 11.2.2— keyboard focus is lost, in Logic AU only.

Perhaps it’s just a coincidence, but this behavior only started happening when I made my plugin scalable a couple weeks ago by putting all the UI in a wrapper and doing something like this:

void PluginEditor::resized()
{
    float scale_factor = (float) getWidth() / Config::defaultWidth;
    ui.setBounds (0, 0, Config::defaultWidth, Config::defaultHeight);

    auto transform = juce::AffineTransform::scale (scale_factor);
    ui.setTransform (transform);
    ui.setTopLeftPosition (0, 0);

Edit: I believe it was a coincidence, see my next reply.

I’ve had user complains coming in lately that the plugin cannot be resized in Logic anymore. I suspect it’s the same issue.

I assume there are no workarounds though? We just have to wait for apple on this?

I also do something similar to what @sudara is doing.

I figured out the trigger for my case and it turns out not to be related to resizing, just some other work that happened around the same time.

One of my components calls toFront (true) (which in turn calls grabKeyboardFocus()).

For some reason I haven’t figured out yet, in this particular case, it triggers permanent focus loss in Logic AU (where plugins are hosted in their own process/window). Removing or replacing with toFront (false) fixes. Calling grabKeyboardFocus() manually in that same context causes it to happen again.

When playing around with `grabKeyboardFocus`in a new plugin, I can’t yet reproduce the focus loss — so it probably is something specific to circumstances in my app, such as when it’s called, or the visibility of components. For example, maybe the peer doesn’t exist when it is first called and that freaks out logic, somehow.