Skip to content

Commit

Permalink
#4398 quality and speed can be used with all generic encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Oct 20, 2024
1 parent 0715128 commit 804c28b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion xpra/client/gtk3/menu_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def populate_encodingsmenu(encodings_submenu, get_current_encoding, set_encoding
def encoding_changed(item):
ensure_item_selected(encodings_submenu, item)
enc = NAME_TO_ENCODING.get(item.get_label())
log("encoding_changed(%s) enc=%s, current=%s", item, enc, encodings_submenu.get_current_encoding())
log.warn("encoding_changed(%s) enc=%s, current=%s", item, enc, encodings_submenu.get_current_encoding())
if enc is not None and encodings_submenu.get_current_encoding() != enc:
encodings_submenu.set_encoding(enc)

Expand All @@ -352,6 +352,7 @@ def encoding_changed(item):
encodings_submenu.append(encoding_item)
encodings_submenu.index_to_encoding[i] = encoding
encodings_submenu.encoding_to_index[encoding] = i
log.error(f"{NAME_TO_ENCODING=}")
encodings_submenu.show_all()


Expand Down
7 changes: 5 additions & 2 deletions xpra/client/gtk3/tray_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@

SERVER_NOT_SUPPORTED = "Not supported by the server"

GENERIC_ENCODINGS = ("", "stream", "grayscale")


class GTKTrayMenu(MenuHelper):

Expand Down Expand Up @@ -810,7 +812,8 @@ def set_quality(self, q) -> None:
def set_qualitymenu(self, *_args) -> None:
if self.quality:
enc = self.client.encoding
with_quality = enc in self.client.server_encodings_with_quality or enc == "auto"
# 'auto' is recorded as '' unfortunately:
with_quality = enc in self.client.server_encodings_with_quality or enc in GENERIC_ENCODINGS
can_use = with_quality and not self.client.mmap_enabled
set_sensitive(self.quality, can_use)
if self.client.mmap_enabled:
Expand Down Expand Up @@ -862,7 +865,7 @@ def set_speed(self, s) -> None:
def set_speedmenu(self, *_args) -> None:
if self.speed:
enc = self.client.encoding
with_speed = enc in self.client.server_encodings_with_speed or enc == "auto"
with_speed = enc in self.client.server_encodings_with_speed or enc in GENERIC_ENCODINGS
set_sensitive(self.speed, with_speed and not self.client.mmap_enabled)
if self.client.mmap_enabled:
self.speed.set_tooltip_text("Quality is always 100% with mmap")
Expand Down

0 comments on commit 804c28b

Please sign in to comment.