Skip to content

Commit

Permalink
show more backing details, generically
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@26566 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 1, 2020
1 parent 961e902 commit d127b10
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,17 @@ def __init__(self, wid : int, window_alpha, pixel_depth=0):
self.repaint_all = True
self._backing.show()

def get_info(self):
info = super().get_info()
info.update({
"type" : "OpenGL",
"bit-depth" : self.bit_depth,
"pixel-format" : self.pixel_format,
"texture-pixel-format" : self.texture_pixel_format,
})
return info


def init_gl_config(self):
raise NotImplementedError()

Expand Down
7 changes: 7 additions & 0 deletions src/xpra/client/gtk_base/cairo_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ def init(self, ww : int, wh : int, bw : int, bh : int):
self.render_size = ww, wh
self.create_surface()

def get_info(self):
return {
"type" : "Cairo",
"rgb-formats" : self.RGB_MODES,
}


def create_surface(self):
bw, bh = self.size
old_backing = self._backing
Expand Down
27 changes: 15 additions & 12 deletions src/xpra/client/gtk_base/window_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,8 @@ def window_deleted(*_args):
tb.new_row("Size Constraints", self.size_constraints_label)
tb.new_row("")
#backing:
self.backing_size_label = slabel()
tb.new_row("Backing Size", self.backing_size_label)
self.backing_render_size_label = slabel()
tb.new_row("Backing Render Size", self.backing_render_size_label)
self.backing_offsets_label = slabel()
tb.new_row("Backing Offsets", self.backing_offsets_label)
self.backing_properties = slabel()
tb.new_row("Backing Properties", self.backing_properties)
tb.new_row("")
btn = Gtk.Button(label="Copy to clipboard")
btn.connect("clicked", self.copy_to_clipboard)
Expand Down Expand Up @@ -237,13 +233,20 @@ def do_populate(self):
#backing:
b = w._backing
if b:
self.backing_size_label.set_text(csv(b.size))
self.backing_render_size_label.set_text(csv(b.render_size))
self.backing_offsets_label.set_text(csv(b.offsets))
self.backing_properties.show()
def pv(value):
if isinstance(value, (tuple, list)):
return csv(value)
if isinstance(value, dict):
return dict_to_str(dict((k,v) for k,v in value.items() if k in ("type", "encoding", )), ", ", ":")
return str(value)
def dict_to_str(d, sep="\n", eq="="):
strdict = dict((k,pv(v)) for k,v in d.items())
return sep.join("%s%s%s" % (k, eq, v) for k,v in strdict.items() if v)
self.backing_properties.set_text(dict_to_str(b.get_info()))
else:
self.backing_size_label.set_text("n/a")
self.backing_render_size_label.set_text("n/a")
self.backing_offsets_label.set_text("n/a")
self.backing_properties.hide()
self.backing_properties.set_text("")


def bool_icon(self, image, on_off):
Expand Down
18 changes: 18 additions & 0 deletions src/xpra/client/window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ def __init__(self, wid, window_alpha):
def idle_add(self, *_args, **_kwargs):
raise NotImplementedError()

def get_info(self):
info = {
"rgb-formats" : self.RGB_MODES,
"transparency" : self._alpha_enabled,
"mmap" : bool(self.mmap_enabled),
"size" : self.size,
"render-size" : self.render_size,
"offsets" : self.offsets,
}
vd = self._video_decoder
if vd:
info["video-decoder"] = self._video_decoder.get_info()
csc = self._csc_decoder
if csc:
info["csc"] = self._csc_decoder
return info


def enable_mmap(self, mmap_area):
self.mmap = mmap_area
self.mmap_enabled = True
Expand Down

0 comments on commit d127b10

Please sign in to comment.