From cbe745bd8b4339f850a764f90e2419bedd6dd817 Mon Sep 17 00:00:00 2001 From: totaam Date: Fri, 25 Feb 2022 22:03:31 +0700 Subject: [PATCH] #3476 pass title and geometry as arguments --- xpra/server/shadow/gtk_shadow_server_base.py | 14 +++++--------- xpra/server/shadow/root_window_model.py | 6 +++--- xpra/x11/shadow_x11_server.py | 12 ++++++------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/xpra/server/shadow/gtk_shadow_server_base.py b/xpra/server/shadow/gtk_shadow_server_base.py index 37d73ae490..e48c982b4a 100644 --- a/xpra/server/shadow/gtk_shadow_server_base.py +++ b/xpra/server/shadow/gtk_shadow_server_base.py @@ -208,11 +208,8 @@ def makeRootWindowModels(self): except Exception: match_str = self.display_options if not multi_window or geometries: - for geometry in (geometries or (None,)): - model = model_class(self.root, self.capture) - model.title = display_name - if geometry: - model.geometry = geometry + for geometry in (geometries or (self.root.get_geometry()[:4],)): + model = model_class(self.root, self.capture, display_name, geometry) models.append(model) return models found = [] @@ -226,11 +223,10 @@ def makeRootWindowModels(self): if match_str and not(title in match_str or plug_name in match_str): screenlog.info(" skipped monitor %s", plug_name or title) continue - model = model_class(self.root, self.capture) - model.title = title - model.geometry = (x, y, width, height) + geometry = (x, y, width, height) + model = model_class(self.root, self.capture, title, geometry) models.append(model) - screenlog("monitor %i: %10s geometry=%s, scale factor=%s", i, title, model.geometry, scale_factor) + screenlog("monitor %i: %10s geometry=%s, scale factor=%s", i, title, geometry, scale_factor) screenlog("makeRootWindowModels()=%s", models) if not models and match_str: screenlog.warn("Warning: no monitors found matching %r", match_str) diff --git a/xpra/server/shadow/root_window_model.py b/xpra/server/shadow/root_window_model.py index f924094a78..b1b9915b50 100644 --- a/xpra/server/shadow/root_window_model.py +++ b/xpra/server/shadow/root_window_model.py @@ -21,10 +21,10 @@ class RootWindowModel: __slots__ = ("window", "title", "geometry", "capture", "property_names", "dynamic_property_names", "internal_property_names", "signal_listeners") - def __init__(self, root_window, capture=None): + def __init__(self, root_window, capture=None, title="", geometry=None): self.window = root_window - self.title = prettify_plug_name(root_window.get_screen().get_display().get_name()) - self.geometry = root_window.get_geometry()[:4] + self.title = title + self.geometry = geometry self.capture = capture self.property_names = [ "title", "class-instance", diff --git a/xpra/x11/shadow_x11_server.py b/xpra/x11/shadow_x11_server.py index 1eacb3d901..e8e690ec6b 100755 --- a/xpra/x11/shadow_x11_server.py +++ b/xpra/x11/shadow_x11_server.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is part of Xpra. -# Copyright (C) 2012-2020 Antoine Martin +# Copyright (C) 2012-2022 Antoine Martin # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. @@ -132,8 +132,8 @@ def setup_capture(window): class X11ShadowModel(RootWindowModel): __slots__ = ("xid", ) - def __init__(self, root_window, capture=None): - super().__init__(root_window, capture) + def __init__(self, root_window, capture=None, title="", geometry=None): + super().__init__(root_window, capture, title, geometry) try: self.xid = root_window.get_xid() self.property_names.append("xid") @@ -282,7 +282,7 @@ def main(filename): import sys if len(sys.argv)!=2: print("usage: %s filename.png" % sys.argv[0]) - v = 1 + r = 1 else: - v = main(sys.argv[1]) - sys.exit(v) + r = main(sys.argv[1]) + sys.exit(r)