Unresponsive UI on first load (mac)

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I have an issue where our PT/AAX Cocoa UI is unresponsive when loaded, but click another window/application then back to the host window, and it works.

Before folk run screaming NDA, this may not be an Avid/Digi problem. Their host passes me a pointer to an NSView, and I work with that - this is so utterly obvious that no amount of NDA can get around it. I won't be posting any of their SDK/internals.

So..

We have a synth object which is wrapped for VST, AU, standalone, and AAX. (There's RTAS as well, but that uses Carbon). When any of them want a UI, the wrapper gets the pointer and it's marshalled to the UI generation code with a objwrapper->OpenEditor((void*)mHost_NSView);

My OpenEditor code:

Code: Select all

bool VSTEditor::OpenEditor ( void* inPtr /* system window */)
{
	AEffEditor::open(inPtr); //Yes, yes, I subclassed VST.. it's just easier!

  
  gfl::GFLSize theSize ( 640, 480 );    
  gfl::gPoint origin;

  gfl::Rectangle theRect ( origin, theSize );
  
/*
>>>> Code to read UI details via LUA removed
*/  
  theSize = mMainView->GetRect().size;
  mRect.left = 0;
  mRect.top = 0;
  mRect.bottom = theSize.height;
  mRect.right = theSize.width;
  
#ifdef MAC_Code
  @autoreleasepool {
	try{
		mGFRootView = new gfl::MacCocoaView ( mMainView->GetRect(), MacCocoaView::AAX );

		if([(id)inPtr isKindOfClass:[NSWindow class]]){
			NSWindow* theWindow = static_cast<NSWindow*>(inPtr);
			NSView* contentView = theWindow.contentView;
			mGFRootView->AddTo ( contentView );
		}else if([(id)inPtr isKindOfClass:[NSView class]]){
			NSView* contentView = static_cast<NSView*>(inPtr);
			mGFRootView->AddTo ( contentView );
		}else{
#ifndef __LP64__
        //32bit Cocoa/Carbon code removed, not relevant here
#endif
		}

		mMainView->SetParent(mGFRootView);
		mGFRootView->AddView(mMainView);
	}catch ( gfl::Exception e )	{
		DBG("Caught exception loading ui...\n");
		return false;
	}
	}
#endif //MAC_Code
  return true;
}
This works fine with VST, AU & standalone.

I have found that overriding -acceptsFirstMouse to return YES on my UI window class means I get the UI working first time; but if I click on the desktop then back to the UI it doesn't respond unless I click the hosting UI container window to give it focus, then all works again.

Does this make sense to anyone? Has anyone encountered something like this before? What should I be looking for? I'm guessing it's something fairly rudimentary that my knowledge of OSX is lacking..!

Thanks
DSP
Image

Post

On the Mac side, this issue is usually do to responder status and/or keyWindow for NSWindows.

Sorry about the slight shotgun nature here because I'm not familiar with AAX implementation, but I would try these:
- send a "makeKeyAndOrderFront:" message to your NSWindow instance when it loads.
- send a "makeFirstResponder:nil" message when your window gets focus.
- override "acceptsFirstResponder" to return YES.

Post

I will try those! Thank you..

I'll post back when tried (might be a day or two, looking at the diary..)
Image

Post

well, been a while.. solved it some time back, but not returned to update!

acceptsFirstResponder was the thing that did it. Though, I confess I had quite a bit of head scratching for a few days on why it still wasn't working, until it was pointed out to me that I had used 'acceptFirstResponder' - which explained why the 'overridden' function was never called..

So, thx LemonLime :-)

DSP
Image

Post Reply

Return to “DSP and Plugin Development”