recalculate dpi on different platform

The scale factor will always be 1 if the output scale does not change.
So I default set factor to 1. If the event happens, the listener will
get the scale.
Merge pull request #356 from scuxiayiqian/recalculate-dpi

recalculate dpi on different platform