Modify window in module thread

Add dirty flag and other flags to window type
Add feature to create new windows
Drop boost::shared_mutex for std::recursive_mutex