Dev - C++ - How to detect 'Idle' status in Mac (Qt\C++ application)

 
Vista:
sin imagen de perfil
Val: 4
Ha disminuido su posición en 2 puestos en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

How to detect 'Idle' status in Mac (Qt\C++ application)

Publicado por Diego (3 intervenciones) el 26/07/2019 12:47:54
Hi,

I have a C++/Qt application for Win & Mac where I need to know if the user is in an 'idle' status (no user interaction in X minutes).

In Windows I am using GetLastInputInfo and it is working perfectly:

....

// Get the last input event info.
LASTINPUTINFO li;
li.cbSize = sizeof(LASTINPUTINFO);
::GetLastInputInfo(&li);

// Calculate the time elapsed in seconds.
DWORD te = ::GetTickCount();

int elapsed = (te - li.dwTime) / 1000;

....

For Mac I have read that CGEventSourceCounterForEventType could help me. But I can not find how to use it in a C++ method

I would thank any help,

Diego
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder