Fixed a number of cross-compilation issues.
Refactored, separated into QWS and X11
Cleaned up