Open MattKuebrich opened 9 months ago
this is sorta expected behaviour on macOS in my experience. the first click gives focus, 2nd click begins interaction. it is like this in many other software under macOS, having a click automatically trigger some UI elements is the exception rather than the rule I would say (on other OSes it is not the case of course)
in any case, changing this behaviour would mean exposing the pugl side that controls this. the view (or window not sure now) contains a property that states wherever the first click only activates focus or does interaction straight away. we would need to make that optional and then expose it on dpf side as well.
PS: compare this to how web browsers work. you cannot press a button on a browser when it is not on focus first, I quite rather like this approach and personally prefer it to be this way
Thanks so much for the quick response! I do see what you're saying and in the macOS browser - it indeed works that way. But in the realm of audio plugins in the DAW, it's definitely not the expected behavior. I can't find a single non-DPF-based plugin that behaves like that (having to click for focus first).
For me as a user, it just "feels" wrong (because all the other plugins work differently) and is a barrier to quickly tweaking values. I'd love if there was an option to enable interaction straight away, if it's possible without too much headache.
You can try to tweak the code in dpf/dgl/src/pugl-upstream/src/mac.m
and see if you find something that works for this.
I am not that knowledgeable about Cocoa related APIs to know the exact stop that needs to be tweaked, but the macOS integration stuff is there on that file to change.
Thanks, I'll give it a shot and report back if I find something that works!
No luck yet. I tried adding this to mac.m
, which which looks to be what I want, but unfortunately it didn't work.
- (BOOL)acceptsFirstMouse:(NSEvent*)event {
return YES;
}
I found this GitHub comment about a similar issue and they point to JUCE using the same acceptsFirstMouse
code. Indeed JUCE-generated plugins work on first-click, as I'm hoping to do with DPF. Would I need to update any other files for this to work?
I got it working! I added the acceptsFirstMouse
code toPuglOpenGLView
in dpf/dgl/src/pugl-upstream/src/mac_gl.m
. Didn't change anything in mac.m
.
@implementation PuglOpenGLView {
@public
PuglView* puglview;
}
// activate the view with one click
- (BOOL)acceptsFirstMouse:(NSEvent *)event {
return YES;
}
I do think you should consider adding this functionality, either by default or with an option, as it really is the expected way plugins work in macOS.
Curiously, there's similar code already in this older version of pugl(?) that was in DPF: https://github.com/falkTX/DPF/blob/d49366db694fb9097210ba9665449f6a67025285/dgl/src/pugl/pugl_osx.m#L132
I'd say the behavior should be consistent with other plugins and other OSes, so the direct interaction would make most sense.
Especially in a context where you are moving between different screens regularly (ie. a DAW project) having to do this additional click every time, just for any DPF plugins specifically, would get pretty annoying.
Just because this is not the default for other programs or web-browsers does not mean it should be the default in this context.
[ps; on Linux/X11 I can interact with a browser immediately, rather than having to "click-to-focus" first. So I get this is a very specific macOS idiom, that other audio developers are explicitly circumventing as well]
I’m having an issue when using DPF-based plugins (VST3, CLAP, etc) that use GUIs. If the plugin UI window doesn’t already have focus (the menubar is greyed out), dragging on a knob in the UI (for example) won’t do anything. You have to click again for it start responding to the mouse movements, then it works fine. I hope that makes sense. I added a gif to help illustrate this... you can see I'm mousing down on the knob at the start and it's not moving.
This happens with all the DPF plugins I've tried including the DPF-Plugins, the Wasted Audio plugins (as shown) and my own plugin experiments using ImGui. Other non-DPF plugins don’t exhibit this behavior. I’m on an M1 Mac with Bitwig and Ableton Live. Any ideas on how to fix this? Thank you!