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 latest scale and recalculate dpi.
Already added the ``<Display *>`` line, thx.