Locks: Rework to avoid unnecessary display reopening

The extremely useful "Locks" plugin eats quite a lot of CPU (>2% here on a
old-ish laptop), unfortunately. The plug-in unnecessary reopens the
display, which is quite expensive operation. It results into 16 syscalls:

     socket(PF_LOCAL)      -> connect(sun_path=@"/tmp/.X11-unix/X0"})
  -> getpeername()         -> uname()
  -> access(".Xauthority") -> open(".Xauthority")
  -> fstat()               -> mmap()
  -> read()                -> close()
  -> munmap()              -> getsockname()
  -> fcntl(F_SETFD)        -> fcntl(F_SETFL)
  -> shutdown()            -> close()

This is almost half of all the syscalls that we ought to execute for the
plug-in to work. Now, considering the useful work and that "Locks" runs
every 200 milliseconds, it gives us >300 syscalls (and a lot more
wake-ups) per second.

This commit fixes the reopening issue, effectively halving the CPU
consumption (down to ~1%). The patch also makes it easier to implement
event-driven indicators that will reduce the idle CPU consumption to 0.
Locks: Implement event-driven locks indicator

This commit does more fundamental rework of the "Locks" plug-in: now the
plug-in is fully event-driven and thus extremely power-efficient,
effectively zero CPU consumption while idling.
News and credit for Anton's excellent patches