1

It's need to port our software on MacOS and Linux. How can I detect input IDLE on MacOS and Linux using Delphi 10.2?

In Windows I use :

 aLastInputInfo.cbSize := SizeOf(TLastInputInfo);
 GetLastInputInfo(aLastInputInfo);

 case (GetTickCount - aLastInputInfo.dwTime) / 1000 / 60 > IDLE_TIMER of
   True: Synchronize(OnExecuted); 
   False: Synchronize(OnExcepted); 
 end;

But this is platform specific, relying on Windows API calls.

J...
  • 30,968
  • 6
  • 66
  • 143
Oleg Skok
  • 19
  • 1
  • Have you checked how others do it? Most of the time it's quite easy to translate. Perhaps start from here: https://stackoverflow.com/questions/6418210/notification-when-the-system-is-idle-or-not-on-os-x – Sherlock70 Nov 08 '18 at 11:10
  • What do you mean when you say "System IDLE"? Show us what you are checking on Windows so we can understand what you mean. – J... Nov 08 '18 at 14:20
  • For Windows I use this code: aLastInputInfo.cbSize := SizeOf(TLastInputInfo); GetLastInputInfo(aLastInputInfo);case (GetTickCount - aLastInputInfo.dwTime) / 1000 / 60 > IDLE_TIMER of True: Synchronize(OnExecuted); False: Synchronize(OnExcepted); end; – Oleg Skok Nov 09 '18 at 03:53
  • https://stackoverflow.com/questions/6418210/notification-when-the-system-is-idle-or-not-on-os-xI I saw this link, but I do not know how to use it in Delphi – Oleg Skok Nov 09 '18 at 03:55
  • Much better, I've edited your question. – J... Nov 09 '18 at 13:04

0 Answers0