App won't get focus with latest juce


#1

I just upgraded to the latest juce and switched to gcc 4 and now my application that used to work fine, when I run it from XCode, it comes up behind XCode and refuses to take keyboard focus. It also locks up when either a file dialog box or alert window opens. Has anybody else seen anything like this?

If i just run my application, it gets the focus just fine.


#2

Odd - I’ve not had anything like that happen. Could be a framework linking mis-match, perhaps, if you’ve changed compilers and/or the OSX version you’re targeting?


#3

Make sure your actual bundle name matches what’s specified in the Info.plist file inside your bundle.


#4

Ahh, that was it. I have two targets App PPC and APP Intel, and then after they are both built, I have a script that merges them into App which is the universal binary name. I had the Info.plist set up to be for App. I guess I’ll need to make my script edit the Info.plist.

Also, the AlertWindow’s aren’t locking up, they just aren’t painting. I can click on their buttons if I can guess where they are. And it’s only the dialog box that pops up when users are quitting my app. Is it a bad idea to all an AlertWindow inside a timer callback?


#5

It’s fine to call an alertwindow in a timer callback. Maybe you’re doing it after the message queue has had the quit message posted? That’d stop events from happening.


#6

It seems that the AlertWindow doesn’t paint if it is called from a timer.

I took the juce demo app, added a button listener to one of the buttons. From the button listener I call startTimer(10), in the timer callback I try and open an AlertWindow and viola – Nothing!

This is a mac only problem. Here is a screenshot.


#7

agh! this is a subtle thing with recursive timers - luckily it’s a simple tweak to fix it - in juce_Timer.cpp, add an extra line at line 225:

[code]const ScopedUnlock ul (lock)
callbackNeeded = false;

JUCE_TRY
{[/code]

Because the mac uses a timer to do the repainting, it was getting stuck when it tried to run a timer inside a message loop that was itself running inside a timer.


#8

Sweet, that fixed it. Thanks.


#9