Skip to content

Commit

Permalink
#1967: ensure that offsets are never negative, so we always get to se…
Browse files Browse the repository at this point in the history
…e the top-left corner of the window contents

git-svn-id: https://xpra.org/svn/Xpra/trunk@20542 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 28, 2018
1 parent 4bf8163 commit a88968b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/xpra/client/gtk_base/gtk_client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ def setup_window(self, *args):
if self._client._current_screen_sizes:
w, h = self._size
self.window_offset = self.calculate_window_offset(x, y, w, h)
geomlog("OR offsets=%s", self.window_offset)
if self.window_offset:
x += self.window_offset[0]
y += self.window_offset[1]
Expand Down Expand Up @@ -1709,12 +1710,15 @@ def resize(self, w, h, resize_counter=0):
def center_backing(self, w, h):
ww, wh = self.get_size()
#align in the middle:
ox = (ww-w)//2
oy = (wh-h)//2
dw = max(0, ww-w)
dh = max(0, wh-h)
ox = dw//2
oy = dh//2
geomlog("using window offset values %i,%i", ox, oy)
#some backings use top,left values,
#(opengl uses left and botton since the viewport starts at the bottom)
self._backing.offsets = ox, oy, ox+((ww-w)&0x1), oy+((wh-h)&0x1)
self._backing.offsets = ox, oy, ox+(dw&0x1), oy+(dh&0x1)
geomlog("center_backing(%i, %i) window size=%ix%i, backing offsets=%s", w, h, ww, wh, self._backing.offsets)
#adjust pointer coordinates:
self.window_offset = ox, oy

Expand Down

0 comments on commit a88968b

Please sign in to comment.