Skip to content

Commit

Permalink
#56 we don't support multiple screens
Browse files Browse the repository at this point in the history
this has been the case for a long time
  • Loading branch information
totaam committed Apr 17, 2022
1 parent 15e4ca4 commit 4c8a3ab
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 56 deletions.
4 changes: 1 addition & 3 deletions xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,9 @@ def nosend(*_args):
if v:
w, h = v
ss = c.tupleget("screen_sizes")
log.info(" remote desktop size is %sx%s", w, h)
if ss:
log.info(" remote desktop size is %sx%s with %s screen%s:", w, h, len(ss), engs(ss))
log_screen_sizes(w, h, ss)
else:
log.info(" remote desktop size is %sx%s", w, h)
if c.boolget("proxy"):
proxy_hostname = c.strget("proxy.hostname")
proxy_platform = c.strget("proxy.platform")
Expand Down
111 changes: 58 additions & 53 deletions xpra/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,60 +545,65 @@ def add_workarea(info, wx, wy, ww, wh):
if wx!=0 or wy!=0:
#log position if not (0, 0)
info.append("at %4ix%-4i" % (wx, wy))
for s in sizes:
if len(s)<10:
log.info(" %s", s)
if len(sizes)!=1:
log.warn("Warning: more than one screen found")
log.warn(" this is not supported")
log("do_log_screen_sizes(%i, %i, %s)", root_w, root_h, sizes)
return
s = sizes[0]
if len(s)<10:
log.info(" %s", s)
return
#more detailed output:
display_name, width, height, width_mm, height_mm, \
monitors, work_x, work_y, work_width, work_height = s[:10]
#always log plug name:
info = ["%s" % prettify_plug_name(display_name)]
if width!=root_w or height!=root_h:
#log plug dimensions if not the same as display (root):
info.append("%ix%i" % (width, height))
sdpix = dpi(width, width_mm)
sdpiy = dpi(height, height_mm)
info.append("(%ix%i mm - DPI: %ix%i)" % (width_mm, height_mm, sdpix, sdpiy))

if work_width!=width or work_height!=height or work_x!=0 or work_y!=0:
add_workarea(info, work_x, work_y, work_width, work_height)
log.info(" "+" ".join(info))
#sort monitors from left to right, top to bottom:
monitors_distances = []
for m in monitors:
plug_x, plug_y = m[1:3]
monitors_distances.append((plug_x+plug_y*width, m))
sorted_monitors = [x[1] for x in sorted(monitors_distances)]
for i, m in enumerate(sorted_monitors, start=1):
if len(m)<7:
log.info(" %s", m)
continue
plug_name, plug_x, plug_y, plug_width, plug_height, plug_width_mm, plug_height_mm = m[:7]
default_name = "monitor %i" % i
info = ['%-16s' % prettify_plug_name(plug_name, default_name)]
if plug_width!=width or plug_height!=height or plug_x!=0 or plug_y!=0:
info.append("%4ix%-4i" % (plug_width, plug_height))
if plug_x!=0 or plug_y!=0 or len(sorted_monitors)>1:
info.append("at %4ix%-4i" % (plug_x, plug_y))
if (plug_width_mm!=width_mm or plug_height_mm!=height_mm) and (plug_width_mm>0 or plug_height_mm>0):
dpix = dpi(plug_width, plug_width_mm)
dpiy = dpi(plug_height, plug_height_mm)
dpistr = ""
if sdpix!=dpix or sdpiy!=dpiy or len(sorted_monitors)>1:
dpistr = " - DPI: %ix%i" % (dpix, dpiy)
info.append("(%3ix%-3i mm%s)" % (plug_width_mm, plug_height_mm, dpistr))
if len(m)>=11:
dwork_x, dwork_y, dwork_width, dwork_height = m[7:11]
#only show it again if different from the screen workarea
if dwork_x!=work_x or dwork_y!=work_y or dwork_width!=work_width or dwork_height!=work_height:
add_workarea(info, dwork_x, dwork_y, dwork_width, dwork_height)
istr = (" ".join(info)).rstrip(" ")
if len(monitors)==1 and istr.lower() in ("unknown unknown", "0", "1", default_name, "screen", "monitor"):
#a single monitor with no real name,
#so don't bother showing it:
continue
#more detailed output:
display_name, width, height, width_mm, height_mm, \
monitors, work_x, work_y, work_width, work_height = s[:10]
#always log plug name:
info = ["%s" % prettify_plug_name(display_name)]
if width!=root_w or height!=root_h:
#log plug dimensions if not the same as display (root):
info.append("%ix%i" % (width, height))
sdpix = dpi(width, width_mm)
sdpiy = dpi(height, height_mm)
info.append("(%ix%i mm - DPI: %ix%i)" % (width_mm, height_mm, sdpix, sdpiy))

if work_width!=width or work_height!=height or work_x!=0 or work_y!=0:
add_workarea(info, work_x, work_y, work_width, work_height)
log.info(" "+" ".join(info))
#sort monitors from left to right, top to bottom:
monitors_distances = []
for m in monitors:
plug_x, plug_y = m[1:3]
monitors_distances.append((plug_x+plug_y*width, m))
sorted_monitors = [x[1] for x in sorted(monitors_distances)]
for i, m in enumerate(sorted_monitors, start=1):
if len(m)<7:
log.info(" %s", m)
continue
plug_name, plug_x, plug_y, plug_width, plug_height, plug_width_mm, plug_height_mm = m[:7]
default_name = "monitor %i" % i
info = ['%-16s' % prettify_plug_name(plug_name, default_name)]
if plug_width!=width or plug_height!=height or plug_x!=0 or plug_y!=0:
info.append("%4ix%-4i" % (plug_width, plug_height))
if plug_x!=0 or plug_y!=0 or len(sorted_monitors)>1:
info.append("at %4ix%-4i" % (plug_x, plug_y))
if (plug_width_mm!=width_mm or plug_height_mm!=height_mm) and (plug_width_mm>0 or plug_height_mm>0):
dpix = dpi(plug_width, plug_width_mm)
dpiy = dpi(plug_height, plug_height_mm)
dpistr = ""
if sdpix!=dpix or sdpiy!=dpiy or len(sorted_monitors)>1:
dpistr = " - DPI: %ix%i" % (dpix, dpiy)
info.append("(%3ix%-3i mm%s)" % (plug_width_mm, plug_height_mm, dpistr))
if len(m)>=11:
dwork_x, dwork_y, dwork_width, dwork_height = m[7:11]
#only show it again if different from the screen workarea
if dwork_x!=work_x or dwork_y!=work_y or dwork_width!=work_width or dwork_height!=work_height:
add_workarea(info, dwork_x, dwork_y, dwork_width, dwork_height)
istr = (" ".join(info)).rstrip(" ")
if len(monitors)==1 and istr.lower() in ("unknown unknown", "0", "1", default_name, "screen", "monitor"):
#a single monitor with no real name,
#so don't bother showing it:
continue
log.info(" "+istr)
log.info(" "+istr)

def get_screen_info(screen_sizes):
#same format as above
Expand Down

0 comments on commit 4c8a3ab

Please sign in to comment.