Process/Desktop callback question

Hello,

Is there a mean to know where the application status change from background to foreground ?

Currently i’m managing that through “activeWindowStatusChanged()”.
But it dosnt work if i click on the app icon in the dock.

e.g., if i go to another app, my windows disappeared, i d like to make them re-appear when clicking on the JUCE_APPLICATION icon.

any help will be welcome,

AsR

Don’t think I’ve got anything for that, though I guess you could poll Process::isForegroundProcess() to see when it changes…

Not exactly, Process::isForegroundProcess() is very useful,

but it tells you THAT it has changed,

not when…
This is not a callback, if you know what I mean.

My problem is that I should know when my process get back or forground.
And I should not test it in my window methods or callback, cause windows must absolutly be changed by another process-listener…

If i can dare, i’d suggest you a processListener class,
unless there is means in Application managers to manage it…

Thank you.

well, you could make one yourself, by just following jules advice :wink:

he suggested polling that function; i.e. have some worker thread just keep check, and notify via a callback when it detects some change.

the only other way of doing it would be if there were a specific OS message for the job (one which jules has not covered); depending on how relevant it is to the purpose of ‘activeWindowStatusChanged()’ [never used it myself] it might be worth causing such a call from that too. However, I’ve no idea of the ramifications of such a thing (could result in duplicate calls if not careful), or even if such a message exists.

Regardless, as described, you could set your own thing up quite easily.

[quote]he suggested polling that function[/quote]Okay, sorry i did not get the polling idea, sorry for having repeated then.
Thank you

Yes but it involves a timer, or an OS message. A timer is costful, i hope not to use one…

[quote]the only other way of doing it would be if there were a specific OS message for the job (one which jules has not covered);
[/quote]
…thus I hope so.
I’m on Mac OS 10.5

Exactly, above all, the reason is nothing is called back when you only click on the app icon, to get back the application to the 1st plan.
Moreover, it may have issue of double calls, but this is easily manageable. Many another lil issues…

Definetly, the issue with the app icon deprecates the “activeWindowChanged” method.
Cause when you click the app icon, this method is not called.

Thank you.