I am trying to block the function XNextEvent
from returning when DPMS is actively blanking the screen, so that I do not receive keyboard or mouse inputs while my screen is black.
I want to block the function from returning entirely, because I have already tried to query DPMS for its state once the function returns, but it seems that the DPMS system is somehow processing all of my inputs before X receives them, because every query within XNextEvent
is telling me that DPMS is no longer blanking:
while (running && !XNextEvent(dpy, &ev))
{
if (!DPMSInfo(dpy, &pwr, &state))
{
fprintf(stderr, "%s: DPMSInfo failed!\n", argv[0]);
running = 0;
}
else if (!state || pwr == DPMSModeOn)
{
// sans a critical error, this will ALWAYS return true
// regardless of the current state of the screen
if (ev.type == KeyPress)
{
// now I am handling keyboard input
// while the screen is still potentially blank
}
}
}
Is there some underlying feature of DPMS or X that will block all inputs while blanked, and require at least one input to awaken the display before continuing to listen to them?