Skip to content

Commit

Permalink
#1232: avoid errors if desktop-scaling causes a mismatch between serv…
Browse files Browse the repository at this point in the history
…er-side window size and the client-side backing size

git-svn-id: https://xpra.org/svn/Xpra/trunk@13618 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 8, 2016
1 parent 4c7b239 commit ff3aff8
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,25 @@ def fail(msg):
if w<=0 or h<=0:
fail("invalid scroll area size: %ix%i" % (w, h))
continue
if x+w>bw or y+h>bh:
fail("scroll rectangle %s too big for the buffer: %s" % ((x, y, w, h), self.size))
continue
if x+xdelta<0 or x+w+xdelta>bw:
#these should be errors,
#but desktop-scaling can cause a mismatch between the backing size
#and the real window size server-side.. so we clamp the dimensions instead
if x+w>bw:
w = bw-x
if y+h>bh:
h = bh-y
if x+w+xdelta>bw:
w = bw-x-xdelta
if w<=0:
continue #nothing left!
if y+h+ydelta>bh:
h = bh-y-ydelta
if h<=0:
continue #nothing left!
if x+xdelta<0:
fail("horizontal scroll by %i: rectangle %s overflows the backing buffer size %s" % (xdelta, (x, y, w, h), self.size))
continue
if y+ydelta<0 or y+h+ydelta>bh:
if y+ydelta<0:
fail("vertical scroll by %i: rectangle %s overflows the backing buffer size %s" % (ydelta, (x, y, w, h), self.size))
continue
#opengl buffer is upside down, so we must invert Y coordinates: bh-(..)
Expand Down

0 comments on commit ff3aff8

Please sign in to comment.