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.