Skip to content

Commit

Permalink
Merge pull request #29 from dstelter/upstream
Browse files Browse the repository at this point in the history
Resize canvas without discarding the current screen if an updated chunk ...
  • Loading branch information
sibson committed May 28, 2014
2 parents 03ad134 + 1b4aca7 commit 3ac5811
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vncdotool/client.py
Expand Up @@ -353,8 +353,14 @@ def updateRectangle(self, x, y, width, height, data):
if not self.screen:
self.screen = update
# track upward screen resizes, often occurs during os boot of VMs
elif self.screen.size[0] < width or self.screen.size[1] < height:
self.screen = update
# When the screen is sent in chunks (as observed on VMWare ESXi), the canvas
# needs to be resized to fit all existing contents and the update.
elif self.screen.size[0] < (x+width) or self.screen.size[1] < (y+height):
new_size = (max(x+width, self.screen.size[0]), max(y+height, self.screen.size[1]))
new_screen = Image.new("RGB", new_size, "black")
new_screen.paste(self.screen, (0, 0))
new_screen.paste(update, (x, y))
self.screen = new_screen
else:
self.screen.paste(update, (x, y))

Expand Down

0 comments on commit 3ac5811

Please sign in to comment.