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?
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?
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:
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