Skip to content

Commit

Permalink
#2137 in readonly mode, force the size-constraints to a fixed size, u…
Browse files Browse the repository at this point in the history
…pdate it only if we get a (move-)resize request

git-svn-id: https://xpra.org/svn/Xpra/trunk@22525 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 23, 2019
1 parent 83fe87c commit d6a7fda
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/xpra/client/client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,23 @@ def is_OR(self):

def update_metadata(self, metadata):
metalog("update_metadata(%s)", metadata)
if self._client.readonly:
metadata.update(self._force_size_constraint(*self._size))
self._metadata.update(metadata)
try:
self.set_metadata(metadata)
except Exception:
metalog.warn("failed to set window metadata to '%s'", metadata, exc_info=True)

def _force_size_constraint(self, *size):
return {
b"size-constraints" : {
b"maximum-size" : size,
b"minimum-size" : size,
b"base-size" : size,
}
}

def set_metadata(self, metadata):
metalog("set_metadata(%s)", metadata)
debug_props = [x for x in PROPERTIES_DEBUG if x in metadata.keys()]
Expand Down
1 change: 1 addition & 0 deletions src/xpra/client/gl/window_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def noop(*_args):
noclient.server_window_decorations = True
noclient.mmap_enabled = False
noclient.mmap = None
noclient.readonly = False
noclient.encoding_defaults = {}
noclient.get_window_frame_sizes = get_None
noclient._set_window_menu = None
Expand Down
6 changes: 6 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 @@ -1499,6 +1499,12 @@ def do_moveresize(self):
x, y = int(move[0]), int(move[1])
if resize:
w, h = int(resize[0]), int(resize[1])
if self._client.readonly:
#change size-constraints first,
#so the resize can be honoured:
sc = self._force_size_constraint(w, h)
self._metadata.update(sc)
self.set_metadata(sc)
if move and resize:
self.get_window().move_resize(x, y, w, h)
elif move:
Expand Down

0 comments on commit d6a7fda

Please sign in to comment.