This library from the modular X.org project provides an interface to the XFree86-Misc extension which allows various server settings to be queried and changed dynamically.