Call redraw only when region is invalidated

Added a condition to redraw a rect only when region is invalidated. For
example. this avoids a redraw when only the cursor changes on the
remote machine.
Merge pull request #2220 from hopToDev/master

Call redraw only when region is invalidated