else:
edid = "%s-%s" % (XrandrOutput.EDID_UNAVAILABLE, match["output"])
- if not match["connected"] or not match["width"]:
+ # An output can be disconnected but still have a mode configured. This can only happen
+ # as a residual situation after a disconnect, you cannot associate a mode with an disconnected
+ # output.
+ #
+ # This code needs to be careful not to mix the two. An output should only be configured to
+ # "off" if it doesn't have a mode associated with it, which is modelled as "not a width" here.
+ if not match["width"]:
options["off"] = None
else:
if match["mode_name"]:
options["mode"] = "%sx%s" % (match["mode_width"], match["mode_height"])
else:
if match["rotate"] not in ("left", "right"):
- options["mode"] = "%sx%s" % (match["width"], match["height"])
+ options["mode"] = "%sx%s" % (match["width"] or 0, match["height"] or 0)
else:
- options["mode"] = "%sx%s" % (match["height"], match["width"])
- options["rotate"] = match["rotate"]
+ options["mode"] = "%sx%s" % (match["height"] or 0, match["width"] or 0)
+ if match["rotate"]:
+ options["rotate"] = match["rotate"]
if match["primary"]:
options["primary"] = None
if match["reflect"] == "X":