Skip to content

Commit

Permalink
#3476 pass title and geometry as arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 25, 2022
1 parent 9595cbc commit cbe745b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
14 changes: 5 additions & 9 deletions xpra/server/shadow/gtk_shadow_server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions xpra/server/shadow/root_window_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions xpra/x11/shadow_x11_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2012-2020 Antoine Martin <[email protected]>
# Copyright (C) 2012-2022 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

0 comments on commit cbe745b

Please sign in to comment.