Xojo Window not updating when it doesn't have focus

My application receives data over a socket or serial port, and updates a window based on the data received.
The application uses a thread/timer to service the socket periodically (on the order of milliseconds)
It works perfectly when the window has focus. But if I change focus to another window on my desktop (OSX), the updates cease. So I assume the timer, thread, or screen writes are not occurring.

I have another app that I wrote in Unity/C#, and it keeps updating when the window doesn’t have focus. I am guessing this is a simple problem to solve. Can anyone offer an answer?

TIA
Tom

I’ve been watching it and it seems there are periodic updates when the window doesn’t have focus. Could it be that the OSX process priority is too low?

Or AppNap making it run at a lower priority.

I do believe you hit the nail on the head.

Xojo and the apps created by it do not have the AppNap checkbox in the Get Info window (which allows you to disable AppNap). There is a command that can be executed in the shell to turn AppNap off for all apps:

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

After I ran this, it appears that losing focus has no effect on the app behaviour.

Thanks for the tip!

There are declares that you can use when you start an activity. Or you use

theProcessInfo = NSProcessInfoMBS.processInfo theProcessActivity = theProcessInfo.beginActivity(NSProcessInfoMBS.NSActivityIdleSystemSleepDisabled, "archiving mail") 'do your stuff here if theProcessActivity <> nil and theProcessInfo <> nil then theProcessInfo.endActivity theProcessActivity theProcessActivity = Nil end if

from the MBS plugin.