Backported a number of fixes/enhancements (mostly related to keymapping) from TurboVNC viewer.  Also cleaned up some whitespace and minor formatting changes.

git-svn-id: https://tigervnc.svn.sourceforge.net/svnroot/tigervnc@5056 3789f03b-4d11-0410-bbf8-ca57d06f2519