commits
Use XInput to list devices and find the master keyboard device id,
then find the corresponding "DEVICEIDLETIME #" idle timer to listen
to instead of the global IDLETIME timer.
Using XRRGetScreenResources does a blocking update which can take a
long time.
From issue #5
Since the exit handler can't brighten on its own, just write into
the pipe and return. The poll() call is now checking on the pipe
and if it detects a write, brighten back up and exit cleanly.
- use float instead of double, we don't need the extra precision
- eliminate dim() and brighten(), just call stepper() directly
- simplify XSyncAlarm setting and resetting
- primarily use XPeekEvent instead of XNextEvent so when we break
out of stepper(), the alarm event is still on the queue waiting to
be read and processed
- in backlight_op, don't discard events in the XSync call; this is
what was making it randomly not notice the idle timer resetting
until stepper was done and the idle alarm reset
XNextEventOrTimeout: XNextEvent will always return positive because
it's blocking
Rather than have to wait until the entire dimming is done, which can
be lengthy if there are many steps, setup reset_alarm before dim()
based on
https://msdn.microsoft.com/en-us/library/windows/desktop/dd319008(v=vs.85).aspx
currently on broadwell machines, we're using the modeset xorg driver
which doesn't export a backlight interface.
use 120 seconds as default timeout, and 10% as default brightness
if the locker is turning the screen off with dpms, backlight will be
0, so don't try to lower it to something higher than that
- use float instead of double, we don't need the extra precision
- eliminate dim() and brighten(), just call stepper() directly
- simplify XSyncAlarm setting and resetting
- primarily use XPeekEvent instead of XNextEvent so when we break
out of stepper(), the alarm event is still on the queue waiting to
be read and processed
- in backlight_op, don't discard events in the XSync call; this is
what was making it randomly not notice the idle timer resetting
until stepper was done and the idle alarm reset