Skip to content

Commit

Permalink
#1656: repaint the area around the backing (when we have an offset) w…
Browse files Browse the repository at this point in the history
…hen we get an expose event, and clip to the backing area before painting it

git-svn-id: https://xpra.org/svn/Xpra/trunk@17167 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 13, 2017
1 parent 67c2388 commit 493df0d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/xpra/client/gtk2/gtk2_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ def do_expose_event(self, event):
context = self.window.cairo_create()
context.rectangle(event.area)
context.clip()
self.paint_backing_offset_border(backing, context)
self.clip_to_backing(backing, context)
backing.cairo_draw(context)
self.cairo_paint_border(context, event.area)
if not self._client.server_ok():
Expand Down
5 changes: 4 additions & 1 deletion src/xpra/client/gtk3/client_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def queue_draw(self, x, y, width, height):

def do_draw(self, context):
paintlog("do_draw(%s)", context)
if self.get_mapped() and self._backing:
backing = self._backing
if self.get_mapped() and backing:
self.paint_backing_offset_border(backing, context)
self.clip_to_backing(backing, context)
self._backing.cairo_draw(context)
self.cairo_paint_border(context, None)

Expand Down
36 changes: 36 additions & 0 deletions src/xpra/client/gtk_base/gtk_client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@
UNDECORATED_TRANSIENT_IS_OR = envint("XPRA_UNDECORATED_TRANSIENT_IS_OR", 1)
XSHAPE = envbool("XPRA_XSHAPE", True)
LAZY_SHAPE = envbool("XPRA_LAZY_SHAPE", True)
PADDING_COLORS = 0, 0, 0
PADDING_COLORS_STR = os.environ.get("XPRA_PADDING_COLORS")
if PADDING_COLORS_STR:
try:
PADDING_COLORS = tuple(float(x.strip()) for x in PADDING_COLORS_STR.split(","))
assert len(PADDING_COLORS)==3, "you must specify 3 components"
except Exception as e:
log.error("Warning: invalid padding colors specified,")
log.error(" %s", e)
log.error(" using black")
PADDING_COLORS = 0, 0, 0
del PADDING_COLORS_STR


#window types we map to POPUP rather than TOPLEVEL
POPUP_TYPE_HINTS = set((
Expand Down Expand Up @@ -1303,6 +1316,29 @@ def center_backing(self, w, h):
#adjust pointer coordinates:
self.window_offset = ox, oy

def paint_backing_offset_border(self, backing, context):
w,h = self.get_size()
left, top, right, bottom = backing.offsets
if left!=0 or top!=0 or right!=0 or bottom!=0:
context.save()
context.set_source_rgb(0, 0, 1)
for rx, ry, rw, rh in (
(0, 0, left, h), #left hand side padding
(0, 0, w, top), #top padding
(w-right, 0, right, h), #RHS
(0, h-bottom, w, bottom), #bottom
):
if rw>0 and rh>0:
context.rectangle(rx, ry, rw, rh)
context.fill()
context.restore()

def clip_to_backing(self, backing, context):
w,h = self.get_size()
left, top, right, bottom = backing.offsets
context.rectangle(left, top, w-left-right, h-top-bottom)
context.clip()

def move_resize(self, x, y, w, h, resize_counter=0):
geomlog("window %i move_resize%s", self._id, (x, y, w, h, resize_counter))
w = max(1, w)
Expand Down

0 comments on commit 493df0d

Please sign in to comment.