Merge pull request #1247 from hwhw/master

pull fixes for viewport-related code from base
update base: bugfix for refresh waiting