diff --git a/src/xpra/client/gtk2/gtk2_window_base.py b/src/xpra/client/gtk2/gtk2_window_base.py index fe1ed0de2f..0b5a944949 100644 --- a/src/xpra/client/gtk2/gtk2_window_base.py +++ b/src/xpra/client/gtk2/gtk2_window_base.py @@ -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(): diff --git a/src/xpra/client/gtk3/client_window.py b/src/xpra/client/gtk3/client_window.py index 0da40fe18f..0572718300 100644 --- a/src/xpra/client/gtk3/client_window.py +++ b/src/xpra/client/gtk3/client_window.py @@ -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) diff --git a/src/xpra/client/gtk_base/gtk_client_window_base.py b/src/xpra/client/gtk_base/gtk_client_window_base.py index eee5a9a1d3..531c6c1330 100644 --- a/src/xpra/client/gtk_base/gtk_client_window_base.py +++ b/src/xpra/client/gtk_base/gtk_client_window_base.py @@ -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(( @@ -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)