summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 01:52:44 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 01:52:44 +0000
commit31d2a58f1fb1708cdfc19e9aefec581c7c3c45bf (patch)
tree8d5e85e0adef6c50f742ed06f321cc6ac852623e /remoting/host
parentd21f1e9f6a3680bc30f225e127a83a37f5cd0263 (diff)
downloadchromium_src-31d2a58f1fb1708cdfc19e9aefec581c7c3c45bf.zip
chromium_src-31d2a58f1fb1708cdfc19e9aefec581c7c3c45bf.tar.gz
chromium_src-31d2a58f1fb1708cdfc19e9aefec581c7c3c45bf.tar.bz2
Use sane default screen size if RANDR not supported
In order of precedence, set size according to: * Command line parameters if present * Environment variable if present * 1600x1200,3840x1600 if RANDR is present, otherwise just 1600x1200. R=jamiewalch@chromium.org Review URL: https://codereview.chromium.org/278753002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rwxr-xr-xremoting/host/linux/linux_me2me_host.py44
1 files changed, 32 insertions, 12 deletions
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py
index 2604849..8adca6e 100755
--- a/remoting/host/linux/linux_me2me_host.py
+++ b/remoting/host/linux/linux_me2me_host.py
@@ -37,11 +37,16 @@ LOG_FILE_ENV_VAR = "CHROME_REMOTE_DESKTOP_LOG_FILE"
# list of sizes in this environment variable.
DEFAULT_SIZES_ENV_VAR = "CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES"
-# By default, provide a relatively small size to handle the case where resize-
-# to-client is disabled, and a much larger size to support clients with large
-# or mulitple monitors. These defaults can be overridden in ~/.profile.
+# By default, provide a maximum size that is large enough to support clients
+# with large or multiple monitors. This is a comma-separated list of
+# resolutions that will be made available if the X server supports RANDR. These
+# defaults can be overridden in ~/.profile.
DEFAULT_SIZES = "1600x1200,3840x1600"
+# If RANDR is not available, use a smaller default size. Only a single
+# resolution is supported in this case.
+DEFAULT_SIZE_NO_RANDR = "1600x1200"
+
SCRIPT_PATH = sys.path[0]
IS_INSTALLED = (os.path.basename(sys.argv[0]) != 'linux_me2me_host.py')
@@ -78,6 +83,7 @@ MAX_LAUNCH_FAILURES = SHORT_BACKOFF_THRESHOLD + 10
g_desktops = []
g_host_hash = hashlib.md5(socket.gethostname()).hexdigest()
+
def is_supported_platform():
# Always assume that the system is supported if the config directory or
# session file exist.
@@ -89,6 +95,19 @@ def is_supported_platform():
distribution = platform.linux_distribution()
return (distribution[0]).lower() == 'ubuntu'
+
+def get_randr_supporting_x_server():
+ """Returns a path to an X server that supports the RANDR extension, if this
+ is found on the system. Otherwise returns None."""
+ try:
+ xvfb = "/usr/bin/Xvfb-randr"
+ if not os.path.exists(xvfb):
+ xvfb = locate_executable("Xvfb-randr")
+ return xvfb
+ except Exception:
+ return None
+
+
class Config:
def __init__(self, path):
self.path = path
@@ -327,15 +346,10 @@ class Desktop:
max_width = max([width for width, height in self.sizes])
max_height = max([height for width, height in self.sizes])
- try:
- # TODO(jamiewalch): This script expects to be installed alongside
- # Xvfb-randr, but that's no longer the case. Fix this once we have
- # a Xvfb-randr package that installs somewhere sensible.
- xvfb = "/usr/bin/Xvfb-randr"
- if not os.path.exists(xvfb):
- xvfb = locate_executable("Xvfb-randr")
+ xvfb = get_randr_supporting_x_server()
+ if xvfb:
self.server_supports_exact_resize = True
- except Exception:
+ else:
xvfb = "Xvfb"
self.server_supports_exact_resize = False
@@ -1018,9 +1032,15 @@ Web Store: https://chrome.google.com/remotedesktop"""
print >> sys.stderr, EPILOG
return 1
+ # If a RANDR-supporting Xvfb is not available, limit the default size to
+ # something more sensible.
+ if get_randr_supporting_x_server():
+ default_sizes = DEFAULT_SIZES
+ else:
+ default_sizes = DEFAULT_SIZE_NO_RANDR
+
# Collate the list of sizes that XRANDR should support.
if not options.size:
- default_sizes = DEFAULT_SIZES
if os.environ.has_key(DEFAULT_SIZES_ENV_VAR):
default_sizes = os.environ[DEFAULT_SIZES_ENV_VAR]
options.size = default_sizes.split(",")